Skip to content

improving_docs #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions adafruit_max31865.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 Learning Guide <https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier>

.. toctree::
:caption: Related Products

Expand Down
7 changes: 2 additions & 5 deletions examples/max31865_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down