Skip to content

Commit dd6811e

Browse files
authored
Merge pull request #9 from sommersoft/new_docs
Improve Ref Docs
2 parents e5f5164 + cf4191f commit dd6811e

11 files changed

+174
-61
lines changed
File renamed without changes.

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,16 +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
2121
overwrite: true
2222
on:
2323
tags: true
2424

2525
install:
26-
- pip install pylint circuitpython-build-tools
26+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2727

2828
script:
2929
- pylint adafruit_is31fl3731.py
3030
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3131
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-is31fl3731 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

+47-8
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Introduction
55
:target: https://circuitpython.readthedocs.io/projects/is31fl3731/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
1212
CircuitPython driver for the IS31FL3731 charlieplex IC.
1313

@@ -64,10 +64,49 @@ Contributions are welcome! Please read our `Code of Conduct
6464
<https://github.com/adafruit/Adafruit_CircuitPython_is31fl3731/blob/master/CODE_OF_CONDUCT.md>`_
6565
before contributing to help this project stay welcoming.
6666

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

adafruit_is31fl3731.py

+54-30
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,24 @@
2626
2727
CircuitPython driver for the IS31FL3731 charlieplex IC.
2828
29-
This driver supports the following hardware:
29+
30+
* Author(s): Tony DiCola
31+
32+
Implementation Notes
33+
--------------------
34+
35+
**Hardware:**
3036
3137
* `Adafruit 16x9 Charlieplexed PWM LED Matrix Driver - IS31FL3731
32-
<https://www.adafruit.com/product/2946>`_
38+
<https://www.adafruit.com/product/2946>`_
39+
3340
* `Adafruit 15x7 CharliePlex LED Matrix Display FeatherWings
34-
<https://www.adafruit.com/product/2965>`_
41+
<https://www.adafruit.com/product/2965>`_
3542
36-
* Author(s): Tony DiCola
43+
**Software and Dependencies:**
44+
45+
* Adafruit CircuitPython firmware (2.2.0+) for the ESP8622 and M0-based boards:
46+
https://github.com/adafruit/circuitpython/releases
3747
"""
3848

3949
# imports
@@ -68,9 +78,11 @@
6878
_COLOR_OFFSET = const(0x24)
6979

7080
class Matrix:
71-
"""The Matrix class support the main function for driving the 16x9 matrix Display
72-
:param ~adafruit_bus_device.i2c_device i2c_device: the connected i2c bus i2c_device
73-
:param address: the device address; defaults to 0x74
81+
"""
82+
The Matrix class support the main function for driving the 16x9 matrix Display
83+
84+
:param ~adafruit_bus_device.i2c_device i2c_device: the connected i2c bus i2c_device
85+
:param address: the device address; defaults to 0x74
7486
"""
7587
width = 16
7688
height = 9
@@ -144,16 +156,20 @@ def reset(self):
144156
self.sleep(False)
145157

146158
def sleep(self, value):
147-
"""Set the Software Shutdown Register bit
148-
:param value: True to set software shutdown bit; False unset
159+
"""
160+
Set the Software Shutdown Register bit
161+
162+
:param value: True to set software shutdown bit; False unset
149163
"""
150164
return self._register(_CONFIG_BANK, _SHUTDOWN_REGISTER, not value)
151165

152166
def autoplay(self, delay=0, loops=0, frames=0):
153-
"""Start autoplay
154-
:param delay: in ms
155-
:param loops: number of loops - 0->7
156-
:param frames: number of frames: 0->7
167+
"""
168+
Start autoplay
169+
170+
:param delay: in ms
171+
:param loops: number of loops - 0->7
172+
:param frames: number of frames: 0->7
157173
"""
158174
if delay == 0:
159175
self._mode(_PICTURE_MODE)
@@ -171,12 +187,14 @@ def autoplay(self, delay=0, loops=0, frames=0):
171187

172188

173189
def fade(self, fade_in=None, fade_out=None, pause=0):
174-
"""Start and stop the fade feature. If both fade_in and fade_out are None (the
190+
"""
191+
Start and stop the fade feature. If both fade_in and fade_out are None (the
175192
default), the breath feature is used for fading. if fade_in is None, then
176193
fade_in = fade_out. If fade_out is None, then fade_out = fade_in
177-
:param fade_in: positive number; 0->100
178-
:param fade-out: positive number; 0->100
179-
:param pause: breath register 2 pause value
194+
195+
:param fade_in: positive number; 0->100
196+
:param fade-out: positive number; 0->100
197+
:param pause: breath register 2 pause value
180198
"""
181199
if fade_in is None and fade_out is None:
182200
self._register(_CONFIG_BANK, _BREATH2_REGISTER, 0)
@@ -197,9 +215,11 @@ def fade(self, fade_in=None, fade_out=None, pause=0):
197215
self._register(_CONFIG_BANK, _BREATH2_REGISTER, 1 << 4 | pause)
198216

199217
def frame(self, frame=None, show=True):
200-
"""Set the current frame
201-
:param frame: frame number; 0-7 or None. If None function returns current frame
202-
:param show: True to show the frame; False to don't force a show
218+
"""
219+
Set the current frame
220+
221+
:param frame: frame number; 0-7 or None. If None function returns current frame
222+
:param show: True to show the frame; False to not show.
203223
"""
204224
if frame is None:
205225
return self._frame
@@ -246,10 +266,12 @@ def blink(self, rate=None):
246266
return None
247267

248268
def fill(self, color=None, blink=None, frame=None):
249-
"""Fill the display with a brightness level
250-
:param color: brightness 0->255
251-
:param blink: True if blinking is required
252-
:param frame: which frame to fill 0->7
269+
"""
270+
Fill the display with a brightness level
271+
272+
:param color: brightness 0->255
273+
:param blink: True if blinking is required
274+
:param frame: which frame to fill 0->7
253275
"""
254276
if frame is None:
255277
frame = self._frame
@@ -279,12 +301,14 @@ def pixel_addr(x, y):
279301

280302
#pylint: disable-msg=too-many-arguments
281303
def pixel(self, x, y, color=None, blink=None, frame=None):
282-
"""Set blink or brightness for an x,y pixel
283-
:param x: horizontal pixel position
284-
:param y: vertical pixel position
285-
:param color: brightness value 0->255
286-
:param blink: True to blink
287-
:param frame: the frame to set the pixel
304+
"""
305+
Blink or brightness for x-, y-pixel
306+
307+
:param x: horizontal pixel position
308+
:param y: vertical pixel position
309+
:param color: brightness value 0->255
310+
:param blink: True to blink
311+
:param frame: the frame to set the pixel
288312
"""
289313
if not 0 <= x <= self.width:
290314
return None

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

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

@@ -28,7 +28,7 @@
2828
source_suffix = '.rst'
2929

3030
# The master toctree document.
31-
master_doc = 'README'
31+
master_doc = 'index'
3232

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

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

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

7578
# -- Options for HTML output ----------------------------------------------
7679

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

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

docs/examples.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/is31fl3731_simpletest.py
7+
:caption: examples/is31fl3731_simpletest.py
8+
:linenos:
9+
10+
11+
For other examples, see the GitHub `examples folder <https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731/tree/master/examples>`_.

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+
Charlieplex Devices <https://www.adafruit.com/?q=charlieplex>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731/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.

setup.py

-18
This file was deleted.

0 commit comments

Comments
 (0)