21
21
**Software and Dependencies:**
22
22
23
23
* Adafruit CircuitPython firmware for the supported boards:
24
- https://github.com/adafruit/circuitpython/releases
24
+ https://circuitpython.org/downloads
25
25
26
26
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
29
29
"""
30
30
31
31
from micropython import const
@@ -104,10 +104,9 @@ class VCNL4040: # pylint: disable=too-few-public-methods
104
104
105
105
import time
106
106
import board
107
- import busio
108
107
import adafruit_vcnl4040
109
108
110
- i2c = busio .I2C(board.SCL, board.SDA )
109
+ i2c = board .I2C()
111
110
sensor = adafruit_vcnl4040.VCNL4040(i2c)
112
111
113
112
while True:
@@ -128,8 +127,8 @@ class VCNL4040: # pylint: disable=too-few-public-methods
128
127
"""Interrupt enable. Interrupt setting are close, away, close and away, or disabled. Options
129
128
are: PS_INT_DISABLE, PS_INT_CLOSE, PS_INT_AWAY, PS_INT_CLOSE_AWAY."""
130
129
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."""
133
132
134
133
# PS_THDL_LM - PS low interrupt threshold setting
135
134
proximity_low_threshold = UnaryStruct (0x06 , "<H" )
@@ -178,10 +177,9 @@ def lux(self):
178
177
179
178
import time
180
179
import board
181
- import busio
182
180
import adafruit_vcnl4040
183
181
184
- i2c = busio .I2C(board.SCL, board.SDA )
182
+ i2c = board .I2C()
185
183
sensor = adafruit_vcnl4040.VCNL4040(i2c)
186
184
187
185
while True:
@@ -208,10 +206,9 @@ def light_integration_time(self):
208
206
209
207
import time
210
208
import board
211
- import busio
212
209
import adafruit_vcnl4040
213
210
214
- i2c = busio .I2C(board.SCL, board.SDA )
211
+ i2c = board .I2C()
215
212
sensor = adafruit_vcnl4040.VCNL4040(i2c)
216
213
217
214
sensor.light_integration_time = sensor.ALS_640MS
@@ -234,7 +231,7 @@ def light_integration_time(self, new_it):
234
231
sleep (it_delay_seconds )
235
232
236
233
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."""
238
235
239
236
# ALS_THDL_LM - ALS low interrupt threshold setting
240
237
light_low_threshold = UnaryStruct (0x02 , "<H" )
@@ -266,10 +263,9 @@ def white(self):
266
263
267
264
import time
268
265
import board
269
- import busio
270
266
import adafruit_vcnl4040
271
267
272
- i2c = busio .I2C(board.SCL, board.SDA )
268
+ i2c = board .I2C()
273
269
sensor = adafruit_vcnl4040.VCNL4040(i2c)
274
270
275
271
while True:
@@ -281,7 +277,7 @@ def white(self):
281
277
# PS_MS - White channel enable/disable, PS mode, PS protection setting, LED current
282
278
# White_EN - PS_MS_H, 7th bit - White channel enable/disable
283
279
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."""
285
281
286
282
def __init__ (self , i2c , address = 0x60 ):
287
283
self .i2c_device = i2cdevice .I2CDevice (i2c , address )
0 commit comments