Skip to content

Commit a59583f

Browse files
authored
Merge pull request #5 from sommersoft/new_docs
Improve Ref Docs
2 parents 7a624ec + 9d07c1e commit a59583f

File tree

12 files changed

+161
-49
lines changed

12 files changed

+161
-49
lines changed
File renamed without changes.

.travis.yml

+4-2
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_ht16k33/*.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,undefined-variable,wildcard-import examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ht16k33 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

+58-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Introduction
1+
Introduction
22
============
33

44
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ht16k33/badge/?version=latest
@@ -12,12 +12,21 @@ Introduction
1212
This is a library for using the I²C-based LED matrices with the HT16K33 chip.
1313
It supports both 16x8 and 8x8 matrices, as well as 7- and 14-segment displays.
1414

15-
Note this library is intended for Adafruit CircuitPython's API. For a library
16-
compatible with MicroPython machine API see this library: https://github.com/adafruit/micropython-adafruit-ht16k33
15+
* **Notes**
1716

18-
Installation
17+
#. This library is intended for Adafruit CircuitPython's API. For a library compatible with MicroPython machine API see this `library <https://github.com/adafruit/micropython-adafruit-ht16k33>`_.
18+
19+
#. This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: `CircuitPython Trellis Library <https://github.com/adafruit/Adafruit_CircuitPython_Trellis/releases/latest>`_
20+
21+
Dependencies
1922
=============
20-
This driver depends on many other libraries! Please install it by downloading
23+
This driver depends on:
24+
25+
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
26+
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
27+
28+
Please ensure all dependencies are available on the CircuitPython filesystem.
29+
This is easily achieved by downloading
2130
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2231

2332
Usage Example
@@ -65,10 +74,49 @@ Contributions are welcome! Please read our `Code of Conduct
6574
<https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/blob/master/CODE_OF_CONDUCT.md>`_
6675
before contributing to help this project stay welcoming.
6776

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

adafruit_ht16k33/ht16k33.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
""".. currentmodule:: adafruit_ht16k33"""
23+
"""
24+
`adafruit_ht16k33.ht16k33`
25+
===========================
26+
27+
* Authors: Radomir Dopieralski & Tony DiCola for Adafruit Industries
28+
29+
"""
2430

2531
from adafruit_bus_device import i2c_device
2632
from micropython import const
@@ -51,7 +57,7 @@ def _write_cmd(self, byte):
5157
self.i2c_device.write(self._temp)
5258

5359
def blink_rate(self, rate=None):
54-
"""Get or set the blink rate. Range 0-3."""
60+
"""The blink rate. Range 0-3."""
5561
if rate is None:
5662
return self._blink_rate
5763
rate = rate & 0x03
@@ -61,7 +67,7 @@ def blink_rate(self, rate=None):
6167
return None
6268

6369
def brightness(self, brightness):
64-
"""Get or set the brightness. Range 0-15."""
70+
"""The brightness. Range 0-15."""
6571
if brightness is None:
6672
return self._brightness
6773
brightness = brightness & 0x0F

adafruit_ht16k33/index.rst

-21
This file was deleted.

adafruit_ht16k33/matrix.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
"""Matrix Displays
24-
****************
23+
"""
24+
Matrix Displays
25+
================
2526
26-
.. currentmodule:: adafruit_ht16k33.matrix"""
27+
"""
2728

2829
from adafruit_ht16k33.ht16k33 import HT16K33
2930

adafruit_ht16k33/segments.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23-
"""Segment Displays
24-
****************
25-
26-
.. currentmodule:: adafruit_ht16k33.segments"""
23+
"""
24+
Segment Displays
25+
=================
26+
"""
2727

2828
from adafruit_ht16k33.ht16k33 import HT16K33
2929

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

docs/api.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
.. If you created a package, create one automodule per module in the package.
3+
4+
.. automodule:: adafruit_ht16k33.ht16k33
5+
:members:
6+
7+
.. automodule:: adafruit_ht16k33.matrix
8+
:members:
9+
10+
.. automodule:: adafruit_ht16k33.segments
11+
:members:

conf.py renamed to docs/conf.py

+12-6
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

@@ -23,16 +23,13 @@
2323
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
2424
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
2525

26-
# Libraries we depend on but don't need for generating docs.
27-
autodoc_mock_imports = []
28-
2926
# Add any paths that contain templates here, relative to this directory.
3027
templates_path = ['_templates']
3128

3229
source_suffix = '.rst'
3330

3431
# The master toctree document.
35-
master_doc = 'README'
32+
master_doc = 'index'
3633

3734
# General information about the project.
3835
project = u'Adafruit HT16K33 Library'
@@ -58,7 +55,7 @@
5855
# List of patterns, relative to source directory, that match files and
5956
# directories to ignore when looking for source files.
6057
# This patterns also effect to html_static_path and html_extra_path
61-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
58+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
6259

6360
# The reST default role (used for this markup: `text`) to use for all
6461
# documents.
@@ -75,6 +72,9 @@
7572
# If true, `todo` and `todoList` produce output, else they produce nothing.
7673
todo_include_todos = False
7774

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

7979
# -- Options for HTML output ----------------------------------------------
8080

@@ -99,6 +99,12 @@
9999
# so a file named "default.css" will overwrite the builtin "default.css".
100100
html_static_path = ['_static']
101101

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+
102108
# Output file base name for HTML help builder.
103109
htmlhelp_basename = 'AdafruitHT16K33Librarydoc'
104110

docs/examples.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/matrix.py
7+
:caption: examples/matrix.py
8+
:linenos:
9+
10+
.. literalinclude:: ../examples/segments.py
11+
:caption: examples/segments.py
12+
:linenos:

docs/index.rst

+47
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 HT16K33 Products <https://www.adafruit.com/?q=ht16k33>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/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`

0 commit comments

Comments
 (0)