From f93bba7a77b392db9777a095df0829380ec56ea7 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 25 Apr 2021 11:06:29 -0400 Subject: [PATCH] improving_docs --- adafruit_max31865.py | 46 ++++++++++++++++++++++++++++++--- docs/index.rst | 2 ++ examples/max31865_simpletest.py | 7 ++--- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/adafruit_max31865.py b/adafruit_max31865.py index 1b73c17..ae26ef6 100644 --- a/adafruit_max31865.py +++ b/adafruit_max31865.py @@ -27,8 +27,9 @@ **Software and Dependencies:** -* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: - https://github.com/adafruit/circuitpython/releases +* Adafruit CircuitPython firmware for the supported boards: + https://circuitpython.org/downloads + * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice """ import math @@ -70,7 +71,44 @@ class MAX31865: - """Driver for the MAX31865 thermocouple amplifier.""" + """Driver for the MAX31865 thermocouple amplifier. + + :param ~busio.SPI spi: SPI device + :param ~digitalio.DigitalInOut cs: Chip Select + :param int rtd_nominal: RTD nominal value. Defaults to :const:`100` + :param int ref_resistor: Reference resistance. Defaults to :const:`430.0` + :param int wires: Number of wires. Defaults to :const:`2` + :param int filter_frequency: . Filter frequency. Default to :const:`60` + + + **Quickstart: Importing and using the MAX31865** + + Here is an example of using the :class:`MAX31865` class. + First you will need to import the libraries to use the sensor + + .. code-block:: python + + import board + from digitalio import DigitalInOut, Direction + import adafruit_max31865 + + Once this is done you can define your `board.SPI` object and define your sensor object + + .. code-block:: python + + spi = board.SPI() + cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31865 board. + sensor = adafruit_max31865.MAX31865(spi, cs) + + + Now you have access to the :attr:`temperature` attribute + + .. code-block:: python + + temperature = sensor.temperature + + + """ # Class-level buffer for reading and writing data with the sensor. # This reduces memory allocations but means the code is not re-entrant or @@ -172,7 +210,7 @@ def auto_convert(self, val): @property def fault(self): - """The fault state of the sensor. Use ``clear_faults()`` to clear the + """The fault state of the sensor. Use :meth:`clear_faults` to clear the fault state. Returns a 6-tuple of boolean values which indicate if any faults are present: diff --git a/docs/index.rst b/docs/index.rst index ac74c17..890f6df 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,8 @@ Table of Contents .. toctree:: :caption: Tutorials + Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 Learning Guide + .. toctree:: :caption: Related Products diff --git a/examples/max31865_simpletest.py b/examples/max31865_simpletest.py index 39eaf85..c56fc5c 100644 --- a/examples/max31865_simpletest.py +++ b/examples/max31865_simpletest.py @@ -4,16 +4,13 @@ # Simple demo of the MAX31865 thermocouple amplifier. # Will print the temperature every second. import time - import board -import busio import digitalio - import adafruit_max31865 -# Initialize SPI bus and sensor. -spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) +# Create sensor object, communicating over the board's default SPI bus +spi = board.SPI() cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31865 board. sensor = adafruit_max31865.MAX31865(spi, cs) # Note you can optionally provide the thermocouple RTD nominal, the reference