Skip to content

Commit 8429386

Browse files
authored
Merge pull request #3 from sommersoft/new_docs
Improve Ref Docs
2 parents 3a67501 + 682a2f6 commit 8429386

File tree

11 files changed

+122
-24
lines changed

11 files changed

+122
-24
lines changed
File renamed without changes.

.travis.yml

Lines changed: 3 additions & 2 deletions
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_fancyled/*.py
3030
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3131
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-fancyled --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Introduction
1414
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_FancyLED
1515
:alt: Build Status
1616

17-
TODO
17+
FancyLED is a CircuitPython library to assist in creating buttery smooth LED animation. It's loosely inspired by the FastLED library for Arduino, and in fact we have a "helper" library using similar function names to assist with porting of existing Arduino FastLED projects to CircuitPython.
1818

1919
Dependencies
2020
=============
@@ -29,15 +29,7 @@ This is easily achieved by downloading
2929
Usage Example
3030
=============
3131

32-
TODO
33-
34-
API Reference
35-
=============
36-
37-
.. toctree::
38-
:maxdepth: 2
39-
40-
api
32+
See the examples in the examples/ folder.
4133

4234
Contributing
4335
============
@@ -69,3 +61,26 @@ Then run the build:
6961
.. code-block:: shell
7062
7163
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-fancyled --library_location .
64+
65+
Sphinx documentation
66+
-----------------------
67+
68+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
69+
install dependencies (feel free to reuse the virtual environment from above):
70+
71+
.. code-block:: shell
72+
73+
python3 -m venv .env
74+
source .env/bin/activate
75+
pip install Sphinx sphinx-rtd-theme
76+
77+
Now, once you have the virtual environment activated:
78+
79+
.. code-block:: shell
80+
81+
cd docs
82+
sphinx-build -E -W -b html . _build/html
83+
84+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
85+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
86+
locally verify it will pass.

adafruit_fancyled/adafruit_fancyled.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_fancyled`
23+
`adafruit_fancyled.adafruit_fancyled`
2424
====================================================
2525
26-
TODO(description)
26+
FancyLED is a CircuitPython library to assist in creating buttery smooth LED animation.
27+
It's loosely inspired by the FastLED library for Arduino, and in fact we have a "helper"
28+
library using similar function names to assist with porting of existing Arduino FastLED
29+
projects to CircuitPython.
2730
2831
* Author(s): PaintYourDragon
2932
"""

adafruit_fancyled/fastled_helpers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_fancyled`
23+
`adafruit_fancyled.fastled_helpers`
2424
====================================================
2525
26-
TODO(description)
26+
CircuitPython "helper" library based on the Arduino FastLED library.
27+
Uses similar function names to assist with porting of existing Arduino FastLED
28+
projects to CircuitPython.
2729
2830
* Author(s): PaintYourDragon
2931
"""
@@ -54,6 +56,7 @@ def applyGamma_video(n, g_r=GFACTOR, g_g=None, g_b=None, inplace=False):
5456
2. A single CRGB, CHSV or packed integer type and optional gamma
5557
factor or separate R, G, B gamma values.
5658
3. A list of CRGB, CHSV or packed integer types (and optional gamma(s)).
59+
5760
In the tuple/list cases, the 'inplace' flag determines whether
5861
a new tuple/list is calculated and returned, or the existing
5962
value is modified in-place. By default this is 'False'.
@@ -64,6 +67,7 @@ def applyGamma_video(n, g_r=GFACTOR, g_g=None, g_b=None, inplace=False):
6467
1. Single gamma-corrected brightness level (0-255).
6568
2. A gamma-corrected CRGB value (even if input is CHSV or packed).
6669
3. A list of gamma-corrected CRGB values.
70+
6771
In the tuple/list cases, there is NO return value if 'inplace'
6872
is true -- the original values are modified.
6973
"""
@@ -95,6 +99,7 @@ def loadDynamicGradientPalette(src, size):
9599
within the overall resulting palette (whatever its size), and
96100
3 values for R, G and B...and a length for a new palette list
97101
to be allocated.
102+
98103
RETURNS: list of CRGB colors.
99104
"""
100105

@@ -117,6 +122,7 @@ def ColorFromPalette(pal, pos, brightness=255, blend=False):
117122
e.g. pass 32 to retrieve palette index 2, or 40 for an
118123
interpolated value between palette index 2 and 3, optional
119124
brightness (0-255), optional blend flag (True/False)
125+
120126
RETURNS: CRGB color, no gamma correction
121127
"""
122128

api.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/_static/favicon.ico

4.31 KB
Binary file not shown.

docs/api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
.. If you created a package, create one automodule per module in the package.
3+
4+
.. automodule:: adafruit_fancyled.adafruit_fancyled
5+
:members:
6+
7+
.. automodule:: adafruit_fancyled.fastled_helpers
8+
:members:

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

@@ -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 fancyled 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 = 'AdafruitFancyledLibrarydoc'
100109

docs/examples.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Simple test
2+
------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/neopixel_rotate.py
7+
:caption: examples/neopixel_rotate.py
8+
:linenos:
9+
10+
.. literalinclude:: ../examples/cpx_helper_example.py
11+
:caption: examples/cpx_helper_example.py
12+
:linenos:
13+
14+
.. literalinclude:: ../examples/cpx_rotate.py
15+
:caption: examples/cpx_rotate.py
16+
:linenos:

docs/index.rst

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

0 commit comments

Comments
 (0)