diff --git a/README.rst b/README.rst index 655a123..5b47d4d 100644 --- a/README.rst +++ b/README.rst @@ -64,11 +64,9 @@ Usage Example import time import board - import busio import adafruit_ltr390 - i2c = busio.I2C(board.SCL, board.SDA) - + i2c = board.I2C() ltr = adafruit_ltr390.LTR390(i2c) while True: diff --git a/adafruit_ltr390.py b/adafruit_ltr390.py index 5821f56..0b7a31a 100644 --- a/adafruit_ltr390.py +++ b/adafruit_ltr390.py @@ -16,12 +16,14 @@ **Hardware:** -* Adafruit LTR390 Breakout `_ +* Adafruit `Adafruit LTR390 UV Light Sensor + `_ (Product ID: 4831) **Software and Dependencies:** * Adafruit CircuitPython firmware for the supported boards: - https://github.com/adafruit/circuitpython/releases + https://circuitpython.org/downloads + * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register """ @@ -213,7 +215,37 @@ class MeasurementDelay(CV): class LTR390: # pylint:disable=too-many-instance-attributes - """Class to use the LTR390 Ambient Light and UV sensor""" + """Class to use the LTR390 Ambient Light and UV sensor + + :param ~busio.I2C i2c: The I2C bus the LTR390 is connected to. + :param int address: The I2C device address. Defaults to :const:`0x53` + + + **Quickstart: Importing and using the LTR390** + + Here is an example of using the :class:`LTR390` class. + First you will need to import the libraries to use the sensor + + .. code-block:: python + + import board + import adafruit_ltr390 + + Once this is done you can define your `board.I2C` object and define your sensor object + + .. code-block:: python + + i2c = board.I2C() # uses board.SCL and board.SDA + ltr = adafruit_ltr390.LTR390(i2c) + + Now you have access to the :attr:`lux` and :attr:`light` attributes + + .. code-block:: python + + lux = ltr.lux + light = ltr.light + + """ _reset_bit = RWBit(_CTRL, 4) _enable_bit = RWBit(_CTRL, 1) @@ -392,7 +424,7 @@ def lux(self): def window_factor(self): """Window transmission factor (Wfac) for UVI and Lux calculations. A factor of 1 (default) represents no window or clear glass; > 1 for a tinted window. - Factor of > 1 requires an emperical calibration with a reference light source.""" + Factor of > 1 requires an empirical calibration with a reference light source.""" return self._window_factor @window_factor.setter diff --git a/docs/api.rst b/docs/api.rst index b1f069a..d925386 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -6,3 +6,4 @@ .. automodule:: adafruit_ltr390 :members: + :exclude-members: UnalignedStruct, CV diff --git a/docs/index.rst b/docs/index.rst index f630c84..3225857 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,11 +23,12 @@ Table of Contents .. toctree:: :caption: Tutorials + Adafruit LTR390 UV Light Sensor Breakout Learning Guide .. toctree:: :caption: Related Products - Adafruit LTR390 Breakout + Adafruit LTR390 UV Light Sensor Breakout .. toctree:: :caption: Other Links diff --git a/examples/ltr390_alert_test.py b/examples/ltr390_alert_test.py index a2a9362..db33f16 100644 --- a/examples/ltr390_alert_test.py +++ b/examples/ltr390_alert_test.py @@ -4,12 +4,11 @@ # pylint:disable=unused-import import time import board -import busio from adafruit_ltr390 import LTR390, UV, ALS THRESHOLD_VALUE = 100 -i2c = busio.I2C(board.SCL, board.SDA) +i2c = board.I2C() ltr = LTR390(i2c) ltr.high_threshold = THRESHOLD_VALUE diff --git a/examples/ltr390_configuration_example.py b/examples/ltr390_configuration_example.py index 76d19be..c07a494 100644 --- a/examples/ltr390_configuration_example.py +++ b/examples/ltr390_configuration_example.py @@ -5,11 +5,9 @@ import time import board -import busio from adafruit_ltr390 import LTR390, MeasurementDelay, Resolution, Gain -i2c = busio.I2C(board.SCL, board.SDA) - +i2c = board.I2C() ltr = LTR390(i2c) # ltr.resolution = Resolution.RESOLUTION_16BIT diff --git a/examples/ltr390_simpletest.py b/examples/ltr390_simpletest.py index f71aae6..2efcfbe 100644 --- a/examples/ltr390_simpletest.py +++ b/examples/ltr390_simpletest.py @@ -3,11 +3,9 @@ # SPDX-License-Identifier: Unlicense import time import board -import busio import adafruit_ltr390 -i2c = busio.I2C(board.SCL, board.SDA) - +i2c = board.I2C() ltr = adafruit_ltr390.LTR390(i2c) while True: