Skip to content

Commit 99cc482

Browse files
Merge pull request #4 from jposada202020/improving_docs
improving_docs
2 parents df431ed + 12645c1 commit 99cc482

7 files changed

+43
-16
lines changed

README.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ Usage Example
6464
6565
import time
6666
import board
67-
import busio
6867
import adafruit_ltr390
6968
70-
i2c = busio.I2C(board.SCL, board.SDA)
71-
69+
i2c = board.I2C()
7270
ltr = adafruit_ltr390.LTR390(i2c)
7371
7472
while True:

adafruit_ltr390.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
1717
**Hardware:**
1818
19-
* Adafruit LTR390 Breakout <https://www.adafruit.com/product/38XX>`_
19+
* Adafruit `Adafruit LTR390 UV Light Sensor
20+
<https://www.adafruit.com/product/4831>`_ (Product ID: 4831)
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
26+
2527
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2628
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2729
"""
@@ -213,7 +215,37 @@ class MeasurementDelay(CV):
213215

214216

215217
class LTR390: # pylint:disable=too-many-instance-attributes
216-
"""Class to use the LTR390 Ambient Light and UV sensor"""
218+
"""Class to use the LTR390 Ambient Light and UV sensor
219+
220+
:param ~busio.I2C i2c: The I2C bus the LTR390 is connected to.
221+
:param int address: The I2C device address. Defaults to :const:`0x53`
222+
223+
224+
**Quickstart: Importing and using the LTR390**
225+
226+
Here is an example of using the :class:`LTR390` class.
227+
First you will need to import the libraries to use the sensor
228+
229+
.. code-block:: python
230+
231+
import board
232+
import adafruit_ltr390
233+
234+
Once this is done you can define your `board.I2C` object and define your sensor object
235+
236+
.. code-block:: python
237+
238+
i2c = board.I2C() # uses board.SCL and board.SDA
239+
ltr = adafruit_ltr390.LTR390(i2c)
240+
241+
Now you have access to the :attr:`lux` and :attr:`light` attributes
242+
243+
.. code-block:: python
244+
245+
lux = ltr.lux
246+
light = ltr.light
247+
248+
"""
217249

218250
_reset_bit = RWBit(_CTRL, 4)
219251
_enable_bit = RWBit(_CTRL, 1)
@@ -392,7 +424,7 @@ def lux(self):
392424
def window_factor(self):
393425
"""Window transmission factor (Wfac) for UVI and Lux calculations.
394426
A factor of 1 (default) represents no window or clear glass; > 1 for a tinted window.
395-
Factor of > 1 requires an emperical calibration with a reference light source."""
427+
Factor of > 1 requires an empirical calibration with a reference light source."""
396428
return self._window_factor
397429

398430
@window_factor.setter

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
77
.. automodule:: adafruit_ltr390
88
:members:
9+
:exclude-members: UnalignedStruct, CV

docs/index.rst

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

26+
Adafruit LTR390 UV Light Sensor Breakout Learning Guide <https://learn.adafruit.com/adafruit-ltr390-uv-sensor>
2627

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

30-
Adafruit LTR390 Breakout <https://www.adafruit.com/product/38XX>
31+
Adafruit LTR390 UV Light Sensor Breakout <https://www.adafruit.com/product/4831>
3132

3233
.. toctree::
3334
:caption: Other Links

examples/ltr390_alert_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
# pylint:disable=unused-import
55
import time
66
import board
7-
import busio
87
from adafruit_ltr390 import LTR390, UV, ALS
98

109
THRESHOLD_VALUE = 100
1110

12-
i2c = busio.I2C(board.SCL, board.SDA)
11+
i2c = board.I2C()
1312
ltr = LTR390(i2c)
1413

1514
ltr.high_threshold = THRESHOLD_VALUE

examples/ltr390_configuration_example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66
import time
77
import board
8-
import busio
98
from adafruit_ltr390 import LTR390, MeasurementDelay, Resolution, Gain
109

11-
i2c = busio.I2C(board.SCL, board.SDA)
12-
10+
i2c = board.I2C()
1311
ltr = LTR390(i2c)
1412

1513
# ltr.resolution = Resolution.RESOLUTION_16BIT

examples/ltr390_simpletest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
# SPDX-License-Identifier: Unlicense
44
import time
55
import board
6-
import busio
76
import adafruit_ltr390
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
10-
8+
i2c = board.I2C()
119
ltr = adafruit_ltr390.LTR390(i2c)
1210

1311
while True:

0 commit comments

Comments
 (0)