Skip to content

improving_docs #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
40 changes: 36 additions & 4 deletions adafruit_ltr390.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

**Hardware:**

* Adafruit LTR390 Breakout <https://www.adafruit.com/product/38XX>`_
* Adafruit `Adafruit LTR390 UV Light Sensor
<https://www.adafruit.com/product/4831>`_ (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
"""
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

.. automodule:: adafruit_ltr390
:members:
:exclude-members: UnalignedStruct, CV
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ Table of Contents
.. toctree::
:caption: Tutorials

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

.. toctree::
:caption: Related Products

Adafruit LTR390 Breakout <https://www.adafruit.com/product/38XX>
Adafruit LTR390 UV Light Sensor Breakout <https://www.adafruit.com/product/4831>

.. toctree::
:caption: Other Links
Expand Down
3 changes: 1 addition & 2 deletions examples/ltr390_alert_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/ltr390_configuration_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/ltr390_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down