Skip to content

Commit 5898b07

Browse files
authored
Merge pull request #13 from jposada202020/improving_docs
improving_docs
2 parents c0cfee9 + 0d97a16 commit 5898b07

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ To install in a virtual environment in your current project:
5656
Usage Example
5757
=============
5858

59-
.. code-block:: python
59+
.. code-block:: python3
6060
6161
import time
6262
import board
63-
import busio
6463
import adafruit_vcnl4040
6564
66-
i2c = busio.I2C(board.SCL, board.SDA)
65+
i2c = board.I2C()
6766
sensor = adafruit_vcnl4040.VCNL4040(i2c)
6867
6968
while True:

adafruit_vcnl4040.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
**Software and Dependencies:**
2222
2323
* Adafruit CircuitPython firmware for the supported boards:
24-
https://github.com/adafruit/circuitpython/releases
24+
https://circuitpython.org/downloads
2525
2626
27-
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28-
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
27+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2929
"""
3030

3131
from micropython import const
@@ -104,10 +104,9 @@ class VCNL4040: # pylint: disable=too-few-public-methods
104104
105105
import time
106106
import board
107-
import busio
108107
import adafruit_vcnl4040
109108
110-
i2c = busio.I2C(board.SCL, board.SDA)
109+
i2c = board.I2C()
111110
sensor = adafruit_vcnl4040.VCNL4040(i2c)
112111
113112
while True:
@@ -128,8 +127,8 @@ class VCNL4040: # pylint: disable=too-few-public-methods
128127
"""Interrupt enable. Interrupt setting are close, away, close and away, or disabled. Options
129128
are: PS_INT_DISABLE, PS_INT_CLOSE, PS_INT_AWAY, PS_INT_CLOSE_AWAY."""
130129
proximity_bits = RWBit(0x03, 11, register_width=2)
131-
"""Proximity data output setting. ``0`` when proximity sensor output is 12 bits, ``1`` when
132-
proximity sensor output is 16 bits."""
130+
"""Proximity data output setting. :const:`0` when proximity sensor output is 12 bits,
131+
:const:`1` when proximity sensor output is 16 bits."""
133132

134133
# PS_THDL_LM - PS low interrupt threshold setting
135134
proximity_low_threshold = UnaryStruct(0x06, "<H")
@@ -178,10 +177,9 @@ def lux(self):
178177
179178
import time
180179
import board
181-
import busio
182180
import adafruit_vcnl4040
183181
184-
i2c = busio.I2C(board.SCL, board.SDA)
182+
i2c = board.I2C()
185183
sensor = adafruit_vcnl4040.VCNL4040(i2c)
186184
187185
while True:
@@ -208,10 +206,9 @@ def light_integration_time(self):
208206
209207
import time
210208
import board
211-
import busio
212209
import adafruit_vcnl4040
213210
214-
i2c = busio.I2C(board.SCL, board.SDA)
211+
i2c = board.I2C()
215212
sensor = adafruit_vcnl4040.VCNL4040(i2c)
216213
217214
sensor.light_integration_time = sensor.ALS_640MS
@@ -234,7 +231,7 @@ def light_integration_time(self, new_it):
234231
sleep(it_delay_seconds)
235232

236233
light_interrupt = RWBit(0x00, 1, register_width=2)
237-
"""Ambient light sensor interrupt enable. ``True`` to enable, and ``False`` to disable."""
234+
"""Ambient light sensor interrupt enable. `True` to enable, and `False` to disable."""
238235

239236
# ALS_THDL_LM - ALS low interrupt threshold setting
240237
light_low_threshold = UnaryStruct(0x02, "<H")
@@ -266,10 +263,9 @@ def white(self):
266263
267264
import time
268265
import board
269-
import busio
270266
import adafruit_vcnl4040
271267
272-
i2c = busio.I2C(board.SCL, board.SDA)
268+
i2c = board.I2C()
273269
sensor = adafruit_vcnl4040.VCNL4040(i2c)
274270
275271
while True:
@@ -281,7 +277,7 @@ def white(self):
281277
# PS_MS - White channel enable/disable, PS mode, PS protection setting, LED current
282278
# White_EN - PS_MS_H, 7th bit - White channel enable/disable
283279
white_shutdown = RWBit(0x04, 15, register_width=2)
284-
"""White light channel shutdown. When ``True``, white light data is disabled."""
280+
"""White light channel shutdown. When `True`, white light data is disabled."""
285281

286282
def __init__(self, i2c, address=0x60):
287283
self.i2c_device = i2cdevice.I2CDevice(i2c, address)

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit VCNL4040 Proximity and Lux Sensor Learning Guide <https://learn.adafruit.com/adafruit-vcnl4040-proximity-sensor/>
2627

2728
.. toctree::
2829
:caption: Related Products
2930

31+
Adafruit VCNL4040 Proximity and Lux Sensor <https://www.adafruit.com/product/4161>
3032

3133
.. toctree::
3234
:caption: Other Links

examples/vcnl4040_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
import time
55
import board
6-
import busio
76
import adafruit_vcnl4040
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C()
109
sensor = adafruit_vcnl4040.VCNL4040(i2c)
1110

1211
while True:

0 commit comments

Comments
 (0)