Skip to content

Commit 57ccc4e

Browse files
authored
Merge pull request #12 from sommersoft/new_docs
Improve Ref Docs
2 parents f86b454 + 90e604b commit 57ccc4e

17 files changed

+437
-80
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
python:
22
version: 3
3-
pip_install: true
43
requirements_file: requirements.txt

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

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

README.rst

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Adafruit CircuitPython Register library
2-
=======================================
1+
2+
Introduction
3+
============
34

45
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-register/badge/?version=latest
56
:target: https://circuitpython.readthedocs.io/projects/register/en/latest/
@@ -9,19 +10,28 @@ Adafruit CircuitPython Register library
910
:target: https://discord.gg/nBQh6qu
1011
:alt: Discord
1112
13+
.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_Register.svg?branch=master
14+
:target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_Register
15+
:alt: Build Status
16+
1217
This library provides a variety of data descriptor class for `Adafruit
1318
CircuitPython <https://github.com/adafruit/circuitpython>`_ that makes it really
1419
simple to write a device drivers for a I2C and SPI register based devices. Data
1520
descriptors act like basic attributes from the outside which makes using them
1621
really easy to use.
1722

18-
API
19-
---
20-
.. toctree::
21-
:maxdepth: 3
23+
Dependencies
24+
=============
25+
This driver depends on:
26+
27+
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
2228

23-
adafruit_register/index
29+
Please ensure all dependencies are available on the CircuitPython filesystem.
30+
This is easily achieved by downloading
31+
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2432

33+
Usage Example
34+
=============
2535

2636
Creating a driver
2737
-----------------
@@ -158,9 +168,59 @@ Thats it! Now you can use your new register class like the example above. Just
158168
remember to keep the number of members to a minimum because the class may be
159169
used a bunch of times.
160170

161-
Indices and tables
162-
------------------
163171

