From 0d97a16d73532eeb05adf9c2f39c67103ea3dd3d Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 25 Apr 2021 16:52:18 -0400 Subject: [PATCH] improving_docs --- README.rst | 5 ++--- adafruit_vcnl4040.py | 26 +++++++++++--------------- docs/index.rst | 2 ++ examples/vcnl4040_simpletest.py | 3 +-- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index 9d5cc80..34cf2ba 100644 --- a/README.rst +++ b/README.rst @@ -56,14 +56,13 @@ To install in a virtual environment in your current project: Usage Example ============= -.. code-block:: python +.. code-block:: python3 import time import board - import busio import adafruit_vcnl4040 - i2c = busio.I2C(board.SCL, board.SDA) + i2c = board.I2C() sensor = adafruit_vcnl4040.VCNL4040(i2c) while True: diff --git a/adafruit_vcnl4040.py b/adafruit_vcnl4040.py index 00c731d..009d753 100644 --- a/adafruit_vcnl4040.py +++ b/adafruit_vcnl4040.py @@ -21,11 +21,11 @@ **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 +* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice +* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register """ from micropython import const @@ -104,10 +104,9 @@ class VCNL4040: # pylint: disable=too-few-public-methods import time import board - import busio import adafruit_vcnl4040 - i2c = busio.I2C(board.SCL, board.SDA) + i2c = board.I2C() sensor = adafruit_vcnl4040.VCNL4040(i2c) while True: @@ -128,8 +127,8 @@ class VCNL4040: # pylint: disable=too-few-public-methods """Interrupt enable. Interrupt setting are close, away, close and away, or disabled. Options are: PS_INT_DISABLE, PS_INT_CLOSE, PS_INT_AWAY, PS_INT_CLOSE_AWAY.""" proximity_bits = RWBit(0x03, 11, register_width=2) - """Proximity data output setting. ``0`` when proximity sensor output is 12 bits, ``1`` when - proximity sensor output is 16 bits.""" + """Proximity data output setting. :const:`0` when proximity sensor output is 12 bits, + :const:`1` when proximity sensor output is 16 bits.""" # PS_THDL_LM - PS low interrupt threshold setting proximity_low_threshold = UnaryStruct(0x06, " .. toctree:: :caption: Related Products + Adafruit VCNL4040 Proximity and Lux Sensor .. toctree:: :caption: Other Links diff --git a/examples/vcnl4040_simpletest.py b/examples/vcnl4040_simpletest.py index 9bb95e8..373003b 100644 --- a/examples/vcnl4040_simpletest.py +++ b/examples/vcnl4040_simpletest.py @@ -3,10 +3,9 @@ import time import board -import busio import adafruit_vcnl4040 -i2c = busio.I2C(board.SCL, board.SDA) +i2c = board.I2C() sensor = adafruit_vcnl4040.VCNL4040(i2c) while True: