Skip to content

Commit 79516d6

Browse files
authored
Merge pull request #5 from sommersoft/new_docs
Improve Ref Docs
2 parents 6d49856 + 4592f4f commit 79516d6

24 files changed

+127
-31
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_featherwing/*.py
3030
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/**/*.py)
3131
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-featherwing --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Introduction
1010
:target: https://discord.gg/nBQh6qu
1111
:alt: Discord
1212
13+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_FeatherWing.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_FeatherWing
15+
:alt: Build Status
16+
1317
This library provides FeatherWing specific classes for those that require a significant amount of
1418
initialization.
1519

@@ -26,14 +30,6 @@ This is easily achieved by downloading
2630
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_ and highly recommended over
2731
installing each one.
2832

29-
API Reference
30-
=============
31-
32-
.. toctree::
33-
:maxdepth: 2
34-
35-
api
36-
3733
Contributing
3834
============
3935

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

adafruit_featherwing/ina219_featherwing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self):
4747
def bus_voltage(self):
4848
"""Bus voltage returns volts.
4949
50-
.. image :: /_static/ina219_featherwing/ina219_featherwing.jpg
50+
.. image :: ../docs/_static/ina219_featherwing/ina219_featherwing.jpg
5151
:alt: INA219 Featherwing
5252
5353
This example prints the bus voltage with the appropriate units.
@@ -70,7 +70,7 @@ def bus_voltage(self):
7070
def shunt_voltage(self):
7171
"""Shunt voltage returns volts.
7272
73-
.. image :: /_static/ina219_featherwing/ina219_featherwing.jpg
73+
.. image :: ../docs/_static/ina219_featherwing/ina219_featherwing.jpg
7474
:alt: INA219 Featherwing
7575
7676
This example prints the shunt voltage with the appropriate units.
@@ -93,7 +93,7 @@ def shunt_voltage(self):
9393
def voltage(self):
9494
"""Voltage, known as load voltage, is bus voltage plus shunt voltage. Returns volts.
9595
96-
.. image :: /_static/ina219_featherwing/ina219_featherwing.jpg
96+
.. image :: ../docs/_static/ina219_featherwing/ina219_featherwing.jpg
9797
:alt: INA219 Featherwing
9898
9999
This example prints the voltage with the appropriate units.
@@ -117,7 +117,7 @@ def voltage(self):
117117
def current(self):
118118
"""Current returns mA.
119119
120-
.. image :: /_static/ina219_featherwing/ina219_featherwing.jpg
120+
.. image :: ../docs/_static/ina219_featherwing/ina219_featherwing.jpg
121121
:alt: INA219 Featherwing
122122
123123
This example prints the current with the appropriate units.

