Skip to content

Commit 5833bd0

Browse files
authored
Merge pull request #1 from sommersoft/new_docs
Improve Ref Docs
2 parents 2759193 + 7146424 commit 5833bd0

File tree

9 files changed

+118
-22
lines changed

9 files changed

+118
-22
lines changed
File renamed without changes.

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ 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 pytest
26+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme pytest
2627

2728
script:
28-
- py.tests
29+
- py.test
2930
- pylint adafruit_motor/*.py
3031
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3132
- ([[ ! -d "tests" ]] || pylint --disable=missing-docstring tests/*.py)
3233
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-motor --library_location .
34+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 28 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_Motor.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_Motor
15+
:alt: Build Status
16+
1317
This helper library provides higher level objects to control motors and servos based on one or more
1418
PWM outputs.
1519

@@ -27,14 +31,6 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
2731
This is easily achieved by downloading
2832
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2933

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

@@ -65,3 +61,27 @@ Then run the build:
6561
.. code-block:: shell
6662
6763
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-motor --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.
87+

adafruit_motor/stepper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@
6060
class StepperMotor:
6161
"""A bipolar stepper motor or four coil unipolar motor.
6262
63-
:param ~pulseio.PWMOut ain1: `pulseio.PWMOut`-compatible output connected to the driver for the first
64-
coil (unipolar) or first input to first coil (bipolar).
65-
:param ~pulseio.PWMOut ain2: `pulseio.PWMOut`-compatible output connected to the driver for the third
66-
coil (unipolar) or second input to first coil (bipolar).
67-
:param ~pulseio.PWMOut bin1: `pulseio.PWMOut`-compatible output connected to the driver for the second
68-
coil (unipolar) or second input to second coil (bipolar).
69-
:param ~pulseio.PWMOut bin2: `pulseio.PWMOut`-compatible output connected to the driver for the fourth
70-
coil (unipolar) or second input to second coil (bipolar).
63+
:param ~pulseio.PWMOut ain1: `pulseio.PWMOut`-compatible output connected to the driver for
64+
the first coil (unipolar) or first input to first coil (bipolar).
65+
:param ~pulseio.PWMOut ain2: `pulseio.PWMOut`-compatible output connected to the driver for
66+
the third coil (unipolar) or second input to first coil (bipolar).
67+
:param ~pulseio.PWMOut bin1: `pulseio.PWMOut`-compatible output connected to the driver for
68+
the second coil (unipolar) or second input to second coil (bipolar).
69+
:param ~pulseio.PWMOut bin2: `pulseio.PWMOut`-compatible output connected to the driver for
70+
the fourth coil (unipolar) or second input to second coil (bipolar).
7171
:param int microsteps: Number of microsteps between full steps. Must be at least 2 and even.
7272
"""
7373
def __init__(self, ain1, ain2, bin1, bin2, *, microsteps=16):

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

@@ -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 motor 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', '.env']
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 = 'AdafruitMotorLibrarydoc'
100109

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/dc_motor.py
7+
:caption: examples/dc_motor.py
8+
:linenos:
9+
10+
.. literalinclude:: ../examples/stepper_motor.py
11+
:caption: examples/stepper_motor.py
12+
:linenos:
13+
14+
.. literalinclude:: ../examples/servo_sweep.py
15+
:caption: examples/servo_sweep.py
16+
:linenos:
17+
18+
.. literalinclude:: ../examples/continuous_servo.py
19+
:caption: examples/continuous_servo.py
20+
: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_Motor/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)