@@ -6,9 +6,9 @@ Introduction
6
6
:target: https://circuitpython.readthedocs.io/projects/ds1307/en/latest/
7
7
:alt: Documentation Status
8
8
9
- .. image :: https://badges.gitter.im/adafruit/circuitpython .svg
10
- :target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
11
- :alt: Gitter
9
+ .. image :: https://img.shields.io/discord/327254708534116352 .svg
10
+ :target: https://discord.gg/nBQh6qu
11
+ :alt: Discord
12
12
13
13
This is a great battery-backed real time clock (RTC) that allows your
14
14
microcontroller project to keep track of time even if it is reprogrammed,
@@ -24,16 +24,20 @@ If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC
24
24
please check out our affordable
25
25
`PCF8523 RTC breakout <https://www.adafruit.com/products/3295 >`_.
26
26
27
- .. image :: 3296-00.jpg
27
+ .. image :: ../docs/_static/3296-00.jpg
28
+ :alt: DS1307
28
29
29
30
Dependencies
30
31
=============
32
+ This driver depends on:
31
33
32
- This driver depends on the `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
33
- and `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
34
- libraries. Please ensure they are also available on the CircuitPython filesystem.
34
+ * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
35
+ * `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice >`_
36
+ * `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register >`_
37
+
38
+ Please ensure all dependencies are available on the CircuitPython filesystem.
35
39
This is easily achieved by downloading
36
- `a library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
40
+ `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
37
41
38
42
Usage Notes
39
43
===========
@@ -47,16 +51,16 @@ Of course, you must import the library to use it:
47
51
import time
48
52
49
53
All the Adafruit RTC libraries take an instantiated and active I2C object
50
- (from the `busio ` library) as an argument to their constructor. The way to
54
+ (from the `` busio ` ` library) as an argument to their constructor. The way to
51
55
create an I2C object depends on the board you are using. For boards with labeled
52
56
SCL and SDA pins, you can:
53
57
54
58
.. code :: python
55
59
56
60
from board import *
57
61
58
- You can also use pins defined by the onboard `microcontroller ` through the
59
- `microcontroller.pin ` module.
62
+ You can also use pins defined by the onboard `` microcontroller ` ` through the
63
+ `` microcontroller.pin ` ` module.
60
64
61
65
Now, to initialize the I2C bus:
62
66
@@ -78,19 +82,65 @@ To set the time, you need to set ``datetime`` to a `time.struct_time` object:
78
82
rtc.datetime = time.struct_time((2017 ,1 ,9 ,15 ,6 ,0 ,0 ,9 ,- 1 ))
79
83
80
84
After the RTC is set, you retrieve the time by reading the ``datetime ``
81
- attribute and access the standard attributes of a struct_time such as `tm_year `,
82
- `tm_hour ` and `tm_min `.
85
+ attribute and access the standard attributes of a struct_time such as `` tm_year ` `,
86
+ `` tm_hour `` and `` tm_min ` `.
83
87
84
88
.. code :: python
85
89
86
90
t = rtc.datetime
87
91
print (t)
88
92
print (t.tm_hour, t.tm_min)
89
93
90
- API Reference
91
- =============
94
+ Contributing
95
+ ============
96
+
97
+ Contributions are welcome! Please read our `Code of Conduct
98
+ <https://github.com/adafruit/Adafruit_CircuitPython_VEML6070/blob/master/CODE_OF_CONDUCT.md> `_
99
+ before contributing to help this project stay welcoming.
100
+
101
+ Building locally
102
+ ================
103
+
104
+ To build this library locally you'll need to install the
105
+ `circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools >`_ package.
106
+
107
+ .. code-block :: shell
108
+
109
+ python3 -m venv .env
110
+ source .env/bin/activate
111
+ pip install circuitpython-build-tools
112
+
113
+ Once installed, make sure you are in the virtual environment:
114
+
115
+ .. code-block :: shell
116
+
117
+ source .env/bin/activate
118
+
119
+ Then run the build:
120
+
121
+ .. code-block :: shell
122
+
123
+ circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ds1307 --library_location .
124
+
125
+ Sphinx documentation
126
+ -----------------------
127
+
128
+ Sphinx is used to build the documentation based on rST files and comments in the code. First,
129
+ install dependencies (feel free to reuse the virtual environment from above):
130
+
131
+ .. code-block :: shell
132
+
133
+ python3 -m venv .env
134
+ source .env/bin/activate
135
+ pip install Sphinx sphinx-rtd-theme
136
+
137
+ Now, once you have the virtual environment activated:
138
+
139
+ .. code-block :: shell
92
140
93
- .. toctree ::
94
- :maxdepth: 2
141
+ cd docs
142
+ sphinx-build -E -W -b html . _build/html
95
143
96
- api
144
+ This will output the documentation to ``docs/_build/html ``. Open the index.html in your browser to
145
+ view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
146
+ locally verify it will pass.
0 commit comments