1- Introduction
1+ Introduction
22============
33
44.. image :: https://readthedocs.org/projects/adafruit-micropython-ds3231/badge/?version=latest
55 :target: https://circuitpython.readthedocs.io/projects/ds3231/en/latest/
66 :alt: Documentation Status
77
8- .. image :: https://badges.gitter.im/adafruit/circuitpython .svg
9- :target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
10- :alt: Gitter
8+ .. image :: https://img.shields.io/discord/327254708534116352 .svg
9+ :target: https://discord.gg/nBQh6qu
10+ :alt: Discord
1111
1212 The datasheet for the DS3231 explains that this part is an
1313"Extremely Accurate I²C-Integrated RTC/TCXO/Crystal". And,
@@ -33,16 +33,19 @@ timekeeping, even when main power is lost. Great for
3333datalogging and clocks, or anything where you need to
3434really know the time.
3535
36- .. image :: 3013-01.jpg
36+ .. image :: ../docs/_static/ 3013-01.jpg
3737
3838Dependencies
3939=============
40+ This driver depends on:
4041
41- This driver depends on the `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
42- and `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
43- libraries. Please ensure they are also available on the CircuitPython filesystem.
42+ * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
43+ * `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
44+ * `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
45+
46+ Please ensure all dependencies are available on the CircuitPython filesystem.
4447This is easily achieved by downloading
45- `a library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
48+ `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
4649
4750Usage Notes
4851===========
@@ -59,16 +62,16 @@ Of course, you must import the library to use it:
5962 import time
6063
6164 All the Adafruit RTC libraries take an instantiated and active I2C object
62- (from the `busio ` library) as an argument to their constructor. The way to
65+ (from the `` busio ` ` library) as an argument to their constructor. The way to
6366create an I2C object depends on the board you are using. For boards with labeled
6467SCL and SDA pins, you can:
6568
6669.. code :: python
6770
6871 from board import *
6972
70- You can also use pins defined by the onboard `microcontroller ` through the
71- `microcontroller.pin ` module.
73+ You can also use pins defined by the onboard `` microcontroller ` ` through the
74+ `` microcontroller.pin ` ` module.
7275
7376Now, to initialize the I2C bus:
7477
@@ -86,15 +89,15 @@ the RTC object:
8689 Date and time
8790-------------
8891
89- To set the time, you need to set ``datetime `` to a `time.struct_time ` object:
92+ To set the time, you need to set ``datetime `` to a `` time.struct_time ` ` object:
9093
9194.. code :: python
9295
9396 rtc.datetime = time.struct_time((2017 ,1 ,9 ,15 ,6 ,0 ,0 ,9 ,- 1 ))
9497
9598 After the RTC is set, you retrieve the time by reading the ``datetime ``
96- attribute and access the standard attributes of a struct_time such as `tm_year `,
97- `tm_hour ` and `tm_min `.
99+ attribute and access the standard attributes of a struct_time such as `` tm_year ` `,
100+ `` tm_hour `` and `` tm_min ` `.
98101
99102.. code :: python
100103
@@ -106,14 +109,14 @@ Alarm
106109-----
107110
108111To set the time, you need to set ``alarm1 `` or ``alarm2 `` to a tuple with a
109- `time.struct_time ` object and string representing the frequency such as "hourly":
112+ `` time.struct_time ` ` object and string representing the frequency such as "hourly":
110113
111114.. code :: python
112115
113116 rtc.alarm1 = (time.struct_time((2017 ,1 ,9 ,15 ,6 ,0 ,0 ,9 ,- 1 )), " daily" )
114117
115118 After the RTC is set, you retrieve the alarm status by reading the corresponding
116- `alarm1_status ` or `alarm2_status ` attributes. Once True, set it back to False
119+ `` alarm1_status `` or `` alarm2_status ` ` attributes. Once True, set it back to False
117120to reset.
118121
119122.. code :: python
@@ -122,10 +125,56 @@ to reset.
122125 print (" wake up!" )
123126 rtc.alarm1_status = False
124127
125- API Reference
126- =============
128+ Contributing
129+ ============
130+
131+ Contributions are welcome! Please read our `Code of Conduct
132+ <https://github.com/adafruit/Adafruit_CircuitPython_DS3231/blob/master/CODE_OF_CONDUCT.md> `_
133+ before contributing to help this project stay welcoming.
134+
135+ Building locally
136+ ================
137+
138+ To build this library locally you'll need to install the
139+ `circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools >`_ package.
140+
141+ .. code-block :: shell
142+
143+ python3 -m venv .env
144+ source .env/bin/activate
145+ pip install circuitpython-build-tools
146+
147+ Once installed, make sure you are in the virtual environment:
148+
149+ .. code-block :: shell
150+
151+ source .env/bin/activate
152+
153+ Then run the build:
154+
155+ .. code-block :: shell
156+
157+ circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ds3231 --library_location .
158+
159+ Sphinx documentation
160+ -----------------------
161+
162+ Sphinx is used to build the documentation based on rST files and comments in the code. First,
163+ install dependencies (feel free to reuse the virtual environment from above):
164+
165+ .. code-block :: shell
166+
167+ python3 -m venv .env
168+ source .env/bin/activate
169+ pip install Sphinx sphinx-rtd-theme
170+
171+ Now, once you have the virtual environment activated:
172+
173+ .. code-block :: shell
127174
128- .. toctree ::
129- :maxdepth: 2
175+ cd docs
176+ sphinx-build -E -W -b html . _build/html
130177
131- api
178+ This will output the documentation to ``docs/_build/html ``. Open the index.html in your browser to
179+ view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
180+ locally verify it will pass.
0 commit comments