Skip to content

Commit 860b035

Browse files
author
brentru
committed
Fix autodoc
1 parent faa115b commit 860b035

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

README.rst

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,38 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
2323
This is easily achieved by downloading
2424
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2525

26-
Usage Example
26+
Usage Notes
2727
=============
2828

29-
TODO
29+
See `the guide <https://learn.adafruit.com/adafruit-sgp30-gas-tvoc-eco2-mox-sensor/circuitpython-wiring-test>`_
30+
for wiring and installation instructions.
31+
32+
First, import the library:
33+
34+
.. code:: python
35+
import busio
36+
import adafruit_sgp30
37+
38+
Next, initialize the I2C bus object:
39+
40+
.. code:: python
41+
from board import *
42+
i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=100000)
43+
44+
Since we have the I2C bus object, we can now use it to instantiate the SGP30 object:
45+
46+
.. code:: python
47+
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c_bus)
48+
49+
Reading from the Sensor
50+
--------------
51+
52+
To read from the sensor:
53+
54+
.. code:: python
55+
co2eq, tvoc = sgp30.iaq_measure()
56+
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
57+
3058
3159
API Reference
3260
=============

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Uncomment the below if you use native CircuitPython modules such as
1919
# digitalio, micropython and busio. List the modules you use. Without it, the
2020
# autodoc module docs will fail to generate with a warning.
21-
# autodoc_mock_imports = ["digitalio", "busio"]
21+
autodoc_mock_imports = ["adafruit_bus_device", "micropython"]
2222

2323
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
2424

0 commit comments

Comments
 (0)