Skip to content

Commit ecd00ef

Browse files
authored
Merge pull request #14 from sommersoft/new_docs
Improve Ref Docs
2 parents 6711c69 + a1c7734 commit ecd00ef

10 files changed

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

README.rst

+49-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Introduction
1010
:target: https://adafru.it/discord
1111
:alt: Discord
1212
13+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_TLS2561.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_TLS2561
15+
:alt: Build Status
16+
1317
CircuitPython driver for TSL2561 Light Sensor.
1418

1519
Dependencies
@@ -43,10 +47,50 @@ Contributions are welcome! Please read our `Code of Conduct
4347
<https://github.com/adafruit/Adafruit_CircuitPython_CircuitPython_TSL2561/blob/master/CODE_OF_CONDUCT.md>`_
4448
before contributing to help this project stay welcoming.
4549

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

52-
api

adafruit_tsl2561.py

+20
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,26 @@
2626
CircuitPython driver for TSL2561 Light Sensor.
2727
2828
* Author(s): Carter Nelson
29+
30+
Implementation Notes
31+
--------------------
32+
33+
**Hardware:**
34+
35+
* Adafruit `TSL2561 Digital Luminosity/Lux/Light Sensor Breakout
36+
<https://www.adafruit.com/product/439>`_ (Product ID: 439)
37+
38+
* Adafruit `STEMMA - TSL2561 Digital Lux / Light Sensor
39+
<https://www.adafruit.com/product/3611>`_ (Product ID: 3611)
40+
41+
* Adafruit `Flora Lux Sensor - TSL2561 Light Sensor
42+
<https://www.adafruit.com/product/1246>`_ (Product ID: 1246)
43+
44+
**Software and Dependencies:**
45+
46+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
47+
https://github.com/adafruit/circuitpython/releases
48+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2949
"""
3050
from adafruit_bus_device.i2c_device import I2CDevice
3151
from micropython import const

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

+18-6
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

@@ -15,6 +15,11 @@
1515
'sphinx.ext.viewcode',
1616
]
1717

18+
# Uncomment the below if you use native CircuitPython modules such as
19+
# digitalio, micropython and busio. List the modules you use. Without it, the
20+
# autodoc module docs will fail to generate with a warning.
21+
autodoc_mock_imports = ["micropython", "adafruit_bus_device"]
22+
1823
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
1924

2025
# Add any paths that contain templates here, relative to this directory.
@@ -23,15 +28,13 @@
2328
source_suffix = '.rst'
2429

2530
# The master toctree document.
26-
master_doc = 'README'
31+
master_doc = 'index'
2732

2833
# General information about the project.
2934
project = u'Adafruit CIRCUITPYTHON_TSL2561 Library'
3035
copyright = u'2017 Carter Nelson'
3136
author = u'Carter Nelson'
3237

33-
autodoc_mock_imports = ['micropython']
34-
3538
# The version info for the project you're documenting, acts as replacement for
3639
# |version| and |release|, also used in various other places throughout the
3740
# built documents.
@@ -51,7 +54,7 @@
5154
# List of patterns, relative to source directory, that match files and
5255
# directories to ignore when looking for source files.
5356
# This patterns also effect to html_static_path and html_extra_path
54-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
57+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
5558

5659
# The reST default role (used for this markup: `text`) to use for all
5760
# documents.
@@ -68,6 +71,9 @@
6871
# If true, `todo` and `todoList` produce output, else they produce nothing.
6972
todo_include_todos = False
7073

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

7278
# -- Options for HTML output ----------------------------------------------
7379

@@ -92,6 +98,12 @@
9298
# so a file named "default.css" will overwrite the builtin "default.css".
9399
html_static_path = ['_static']
94100

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+
95107
# Output file base name for HTML help builder.
96108
htmlhelp_basename = 'AdafruitCIRCUITPYTHON_TSL2561Librarydoc'
97109

@@ -128,7 +140,7 @@
128140
# One entry per manual page. List of tuples
129141
# (source start file, name, description, authors, manual section).
130142
man_pages = [
131-
(master_doc, 'adafruitCIRCUITPYTHON_TSL2561library', u'Adafruit CIRCUITPYTHON_TSL2561 Library Documentation',
143+
(master_doc, 'AdafruitCIRCUITPYTHON_TSL2561library', u'Adafruit CIRCUITPYTHON_TSL2561 Library Documentation',
132144
[author], 1)
133145
]
134146

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/tsl2561_simpletest.py
7+
:caption: examples/tsl2561_simpletest.py
8+
:linenos:

docs/index.rst

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 TSL2561 Digital Luminosity/Lux/Light Sensor Breakout <https://www.adafruit.com/product/439>
30+
31+
Adafruit STEMMA - TSL2561 Digital Lux / Light Sensor <https://www.adafruit.com/product/3611>
32+
33+
Flora Lux Sensor - TSL2561 Light Sensor <https://www.adafruit.com/product/1246>
34+
35+
.. toctree::
36+
:caption: Other Links
37+
38+
Download <https://github.com/adafruit/Adafruit_CircuitPython_TSL2561/releases/latest>
39+
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
40+
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
41+
Discord Chat <https://adafru.it/discord>
42+
Adafruit Learning System <https://learn.adafruit.com>
43+
Adafruit Blog <https://blog.adafruit.com>
44+
Adafruit Store <https://www.adafruit.com>
45+
46+
Indices and tables
47+
==================
48+
49+
* :ref:`genindex`
50+
* :ref:`modindex`
51+
* :ref:`search`
File renamed without changes.

0 commit comments

Comments
 (0)