Skip to content

Commit cb814f4

Browse files
authored
Merge pull request #30 from jposada202020/improving_docs
improving_docs
2 parents ae9447c + f93bba7 commit cb814f4

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

adafruit_max31865.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
2828
**Software and Dependencies:**
2929
30-
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
31-
https://github.com/adafruit/circuitpython/releases
30+
* Adafruit CircuitPython firmware for the supported boards:
31+
https://circuitpython.org/downloads
32+
3233
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3334
"""
3435
import math
@@ -70,7 +71,44 @@
7071

7172

7273
class MAX31865:
73-
"""Driver for the MAX31865 thermocouple amplifier."""
74+
"""Driver for the MAX31865 thermocouple amplifier.
75+
76+
:param ~busio.SPI spi: SPI device
77+
:param ~digitalio.DigitalInOut cs: Chip Select
78+
:param int rtd_nominal: RTD nominal value. Defaults to :const:`100`
79+
:param int ref_resistor: Reference resistance. Defaults to :const:`430.0`
80+
:param int wires: Number of wires. Defaults to :const:`2`
81+
:param int filter_frequency: . Filter frequency. Default to :const:`60`
82+
83+
84+
**Quickstart: Importing and using the MAX31865**
85+
86+
Here is an example of using the :class:`MAX31865` class.
87+
First you will need to import the libraries to use the sensor
88+
89+
.. code-block:: python
90+
91+
import board
92+
from digitalio import DigitalInOut, Direction
93+
import adafruit_max31865
94+
95+
Once this is done you can define your `board.SPI` object and define your sensor object
96+
97+
.. code-block:: python
98+
99+
spi = board.SPI()
100+
cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31865 board.
101+
sensor = adafruit_max31865.MAX31865(spi, cs)
102+
103+
104+
Now you have access to the :attr:`temperature` attribute
105+
106+
.. code-block:: python
107+
108+
temperature = sensor.temperature
109+
110+
111+
"""
74112

75113
# Class-level buffer for reading and writing data with the sensor.
76114
# This reduces memory allocations but means the code is not re-entrant or
@@ -172,7 +210,7 @@ def auto_convert(self, val):
172210

173211
@property
174212
def fault(self):
175-
"""The fault state of the sensor. Use ``clear_faults()`` to clear the
213+
"""The fault state of the sensor. Use :meth:`clear_faults` to clear the
176214
fault state. Returns a 6-tuple of boolean values which indicate if any
177215
faults are present:
178216

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+
Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 Learning Guide <https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

examples/max31865_simpletest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
# Simple demo of the MAX31865 thermocouple amplifier.
55
# Will print the temperature every second.
66
import time
7-
87
import board
9-
import busio
108
import digitalio
11-
129
import adafruit_max31865
1310

1411

15-
# Initialize SPI bus and sensor.
16-
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
12+
# Create sensor object, communicating over the board's default SPI bus
13+
spi = board.SPI()
1714
cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31865 board.
1815
sensor = adafruit_max31865.MAX31865(spi, cs)
1916
# Note you can optionally provide the thermocouple RTD nominal, the reference

0 commit comments

Comments
 (0)