Skip to content

Commit fbb8b08

Browse files
Merge pull request #22 from jposada202020/improving_docs
improving_docs
2 parents 22cff6d + 3fec337 commit fbb8b08

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ This driver depends on:
2323
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
2424
* `Adafruit OneWire <https://github.com/adafruit/Adafruit_CircuitPython_OneWire>`_
2525

26-
**Note:** This library depends on the OneWire library and will **not** work on the Raspberry Pi
27-
2826
Please ensure all dependencies are available on the CircuitPython filesystem.
2927
This is easily achieved by downloading
3028
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
@@ -37,6 +35,7 @@ Usage Example
3735
import board
3836
from adafruit_onewire.bus import OneWireBus
3937
from adafruit_ds18x20 import DS18X20
38+
4039
ow_bus = OneWireBus(board.D2)
4140
ds18 = DS18X20(ow_bus, ow_bus.scan()[0])
4241
ds18.temperature

adafruit_ds18x20.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
Driver for Dallas 1-Wire temperature sensor.
1010
1111
* Author(s): Carter Nelson
12+
13+
**Software and Dependencies:**
14+
15+
* Adafruit CircuitPython firmware for the supported boards:
16+
https://circuitpython.org/downloads
17+
1218
"""
1319

1420
__version__ = "0.0.0-auto.0"
@@ -28,7 +34,36 @@
2834

2935

3036
class DS18X20:
31-
"""Class which provides interface to DS18X20 temperature sensor."""
37+
"""Class which provides interface to DS18X20 temperature sensor
38+
:param bus: The bus the DS18X20 is connected to
39+
:param int address: The device address.
40+
41+
**Quickstart: Importing and using the device**
42+
43+
Here is an example of using the :class:`DS18X20` class.
44+
First you will need to import the libraries to use the sensor
45+
46+
.. code-block:: python
47+
48+
import board
49+
from adafruit_onewire.bus import OneWireBus
50+
from adafruit_ds18x20 import DS18X20
51+
52+
Once this is done you can define your :class:`adafruit_onewire.bus.OneWireBus`
53+
object and define your sensor object
54+
55+
.. code-block:: python
56+
57+
ow_bus = OneWireBus(board.D5)
58+
ds18 = DS18X20(ow_bus, ow_bus.scan()[0])
59+
60+
Now you have access to the :attr:`temperature` attribute
61+
62+
.. code-block:: python
63+
64+
temperature = ds18.temperature
65+
66+
"""
3267

3368
def __init__(self, bus, address):
3469
if address.family_code == 0x10 or address.family_code == 0x28:

docs/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@
2323
# Uncomment the below if you use native CircuitPython modules such as
2424
# digitalio, micropython and busio. List the modules you use. Without it, the
2525
# autodoc module docs will fail to generate with a warning.
26-
# autodoc_mock_imports = ["adafruit_onewire", "micropython", "time"]
26+
autodoc_mock_imports = [
27+
"adafruit_onewire",
28+
]
2729

2830
intersphinx_mapping = {
2931
"python": ("https://docs.python.org/3.4", None),
3032
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
33+
"adafruit_onewire": (
34+
"https://circuitpython.readthedocs.io/projects/onewire/en/latest/",
35+
None,
36+
),
3137
}
3238

3339
# Add any paths that contain templates here, relative to this directory.

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
DS18B20 Learning Guide <https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-circuitpython>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

0 commit comments

Comments
 (0)