164-
* :ref:`genindex`
165-
* :ref:`modindex`
166-
* :ref:`search`
172+
Contributing
173+
============
174+
175+
Contributions are welcome! Please read our `Code of Conduct
176+
<https://github.com/adafruit/Adafruit_CircuitPython_Register/blob/master/CODE_OF_CONDUCT.md>`_
177+
before contributing to help this project stay welcoming.
178+
179+
Building locally
180+
================
181+
182+
To build this library locally you'll need to install the
183+
`circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package.
184+
185+
.. code-block:: shell
186+
187+
python3 -m venv .env
188+
source .env/bin/activate
189+
pip install circuitpython-build-tools
190+
191+
Once installed, make sure you are in the virtual environment:
192+
193+
.. code-block:: shell
194+
195+
source .env/bin/activate
196+
197+
Then run the build:
198+
199+
.. code-block:: shell
200+
201+
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-register --library_location .
202+
203+
Sphinx documentation
204+
-----------------------
205+
206+
Sphinx is used to build the documentation based on rST files and comments in the code. First,
207+
install dependencies (feel free to reuse the virtual environment from above):
208+
209+
.. code-block:: shell
210+
211+
python3 -m venv .env
212+
source .env/bin/activate
213+
pip install Sphinx sphinx-rtd-theme
214+
215+
Now, once you have the virtual environment activated:
216+
217+
.. code-block:: shell
218+
219+
cd docs
220+
sphinx-build -E -W -b html . _build/html
221+
222+
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
223+
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
224+
locally verify it will pass.
225+
226+

adafruit_register/i2c_bcd_alarm.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
2323

24-
"""`i2c_bcd_alarm` - Binary Coded Decimal alarm register
25-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"""
24+
"""
25+
`adafruit_register.i2c_bcd_alarm`
26+
====================================================
27+
28+
Binary Coded Decimal alarm register
29+
30+
* Author(s): Scott Shawcroft
31+
"""
2632

2733
__version__ = "0.0.0-auto.0"
2834
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Register.git"
@@ -32,17 +38,15 @@
3238
def _bcd2bin(value):
3339
"""Convert binary coded decimal to Binary
3440
35-
Arguments:
36-
value - the BCD value to convert to binary (required, no default)
41+
:param value: the BCD value to convert to binary (required, no default)
3742
"""
3843
return value - 6 * (value >> 4)
3944

4045

4146
def _bin2bcd(value):
4247
"""Convert a binary value to binary coded decimal.
4348
44-
Arguments:
45-
value - the binary value to convert to BCD. (required, no default)
49+
:param value: the binary value to convert to BCD. (required, no default)
4650
"""
4751
return value + 6 * (value // 10)
4852

@@ -65,10 +69,10 @@ class BCDAlarmTimeRegister:
6569
6670
* "secondly", once a second (only if alarm has_seconds)
6771
* "minutely", once a minute when seconds match (if alarm doesn't seconds then when seconds = 0)
68-
* "hourly", once an hour when `tm_min` and `tm_sec` match
69-
* "daily", once a day when `tm_hour`, `tm_min` and `tm_sec` match
70-
* "weekly", once a week when `tm_wday`, `tm_hour`, `tm_min`, `tm_sec` match
71-
* "monthly", once a month when `tm_mday`, `tm_hour`, `tm_min`, `tm_sec` match
72+
* "hourly", once an hour when ``tm_min`` and ``tm_sec`` match
73+
* "daily", once a day when ``tm_hour``, ``tm_min`` and ``tm_sec`` match
74+
* "weekly", once a week when ``tm_wday``, ``tm_hour``, ``tm_min``, ``tm_sec`` match
75+
* "monthly", once a month when ``tm_mday``, ``tm_hour``, ``tm_min``, ``tm_sec`` match
7276
7377
:param int register_address: The register address to start the read
7478
:param bool has_seconds: True if the alarm can happen minutely.

adafruit_register/i2c_bcd_datetime.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
23+
"""
24+
`adafruit_register.i2c_bcd_datetime`
25+
====================================================
2326
24-
"""`i2c_bcd_datetime` - Binary Coded Decimal date and time register
25-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"""
27+
Binary Coded Decimal date and time register
28+
29+
* Author(s): Scott Shawcroft
30+
"""
2631

2732
__version__ = "0.0.0-auto.0"
2833
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Register.git"
@@ -32,17 +37,15 @@
3237
def _bcd2bin(value):
3338
"""Convert binary coded decimal to Binary
3439
35-
Arguments:
36-
value - the BCD value to convert to binary (required, no default)
40+
:param value: the BCD value to convert to binary (required, no default)
3741
"""
3842
return value - 6 * (value >> 4)
3943

4044

4145
def _bin2bcd(value):
4246
"""Convert a binary value to binary coded decimal.
4347
44-
Arguments:
45-
value - the binary value to convert to BCD. (required, no default)
48+
:param value: the binary value to convert to BCD. (required, no default)
4649
"""
4750
return value + 6 * (value // 10)
4851

adafruit_register/i2c_bit.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
23+
"""
24+
`adafruit_register.i2c_bit`
25+
====================================================
2326
24-
"""`i2c_bit` - Single bit registers
25-
++++++++++++++++++++++++++++++++"""
27+
Single bit registers
28+
29+
* Author(s): Scott Shawcroft
30+
"""
2631

2732
__version__ = "0.0.0-auto.0"
2833
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Register.git"

adafruit_register/i2c_bits.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
23+
"""
24+
`adafruit_register.i2c_bits`
25+
====================================================
2326
24-
"""`i2c_bits` - Multi bit registers
25-
++++++++++++++++++++++++++++++++"""
27+
Multi bit registers
28+
29+
* Author(s): Scott Shawcroft
30+
"""
2631

2732
__version__ = "0.0.0-auto.0"
2833
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Register.git"

adafruit_register/i2c_struct.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
23+
"""
24+
`adafruit_register.i2c_struct`
25+
====================================================
26+
27+
Generic structured registers based on `struct`
2328
24-
"""`i2c_struct` - Generic structured registers based on `struct`
25-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29+
* Author(s): Scott Shawcroft
2630
"""
2731

2832
try:

adafruit_register/i2c_struct_array.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
# pylint: disable=too-few-public-methods
23+
"""
24+
`adafruit_register.i2c_struct_array`
25+
====================================================
26+
27+
Array of structured registers based on `struct`
2328
24-
"""`i2c_struct_array` - Array of structured registers based on `struct`
25-
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29+
* Author(s): Scott Shawcroft
2630
"""
2731

2832
try:

0 commit comments

Comments
 (0)