Skip to content

Commit f4628e8

Browse files
authored
Merge pull request #3 from sommersoft/new_docs
Improve Ref Docs
2 parents 08636a3 + f466ac2 commit f4628e8

File tree

10 files changed

+139
-19
lines changed

10 files changed

+139
-19
lines changed
File renamed without changes.

.travis.yml

Lines changed: 4 additions & 2 deletions
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_lsm9ds1.py
2930
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
3031
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-lsm9ds1 --library_location .
32+
- cd docs && sphinx-build -E -W -b html . _build/html

README.rst

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This is easily achieved by downloading
2626
Usage Example
2727
=============
2828

29-
See examples/simpletest.py for a demo of the usage.
29+
See examples/lsm9ds1_simpletest.py for a demo of the usage.
3030

3131
Contributing
3232
============
@@ -35,10 +35,50 @@ Contributions are welcome! Please read our `Code of Conduct
3535
<https://github.com/adafruit/Adafruit_CircuitPython_lsm9ds1/blob/master/CODE_OF_CONDUCT.md>`_
3636
before contributing to help this project stay welcoming.
3737

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

44-
api

adafruit_lsm9ds1.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,25 @@
2525
2626
CircuitPython module for the LSM9DS1 accelerometer, magnetometer, gyroscope.
2727
Based on the driver from:
28-
https://github.com/adafruit/Adafruit_LSM9DS1
28+
https://github.com/adafruit/Adafruit_LSM9DS1
2929
3030
See examples/simpletest.py for a demo of the usage.
3131
3232
* Author(s): Tony DiCola
33+
34+
Implementation Notes
35+
--------------------
36+
37+
**Hardware:**
38+
39+
* Adafruit `9-DOF Accel/Mag/Gyro+Temp Breakout Board - LSM9DS1
40+
<https://www.adafruit.com/product/3387>`_ (Product ID: 3387)
41+
42+
**Software and Dependencies:**
43+
44+
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
45+
https://github.com/adafruit/circuitpython/releases
46+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
3347
"""
3448

3549
__version__ = "0.0.0-auto.0"
@@ -166,7 +180,7 @@ def __init__(self):
166180

167181
@property
168182
def accel_range(self):
169-
"""Get and set the accelerometer range. Must be a value of:
183+
"""The accelerometer range. Must be a value of:
170184
- ACCELRANGE_2G
171185
- ACCELRANGE_4G
172186
- ACCELRANGE_8G
@@ -194,7 +208,7 @@ def accel_range(self, val):
194208

195209
@property
196210
def mag_gain(self):
197-
"""Get and set the magnetometer gain. Must be a value of:
211+
"""The magnetometer gain. Must be a value of:
198212
- MAGGAIN_4GAUSS
199213
- MAGGAIN_8GAUSS
200214
- MAGGAIN_12GAUSS
@@ -222,7 +236,7 @@ def mag_gain(self, val):
222236

223237
@property
224238
def gyro_scale(self):
225-
"""Get and set the gyroscope scale. Must be a value of:
239+
"""The gyroscope scale. Must be a value of:
226240
- GYROSCALE_245DPS
227241
- GYROSCALE_500DPS
228242
- GYROSCALE_2000DPS
@@ -258,7 +272,7 @@ def read_accel_raw(self):
258272

259273
@property
260274
def accelerometer(self):
261-
"""Get the accelerometer X, Y, Z axis values as a 3-tuple of
275+
"""The accelerometer X, Y, Z axis values as a 3-tuple of
262276
m/s^2 values.
263277
"""
264278
raw = self.read_accel_raw()
@@ -279,7 +293,7 @@ def read_mag_raw(self):
279293

280294
@property
281295
def magnetometer(self):
282-
"""Get the magnetometer X, Y, Z axis values as a 3-tuple of
296+
"""The magnetometer X, Y, Z axis values as a 3-tuple of
283297
gauss values.
284298
"""
285299
raw = self.read_mag_raw()
@@ -299,7 +313,7 @@ def read_gyro_raw(self):
299313

300314
@property
301315
def gyroscope(self):
302-
"""Get the gyroscope X, Y, Z axis values as a 3-tuple of
316+
"""The gyroscope X, Y, Z axis values as a 3-tuple of
303317
degrees/second values.
304318
"""
305319
raw = self.read_mag_raw()
@@ -318,7 +332,7 @@ def read_temp_raw(self):
318332

319333
@property
320334
def temperature(self):
321-
"""Get the temperature of the sensor in degrees Celsius."""
335+
"""The temperature of the sensor in degrees Celsius."""
322336
# This is just a guess since the starting point (21C here) isn't documented :(
323337
# See discussion from:
324338
# https://github.com/kriswiner/LSM9DS1/issues/3

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 LSM9DS1 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,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 = 'AdafruitLSM9DS1Librarydoc'
100109

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/lsm9ds1_simpletest.py
7+
:caption: examples/lsm9ds1_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 Accel/Mag/Gyro+Temp Breakout Board - LSM9DS1 <https://www.adafruit.com/product/3387>
30+
31+
.. toctree::
32+
:caption: Other Links
33+
34+
Download <https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS1/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)