Skip to content

Commit d3a85d2

Browse files
authored
Merge pull request #3 from sommersoft/new_docs
Improve Ref Docs
2 parents 272e18f + 26d92fa commit d3a85d2

10 files changed

+150
-20
lines changed
File renamed without changes.

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ deploy:
1616
provider: releases
1717
api_key: $GITHUB_TOKEN
1818
file_glob: true
19-
file: bundles/*
19+
file: $TRAVIS_BUILD_DIR/bundles/*
2020
skip_cleanup: true
21+
overwrite: true
2122
on:
2223
tags: true
2324

2425
install:
25-
- pip install pylint circuitpython-build-tools
26+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2627

2728
script:
2829
- pylint adafruit_max31865.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max31865 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This is easily achieved by downloading
2626
Usage Example
2727
=============
2828

29-
See examples/simpletest.py for a demo of the usage.
29+
See examples/max31865_simpletest.py for a demo of the usage.
3030

3131
Contributing
3232
============
@@ -35,10 +35,49 @@ Contributions are welcome! Please read our `Code of Conduct
3535
<https://github.com/adafruit/Adafruit_CircuitPython_max31865/blob/master/CODE_OF_CONDUCT.md>`_
3636
before contributing to help this project stay welcoming.
3737

38-
API Reference
39-
=============
38+
Building locally
39+
================
40+
41+
To build this library locally you'll need to install the
42+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
43+
44+
.. code-block:: shell
45+
46+
python3 -m venv .env
47+
source .env/bin/activate
48+
pip install circuitpython-build-tools
49+
50+
Once installed, make sure you are in the virtual environment:
51+
52+
.. code-block:: shell
53+
54+
source .env/bin/activate
55+
56+
Then run the build:
57+
58+
.. code-block:: shell
59+
60+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max31865 --library_location .
61+
62+
Sphinx documentation
63+
-----------------------
64+
65+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
66+
install dependencies (feel free to reuse the virtual environment from above):
67+
68+
.. code-block:: shell
69+
70+
python3 -m venv .env
71+
source .env/bin/activate
72+
pip install Sphinx sphinx-rtd-theme
73+
74+
Now, once you have the virtual environment activated:
75+
76+
.. code-block:: shell
4077
41-
.. toctree::
42-
:maxdepth: 2
78+
cd docs
79+
sphinx-build -E -W -b html . _build/html
4380
44-
api
81+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
82+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
83+
locally verify it will pass.

adafruit_max31865.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
examples/simpletest.py for an example of the usage.
2828
2929
* Author(s): Tony DiCola
30+
31+
Implementation Notes
32+
--------------------
33+
34+
**Hardware:**
35+
36+
* Adafruit `Universal Thermocouple Amplifier MAX31856 Breakout
37+
<https://www.adafruit.com/product/3263>`_ (Product ID: 3263)
38+
39+
* Adafruit `PT100 RTD Temperature Sensor Amplifier - MAX31865
40+
<https://www.adafruit.com/product/3328>`_ (Product ID: 3328)
41+
42+
* Adafruit `PT1000 RTD Temperature Sensor Amplifier - MAX31865
43+
<https://www.adafruit.com/product/3648>`_ (Product ID: 3648)
44+
45+
**Software and Dependencies:**
46+
47+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
48+
https://github.com/adafruit/circuitpython/releases
49+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3050
"""
3151
import math
3252
import time
@@ -118,7 +138,7 @@ def _write_u8(self, address, val):
118138

119139
@property
120140
def bias(self):
121-
"""Get and set the boolean state of the sensor's bias (True/False)."""
141+
"""The state of the sensor's bias (True/False)."""
122142
return bool(self._read_u8(_MAX31865_CONFIG_REG) & _MAX31865_CONFIG_BIAS)
123143

124144
@bias.setter
@@ -132,7 +152,7 @@ def bias(self, val):
132152

133153
@property
134154
def auto_convert(self):
135-
"""Get and set the boolean state of the sensor's automatic conversion
155+
"""The state of the sensor's automatic conversion
136156
mode (True/False).
137157
"""
138158
return bool(self._read_u8(_MAX31865_CONFIG_REG) & _MAX31865_CONFIG_MODEAUTO)
@@ -148,15 +168,16 @@ def auto_convert(self, val):
148168

149169
@property
150170
def fault(self):
151-
"""Get the fault state of the sensor. Use `clear_faults` to clear the
171+
"""The fault state of the sensor. Use ``clear_faults()`` to clear the
152172
fault state. Returns a 6-tuple of boolean values which indicate if any
153173
faults are present:
154-
- HIGHTHRESH
155-
- LOWTHRESH
156-
- REFINLOW
157-
- REFINHIGH
158-
- RTDINLOW
159-
- OVUV
174+
175+
- HIGHTHRESH
176+
- LOWTHRESH
177+
- REFINLOW
178+
- REFINHIGH
179+
- RTDINLOW
180+
- OVUV
160181
"""
161182
faults = self._read_u8(_MAX31865_FAULTSTAT_REG)
162183
#pylint: disable=bad-whitespace

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

api.rst renamed to docs/api.rst

File renamed without changes.

conf.py renamed to docs/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44
import sys
5-
sys.path.insert(0, os.path.abspath('.'))
5+
sys.path.insert(0, os.path.abspath('..'))
66

77
# -- General configuration ------------------------------------------------
88

@@ -29,7 +29,7 @@
2929
source_suffix = '.rst'
3030

3131
# The master toctree document.
32-
master_doc = 'README'
32+
master_doc = 'index'
3333

3434
# General information about the project.
3535
project = u'Adafruit MAX31865 Library'
@@ -55,7 +55,7 @@
5555
# List of patterns, relative to source directory, that match files and
5656
# directories to ignore when looking for source files.
5757
# This patterns also effect to html_static_path and html_extra_path
58-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
58+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5959

6060
# The reST default role (used for this markup: `text`) to use for all
6161
# documents.
@@ -72,6 +72,9 @@
7272
# If true, `todo` and `todoList` produce output, else they produce nothing.
7373
todo_include_todos = False
7474

75+
# If this is True, todo emits a warning for each TODO entries. The default is False.
76+
todo_emit_warnings = True
77+
7578

7679
# -- Options for HTML output ----------------------------------------------
7780

@@ -96,6 +99,12 @@
9699
# so a file named "default.css" will overwrite the builtin "default.css".
97100
html_static_path = ['_static']
98101

102+
# The name of an image file (relative to this directory) to use as a favicon of
103+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
104+
# pixels large.
105+
#
106+
html_favicon = '_static/favicon.ico'
107+
99108
# Output file base name for HTML help builder.
100109
htmlhelp_basename = 'AdafruitMAX31865Librarydoc'
101110

docs/examples.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/max31865_simpletest.py
7+
:caption: examples/max31865_simpletest.py
8+
:linenos:

docs/index.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.. include:: ../README.rst
2+
3+
Table of Contents
4+
=================
5+
6+
.. toctree::
7+
:maxdepth: 4
8+
:hidden:
9+
10+
self
11+
12+
.. toctree::
13+
:caption: Examples
14+
15+
examples
16+
17+
.. toctree::
18+
:caption: API Reference
19+
:maxdepth: 3
20+
21+
api
22+
23+
.. toctree::
24+
:caption: Tutorials
25+
26+
.. toctree::
27+
:caption: Related Products
28+
29+
Adafruit Universal Thermocouple Amplifier MAX31856 Breakout <https://www.adafruit.com/product/3263>
30+
31+
Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 <https://www.adafruit.com/product/3328>
32+
33+
Adafruit PT1000 RTD Temperature Sensor Amplifier - MAX31865 <https://www.adafruit.com/product/3648>
34+
35+
.. toctree::
36+
:caption: Other Links
37+
38+
Download <https://github.com/adafruit/Adafruit_CircuitPython_MAX31865/releases/latest>
39+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
40+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
41+
Discord Chat <https://adafru.it/discord>
42+
Adafruit Learning System <https://learn.adafruit.com>
43+
Adafruit Blog <https://blog.adafruit.com>
44+
Adafruit Store <https://www.adafruit.com>
45+
46+
Indices and tables
47+
==================
48+
49+
* :ref:`genindex`
50+
* :ref:`modindex`
51+
* :ref:`search`
File renamed without changes.

0 commit comments

Comments
 (0)