Skip to content

Commit 9ce2718

Browse files
authored
Merge pull request #7 from sommersoft/new_docs
Improve Ref Docs
2 parents 978c4c5 + bfac704 commit 9ce2718

10 files changed

+119
-14
lines changed
File renamed without changes.

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ 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
on:
2222
tags: true
2323

2424
install:
25-
- pip install pylint circuitpython-build-tools
25+
- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme
2626

2727
script:
2828
- pylint adafruit_bno055.py
2929
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3030
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-bno055 --library_location .
31+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,49 @@ Contributions are welcome! Please read our `Code of Conduct
6666
before contributing to help this project stay welcoming.
6767

6868

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

adafruit_bno055.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323

2424
"""
25-
``adafruit_bno055``
26-
===================
25+
``adafruit_bno055`` - Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055
26+
=======================================================================================
2727
2828
This is a CircuitPython driver for the Bosch BNO055 nine degree of freedom
2929
inertial measurement unit module with sensor fusion.
@@ -95,14 +95,14 @@ class BNO055:
9595
accelerometer = _ScaledReadOnlyStruct(0x08, '<hhh', 1/100)
9696
"""Gives the raw accelerometer readings, in m/s.
9797
98-
.. warning:: This is deprecated. Use `acceleration` instead. It'll work
98+
.. warning:: This is deprecated. Use ``acceleration`` instead. It'll work
9999
with other drivers too."""
100100
acceleration = _ScaledReadOnlyStruct(0x08, '<hhh', 1/100)
101101
"""Gives the raw accelerometer readings, in m/s."""
102102
magnetometer = _ScaledReadOnlyStruct(0x0e, '<hhh', 1/16)
103103
"""Gives the raw magnetometer readings in microteslas.
104104
105-
.. warning:: This is deprecated. Use `magnetic` instead. It'll work with
105+
.. warning:: This is deprecated. Use ``magnetic`` instead. It'll work with
106106
other drivers too."""
107107
magnetic = _ScaledReadOnlyStruct(0x0e, '<hhh', 1/16)
108108
"""Gives the raw magnetometer readings in microteslas."""

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: 13 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 BNO055 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,13 @@
9598
# so a file named "default.css" will overwrite the builtin "default.css".
9699
html_static_path = ['_static']
97100

101+
102+
# The name of an image file (relative to this directory) to use as a favicon of
103+
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
104+
# pixels large.
105+
#
106+
html_favicon = '_static/favicon.ico'
107+
98108
# Output file base name for HTML help builder.
99109
htmlhelp_basename = 'AdafruitBNO055Librarydoc'
100110

docs/examples.rst

Lines changed: 8 additions & 0 deletions
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/bno055_simpletest.py
7+
:caption: examples/bno055_simpletest.py
8+
: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 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 <https://www.adafruit.com/product/2472>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_BNO055/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`
File renamed without changes.

0 commit comments

Comments
 (0)