Skip to content

Commit 4194599

Browse files
authored
Merge pull request #12 from jposada202020/improving_docs
improving_docs
2 parents 588dc15 + 9080e7d commit 4194599

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
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_tlv493d
6463
65-
i2c = busio.I2C(board.SCL, board.SDA)
64+
i2c = board.I2C() # uses board.SCL and board.SDA
6665
tlv = adafruit_tlv493d.TLV493D(i2c)
6766
6867
while True:

adafruit_tlv493d.py

+31-6
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
1616
**Hardware:**
1717
18-
19-
Adafruit's TLV493D Breakout https://adafruit.com/products
18+
* Adafruit `TLV493D Triple-Axis Magnetometer
19+
<https://www.adafruit.com/product/4366>`_
2020
2121
2222
**Software and Dependencies:**
2323
2424
* Adafruit CircuitPython firmware for the supported boards:
25-
https://github.com/adafruit/circuitpython/releases
25+
https://circuitpython.org/downloads
2626
2727
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+
2829
"""
2930

3031
import struct
@@ -40,9 +41,33 @@
4041
class TLV493D:
4142
"""Driver for the TLV493D 3-axis Magnetometer.
4243
43-
:param busio.I2C i2c_bus: The I2C bus the TLV493D is connected to.
44-
:param int address: The I2C address of the TLV493D. Defaults to 0x5E.
45-
:param int addr_reg: Initial value of the I2C address register. Defaults to 0.
44+
:param ~busio.I2C i2c_bus: The I2C bus the device is connected to
45+
:param int address: The I2C device address. Defaults to :const:`0x5E`
46+
:param int addr_reg: Initial value of the I2C address register. Defaults to :const:`0`.
47+
48+
49+
**Quickstart: Importing and using the device**
50+
51+
Here is an example of using the :class:`TLV493D` class.
52+
First you will need to import the libraries to use the sensor
53+
54+
.. code-block:: python
55+
56+
import board
57+
import adafruit_tlv493d
58+
59+
Once this is done you can define your `board.I2C` object and define your sensor object
60+
61+
.. code-block:: python
62+
63+
i2c = board.I2C() # uses board.SCL and board.SDA
64+
tlv = adafruit_tlv493d.TLV493D(i2c)
65+
66+
Now you have access to the :attr:`magnetic` attribute
67+
68+
.. code-block:: python
69+
70+
acc_x, acc_y, acc_z = tlv.magnetic
4671
4772
"""
4873

docs/index.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit TLV493D Triple-Axis Magnetometer Learning Guide <https://learn.adafruit.com/adafruit-tlv493-triple-axis-magnetometer>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

29-
Adafruit TLV493D Breakout <https://adafruit.com/products>
31+
Adafruit TLV493D Triple-Axis Magnetometer <https://www.adafruit.com/product/4366>
3032

3133
.. toctree::
3234
:caption: Other Links

examples/tlv493d_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_tlv493d
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C() # uses board.SCL and board.SDA
109
tlv = adafruit_tlv493d.TLV493D(i2c)
1110

1211
while True:

0 commit comments

Comments
 (0)