Skip to content

Commit 51630ab

Browse files
authored
Merge pull request #7 from sommersoft/new_docs
Improve Ref Docs
2 parents a84bbd5 + b05c091 commit 51630ab

10 files changed

+158
-16
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_irremote.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-irremote --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

+68-10
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ Introduction
66
:target: https://circuitpython.readthedocs.io/projects/irremote/en/latest/
77
:alt: Documentation Status
88

9-
.. image :: https://badges.gitter.im/adafruit/circuitpython.svg
10-
:target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
11-
:alt: Gitter
9+
.. image :: https://img.shields.io/discord/327254708534116352.svg
10+
:target: https://discord.gg/nBQh6qu
11+
:alt: Discord
1212
13-
TODO
13+
CircuitPython driver for use with IR Receivers.
14+
15+
Examples of products to use this library with:
16+
17+
* `Circuit Playground Express <https://www.adafruit.com/product/3333>`_
18+
19+
* `IR Receiver Sensor <https://www.adafruit.com/product/157>`_
1420

1521
Dependencies
1622
=============
@@ -25,7 +31,20 @@ This is easily achieved by downloading
2531
Usage Example
2632
=============
2733

28-
TODO
34+
.. code-block:: python
35+
36+
# Circuit Playground Express Demo Code
37+
# Adjust the pulseio 'board.PIN' if using something else
38+
import pulseio
39+
import board
40+
import adafruit_irremote
41+
42+
with pulseio.PulseIn(board.REMOTEIN, maxlen=120, idle_state=True) as p:
43+
d = adafruit_irremote.GenericDecode()
44+
code = bytearray(4)
45+
while True:
46+
d.decode(p, code)
47+
print(code)
2948
3049
Contributing
3150
============
@@ -34,10 +53,49 @@ Contributions are welcome! Please read our `Code of Conduct
3453
<https://github.com/adafruit/Adafruit_CircuitPython_irremote/blob/master/CODE_OF_CONDUCT.md>`_
3554
before contributing to help this project stay welcoming.
3655

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

adafruit_irremote.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
`adafruit_irremote`
2424
====================================================
2525
26-
Demo code for upcoming CircuitPlayground Express:
26+
Demo code for Circuit Playground Express:
2727
2828
.. code-block: python
2929
@@ -39,6 +39,21 @@
3939
print(code)
4040
4141
* Author(s): Scott Shawcroft
42+
43+
Implementation Notes
44+
--------------------
45+
46+
**Hardware:**
47+
48+
* `CircuitPlayground Express <https://www.adafruit.com/product/3333>`_
49+
50+
* `IR Receiver Sensor <https://www.adafruit.com/product/157>`_
51+
52+
**Software and Dependencies:**
53+
54+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
55+
https://github.com/adafruit/circuitpython/releases
56+
4257
"""
4358

4459
# Pretend self matter because we may add object level config later.

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

@@ -23,7 +23,7 @@
2323
source_suffix = '.rst'
2424

2525
# The master toctree document.
26-
master_doc = 'README'
26+
master_doc = 'index'
2727

2828
# General information about the project.
2929
project = u'Adafruit IRREMOTE Library'
@@ -49,7 +49,7 @@
4949
# List of patterns, relative to source directory, that match files and
5050
# directories to ignore when looking for source files.
5151
# This patterns also effect to html_static_path and html_extra_path
52-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
52+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5353

5454
# The reST default role (used for this markup: `text`) to use for all
5555
# documents.
@@ -66,6 +66,9 @@
6666
# If true, `todo` and `todoList` produce output, else they produce nothing.
6767
todo_include_todos = False
6868

69+
# If this is True, todo emits a warning for each TODO entries. The default is False.
70+
todo_emit_warnings = True
71+
6972

7073
# -- Options for HTML output ----------------------------------------------
7174

@@ -90,6 +93,12 @@
9093
# so a file named "default.css" will overwrite the builtin "default.css".
9194
html_static_path = ['_static']
9295

96+
# The name of an image file (relative to this directory) to use as a favicon of
97+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
98+
# pixels large.
99+
#
100+
html_favicon = '_static/favicon.ico'
101+
93102
# Output file base name for HTML help builder.
94103
htmlhelp_basename = 'AdafruitIRREMOTELibrarydoc'
95104

docs/examples.rst

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

docs/index.rst

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

examples/main.py renamed to examples/irremote_simpletest.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Circuit Playground Express Demo Code
2+
# Adjust the pulseio 'board.PIN' if using something else
13
import pulseio
24
import board
35
import adafruit_irremote

0 commit comments

Comments
 (0)