Skip to content

Commit 7721d7b

Browse files
authored
Merge pull request #16 from jposada202020/improving_docs
improving_docs
2 parents b6a287e + c66762e commit 7721d7b

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

README.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ To install in a virtual environment in your current project:
5555
Usage Example
5656
=============
5757

58-
.. code-block:: python
58+
.. code-block:: python3
5959
6060
import time
6161
import board
62-
import busio
6362
import adafruit_veml7700
6463
65-
i2c = busio.I2C(board.SCL, board.SDA)
64+
i2c = board.I2C() # uses board.SCL and board.SDA
6665
veml7700 = adafruit_veml7700.VEML7700(i2c)
6766
6867
while True:

adafruit_veml7700.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616
1717
**Hardware:**
1818
19-
* `Adafruit VEML7700 <https://www.adafruit.com/products>`_
19+
* `Adafruit VEML7700 Lux Sensor - I2C Light Sensor
20+
<https://www.adafruit.com/product/4162>`_ (Product ID: 4162)
2021
2122
**Software and Dependencies:**
2223
2324
* Adafruit CircuitPython firmware for the supported boards:
24-
https://github.com/adafruit/circuitpython/releases
25+
https://circuitpython.org/downloads
2526
26-
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
27-
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
27+
* Adafruit's Bus Device library:
28+
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
29+
30+
* Adafruit's Register library:
31+
https://github.com/adafruit/Adafruit_CircuitPython_Register
2832
"""
2933

3034
from micropython import const
@@ -40,7 +44,8 @@
4044
class VEML7700:
4145
"""Driver for the VEML7700 ambient light sensor.
4246
43-
:param busio.I2C i2c_bus: The I2C bus the VEML7700 is connected to.
47+
:param ~busio.I2C i2c_bus: The I2C bus the device is connected to
48+
:param int address: The I2C device address. Defaults to :const:`0x10`
4449
4550
"""
4651

@@ -87,10 +92,9 @@ class VEML7700:
8792
8893
import time
8994
import board
90-
import busio
9195
import adafruit_veml7700
9296
93-
i2c = busio.I2C(board.SCL, board.SDA)
97+
i2c = board.I2C() # uses board.SCL and board.SDA
9498
veml7700 = adafruit_veml7700.VEML7700(i2c)
9599
96100
while True:
@@ -108,10 +112,9 @@ class VEML7700:
108112
109113
import time
110114
import board
111-
import busio
112115
import adafruit_veml7700
113116
114-
i2c = busio.I2C(board.SCL, board.SDA)
117+
i2c = board.I2C() # uses board.SCL and board.SDA
115118
veml7700 = adafruit_veml7700.VEML7700(i2c)
116119
117120
while True:
@@ -134,10 +137,9 @@ class VEML7700:
134137
135138
import time
136139
import board
137-
import busio
138140
import adafruit_veml7700
139141
140-
i2c = busio.I2C(board.SCL, board.SDA)
142+
i2c = board.I2C() # uses board.SCL and board.SDA
141143
veml7700 = adafruit_vcnl4040.VCNL4040(i2c)
142144
143145
veml7700.light_gain = veml7700.ALS_GAIN_2
@@ -158,10 +160,9 @@ class VEML7700:
158160
159161
import time
160162
import board
161-
import busio
162163
import adafruit_veml7700
163164
164-
i2c = busio.I2C(board.SCL, board.SDA)
165+
i2c = board.I2C() # uses board.SCL and board.SDA
165166
veml7700 = adafruit_vcnl4040.VCNL4040(i2c)
166167
167168
veml7700.light_integration_time = veml7700.ALS_400MS
@@ -196,18 +197,18 @@ def __init__(self, i2c_bus, address=0x10):
196197
raise RuntimeError("Unable to enable VEML7700 device")
197198

198199
def integration_time_value(self):
199-
"""Integration time value in integer form. Used for calculating ``resolution``."""
200+
"""Integration time value in integer form. Used for calculating :meth:`resolution`."""
200201
integration_time = self.light_integration_time
201202
return self.integration_time_values[integration_time]
202203

203204
def gain_value(self):
204-
"""Gain value in integer form. Used for calculating ``resolution``."""
205+
"""Gain value in integer form. Used for calculating :meth:`resolution`."""
205206
gain = self.light_gain
206207
return self.gain_values[gain]
207208

208209
def resolution(self):
209-
"""Calculate the ``resolution`` necessary to calculate lux. Based on integration time and
210-
gain settings."""
210+
"""Calculate the :meth:`resolution`` necessary to calculate lux. Based on
211+
integration time and gain settings."""
211212
resolution_at_max = 0.0036
212213
gain_max = 2
213214
integration_time_max = 800
@@ -233,10 +234,9 @@ def lux(self):
233234
234235
import time
235236
import board
236-
import busio
237237
import adafruit_veml7700
238238
239-
i2c = busio.I2C(board.SCL, board.SDA)
239+
i2c = board.I2C() # uses board.SCL and board.SDA
240240
veml7700 = adafruit_veml7700.VEML7700(i2c)
241241
242242
while True:

docs/index.rst

+4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit VEML7700 Lux Sensor - I2C Light Sensor Learning Guide <https://learn.adafruit.com/adafruit-veml7700>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

31+
Adafruit VEML7700 Lux Sensor - I2C Light Sensor <https://www.adafruit.com/product/4162>
32+
2933

3034
.. toctree::
3135
:caption: Other Links

examples/veml7700_simpletest.py

+1-2
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_veml7700
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C() # uses board.SCL and board.SDA
109
veml7700 = adafruit_veml7700.VEML7700(i2c)
1110

1211
while True:

0 commit comments

Comments
 (0)