adafruit_featherwing/joy_featherwing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self):
5858
def button_a(self):
5959
"""Joy featherwing button A.
6060
61-
.. image :: /_static/joy_featherwing/joy_featherwing_a.jpg
61+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_a.jpg
6262
:alt: Joy FeatherWing Button A
6363
6464
This example prints when button A is pressed.
@@ -81,7 +81,7 @@ def button_a(self):
8181
def button_b(self):
8282
"""Joy featherwing button B.
8383
84-
.. image :: /_static/joy_featherwing/joy_featherwing_b.jpg
84+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_b.jpg
8585
:alt: Joy FeatherWing Button B
8686
8787
This example prints when button B is pressed.
@@ -104,7 +104,7 @@ def button_b(self):
104104
def button_x(self):
105105
"""Joy featherwing button X.
106106
107-
.. image :: /_static/joy_featherwing/joy_featherwing_x.jpg
107+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_x.jpg
108108
:alt: Joy FeatherWing Button X
109109
110110
This example prints when button X is pressed.
@@ -127,7 +127,7 @@ def button_x(self):
127127
def button_y(self):
128128
"""Joy featherwing button Y.
129129
130-
.. image :: /_static/joy_featherwing/joy_featherwing_y.jpg
130+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_y.jpg
131131
:alt: Joy FeatherWing Button Y
132132
133133
This example prints when button Y is pressed.
@@ -150,7 +150,7 @@ def button_y(self):
150150
def button_select(self):
151151
"""Joy featherwing button SELECT.
152152
153-
.. image :: /_static/joy_featherwing/joy_featherwing_select.jpg
153+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_select.jpg
154154
:alt: Joy FeatherWing Button SELECT
155155
156156
This example prints when button SELECT is pressed.
@@ -178,7 +178,7 @@ def _check_button(self, button):
178178
def joystick_offset(self):
179179
"""Offset used to correctly report (0, 0) when the joystick is centered.
180180
181-
.. image :: /_static/joy_featherwing/joy_featherwing_joystick.jpg
181+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_joystick.jpg
182182
:alt: Joy FeatherWing Joystick
183183
184184
Provide a tuple of (x, y) to set your joystick center to (0, 0).
@@ -220,7 +220,7 @@ def zero_joystick(self):
220220
Note: You must not be touching the joystick at the time of zeroing
221221
for it to be accurate.
222222
223-
.. image :: /_static/joy_featherwing/joy_featherwing_joystick.jpg
223+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_joystick.jpg
224224
:alt: Joy FeatherWing Joystick
225225
226226
This example zeros the joystick, and prints the coordinates of
@@ -252,7 +252,7 @@ def zero_joystick(self):
252252
def joystick(self):
253253
"""Joy FeatherWing joystick.
254254
255-
.. image :: /_static/joy_featherwing/joy_featherwing_joystick.jpg
255+
.. image :: ../docs/_static/joy_featherwing/joy_featherwing_joystick.jpg
256256
:alt: Joy FeatherWing Joystick
257257
258258
This example zeros the joystick, and prints the coordinates of

adafruit_featherwing/motor_featherwing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _motor(self, motor_name, channels, stepper_name):
7070
def motor1(self):
7171
""":py:class:`~adafruit_motor.motor.DCMotor` controls for motor 1.
7272
73-
.. image :: /_static/motor_featherwing/m1.jpg
73+
.. image :: ../docs/_static/motor_featherwing/m1.jpg
7474
:alt: Motor 1 location
7575
7676
This example moves the motor forwards for one fifth of a second at full speed.
@@ -93,7 +93,7 @@ def motor1(self):
9393
def motor2(self):
9494
""":py:class:`~adafruit_motor.motor.DCMotor` controls for motor 2.
9595
96-
.. image :: /_static/motor_featherwing/m2.jpg
96+
.. image :: ../docs/_static/motor_featherwing/m2.jpg
9797
:alt: Motor 2 location
9898
9999
This example moves the motor forwards for one fifth of a second at full speed.
@@ -116,7 +116,7 @@ def motor2(self):
116116
def motor3(self):
117117
""":py:class:`~adafruit_motor.motor.DCMotor` controls for motor 3.
118118
119-
.. image :: /_static/motor_featherwing/m3.jpg
119+
.. image :: ../docs/_static/motor_featherwing/m3.jpg
120120
:alt: Motor 3 location
121121
122122
This example moves the motor forwards for one fifth of a second at full speed.
@@ -139,7 +139,7 @@ def motor3(self):
139139
def motor4(self):
140140
""":py:class:`~adafruit_motor.motor.DCMotor` controls for motor 4.
141141
142-
.. image :: /_static/motor_featherwing/m4.jpg
142+
.. image :: ../docs/_static/motor_featherwing/m4.jpg
143143
:alt: Motor 4 location
144144
145145
This example moves the motor forwards for one fifth of a second at full speed.
@@ -163,7 +163,7 @@ def stepper1(self):
163163
""":py:class:`~adafruit_motor.stepper.StepperMotor` controls for one connected to stepper 1
164164
(also labeled motor 1 and motor 2).
165165
166-
.. image :: /_static/motor_featherwing/stepper1.jpg
166+
.. image :: ../docs/_static/motor_featherwing/stepper1.jpg
167167
:alt: Stepper 1 location
168168
169169
This example moves the stepper motor 100 steps forwards.
@@ -191,7 +191,7 @@ def stepper2(self):
191191
""":py:class:`~adafruit_motor.stepper.StepperMotor` controls for one connected to stepper 2
192192
(also labeled motor 3 and motor 4).
193193
194-
.. image :: /_static/motor_featherwing/stepper2.jpg
194+
.. image :: ../docs/_static/motor_featherwing/stepper2.jpg
195195
:alt: Stepper 2 location
196196
197197
This example moves the stepper motor 100 steps forwards.

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

@@ -34,7 +34,7 @@
3434
source_suffix = '.rst'
3535

3636
# The master toctree document.
37-
master_doc = 'README'
37+
master_doc = 'index'
3838

3939
# General information about the project.
4040
project = u'Adafruit featherwing Library'
@@ -60,7 +60,7 @@
6060
# List of patterns, relative to source directory, that match files and
6161
# directories to ignore when looking for source files.
6262
# This patterns also effect to html_static_path and html_extra_path
63-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
63+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
6464

6565
# The reST default role (used for this markup: `text`) to use for all
6666
# documents.
@@ -77,6 +77,9 @@
7777
# If true, `todo` and `todoList` produce output, else they produce nothing.
7878
todo_include_todos = False
7979

80+
# If this is True, todo emits a warning for each TODO entries. The default is False.
81+
todo_emit_warnings = True
82+
8083

8184
# -- Options for HTML output ----------------------------------------------
8285

@@ -101,6 +104,12 @@
101104
# so a file named "default.css" will overwrite the builtin "default.css".
102105
html_static_path = ['_static']
103106

107+
# The name of an image file (relative to this directory) to use as a favicon of
108+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
109+
# pixels large.
110+
#
111+
html_favicon = '_static/favicon.ico'
112+
104113
# Output file base name for HTML help builder.
105114
htmlhelp_basename = 'AdafruitFeatherwingLibrarydoc'
106115

docs/examples.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Simple tests
2+
-------------
3+
4+
Ensure your device works with this simple test.
5+
6+
.. literalinclude:: ../examples/ina219_featherwing/ina219.py
7+
:caption: examples/ina219_featherwing/ina219.py
8+
:linenos:
9+
10+
.. literalinclude:: ../examples/joy_featherwing/joy.py
11+
:caption: examples/joy_featherwing/joy.py
12+
:linenos:
13+
14+
.. literalinclude:: ../examples/motor_featherwing/dc_motor.py
15+
:caption: examples/motor_featherwing/dc_motor.py
16+
:linenos:
17+
18+
.. literalinclude:: ../examples/motor_featherwing/stepper_motor.py
19+
:caption: examples/motor_featherwing/stepper_motor.py
20+
: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 Feather Wings <https://www.adafruit.com/category/945>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing/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)