Skip to content

Commit ad92247

Browse files
authored
Merge pull request #5 from sommersoft/new_docs
Improve Ref Docs
2 parents 644a264 + aa4a7e4 commit ad92247

File tree

10 files changed

+147
-22
lines changed

10 files changed

+147
-22
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_max31855.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max31855 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
Introduction
1+
Introduction
22
============
33

44
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-MAX31855/badge/?version=latest
55
:target: https://circuitpython.readthedocs.io/projects/MAX31855/en/latest/
66
:alt: Documentation Status
77

8-
.. image:: https://badges.gitter.im/adafruit/circuitpython.svg
9-
:target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
10-
:alt: Gitter
8+
.. image :: https://img.shields.io/discord/327254708534116352.svg
9+
:target: https://discord.gg/nBQh6qu
10+
:alt: Discord
1111
12+
CircuitPython driver for the `MAX31855 Thermocouple Amplifier Breakout <https://www.adafruit.com/product/269>`_
1213

1314
Dependencies
1415
=============
16+
This driver depends on:
1517

16-
This driver depends on the `Bus Device
17-
<https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_ library.
18-
Please ensure is is also available on the CircuitPython filesystem. This is
19-
easily achieved by downloading `a library and driver bundle
20-
<https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
18+
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
19+
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
2120

21+
Please ensure all dependencies are available on the CircuitPython filesystem.
22+
This is easily achieved by downloading
23+
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2224

23-
Usage Notes
24-
===========
25+
Usage Example
26+
==============
2527

2628
Of course, you must import the library to use it:
2729

@@ -65,11 +67,49 @@ Contributions are welcome! Please read our `Code of Conduct
6567
<https://github.com/adafruit/Adafruit_CircuitPython_MAX21855/blob/master/CODE_OF_CONDUCT.md>`_
6668
before contributing to help this project stay welcoming.
6769

70+
Building locally
71+
================
6872

69-
API Reference
70-
=============
73+
To build this library locally you'll need to install the
74+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
75+
76+
.. code-block:: shell
77+
78+
python3 -m venv .env
79+
source .env/bin/activate
80+
pip install circuitpython-build-tools
81+
82+
Once installed, make sure you are in the virtual environment:
83+
84+
.. code-block:: shell
85+
86+
source .env/bin/activate
87+
88+
Then run the build:
89+
90+
.. code-block:: shell
91+
92+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-max31855 --library_location .
93+
94+
Sphinx documentation
95+
-----------------------
96+
97+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
98+
install dependencies (feel free to reuse the virtual environment from above):
99+
100+
.. code-block:: shell
101+
102+
python3 -m venv .env
103+
source .env/bin/activate
104+
pip install Sphinx sphinx-rtd-theme
105+
106+
Now, once you have the virtual environment activated:
107+
108+
.. code-block:: shell
71109
72-
.. toctree::
73-
:maxdepth: 2
110+
cd docs
111+
sphinx-build -E -W -b html . _build/html
74112
75-
api
113+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
114+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
115+
locally verify it will pass.

adafruit_max31855.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,26 @@
2222

2323
"""
2424
``adafruit_max31855``
25-
=====================
25+
===========================
2626
2727
This is a CircuitPython driver for the Maxim Integrated MAX31855 thermocouple
2828
amplifier module.
2929
30+
* Author(s): Radomir Dopieralski
31+
32+
Implementation Notes
33+
--------------------
34+
35+
**Hardware:**
36+
37+
* Adafruit `MAX31855 Thermocouple Amplifier Breakout
38+
<https://www.adafruit.com/product/269>`_ (Product ID: 269)
39+
40+
**Software and Dependencies:**
41+
42+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
43+
https://github.com/adafruit/circuitpython/releases
44+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3045
"""
3146
try:
3247
import struct

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: 16 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

@@ -15,6 +15,11 @@
1515
'sphinx.ext.viewcode',
1616
]
1717

18+
# Uncomment the below if you use native CircuitPython modules such as
19+
# digitalio, micropython and busio. List the modules you use. Without it, the
20+
# autodoc module docs will fail to generate with a warning.
21+
autodoc_mock_imports = ["adafruit_bus_device"]
22+
1823
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
1924

2025
# Add any paths that contain templates here, relative to this directory.
@@ -23,7 +28,7 @@
2328
source_suffix = '.rst'
2429

2530
# The master toctree document.
26-
master_doc = 'README'
31+
master_doc = 'index'
2732

2833
# General information about the project.
2934
project = u'Adafruit MAX31855 Library'
@@ -49,7 +54,7 @@
4954
# List of patterns, relative to source directory, that match files and
5055
# directories to ignore when looking for source files.
5156
# This patterns also effect to html_static_path and html_extra_path
52-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
57+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5358

5459
# The reST default role (used for this markup: `text`) to use for all
5560
# documents.
@@ -66,6 +71,8 @@
6671
# If true, `todo` and `todoList` produce output, else they produce nothing.
6772
todo_include_todos = False
6873

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

7077
# -- Options for HTML output ----------------------------------------------
7178

@@ -90,6 +97,12 @@
9097
# so a file named "default.css" will overwrite the builtin "default.css".
9198
html_static_path = ['_static']
9299

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

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/max31855_simpletest.py
7+
:caption: examples/max31855_simpletest.py
8+
:linenos:

docs/index.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 Thermocouple Amplifier MAX31855 Breakout <https://www.adafruit.com/product/269>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/releases/latest>
35+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
36+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
37+
Discord Chat <https://adafru.it/discord>
38+
Adafruit Learning System <https://learn.adafruit.com>
39+
Adafruit Blog <https://blog.adafruit.com>
40+
Adafruit Store <https://www.adafruit.com>
41+
42+
Indices and tables
43+
==================
44+
45+
* :ref:`genindex`
46+
* :ref:`modindex`
47+
* :ref:`search`
File renamed without changes.

0 commit comments

Comments
 (0)