From 9e4e675f5f917762cd7a1d9720801f171695ff7e Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 09:35:03 -0600 Subject: [PATCH 01/10] renamed example --- examples/{demo.py => ds3231_simpletest.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{demo.py => ds3231_simpletest.py} (100%) diff --git a/examples/demo.py b/examples/ds3231_simpletest.py similarity index 100% rename from examples/demo.py rename to examples/ds3231_simpletest.py From 2ac39cfbedc662f0f7374184162ce00af2dfbbd7 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 09:45:26 -0600 Subject: [PATCH 02/10] setup docs folder --- 3013-01.jpg => docs/_static/3013-01.jpg | Bin docs/_static/favicon.ico | Bin 0 -> 4414 bytes api.rst => docs/api.rst | 0 conf.py => docs/conf.py | 19 ++++++--- docs/examples.rst | 8 ++++ docs/index.rst | 49 ++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) rename 3013-01.jpg => docs/_static/3013-01.jpg (100%) create mode 100644 docs/_static/favicon.ico rename api.rst => docs/api.rst (100%) rename conf.py => docs/conf.py (95%) create mode 100644 docs/examples.rst create mode 100644 docs/index.rst diff --git a/3013-01.jpg b/docs/_static/3013-01.jpg similarity index 100% rename from 3013-01.jpg rename to docs/_static/3013-01.jpg diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..5aca98376a1f7e593ebd9cf41a808512c2135635 GIT binary patch literal 4414 zcmd^BX;4#F6n=SG-XmlONeGrD5E6J{RVh+e928U#MG!$jWvO+UsvWh`x&VqGNx*en zx=qox7Dqv{kPwo%fZC$dDwVpRtz{HzTkSs8QhG0)%Y=-3@Kt!4ag|JcIo?$-F|?bXVS9UDUyev>MVZQ(H8K4#;BQW-t2CPorj8^KJrMX}QK zp+e<;4ldpXz~=)2GxNy811&)gt-}Q*yVQpsxr@VMoA##{)$1~=bZ1MmjeFw?uT(`8 z^g=09<=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eZkhSqh-{reE!5di;1zk$#Y zCe7rOnlzFYJ6Z#Hm$GoidKB=2HBCwm`BbZVeZY4ukmG%1uz7p2URs6c9j-Gjj^oQV zsdDb3@k2e`C$1I5ML5U0Qs0C1GAp^?!*`=|Nm(vWz3j*j*8ucum2;r0^-6Aca=Gv) zc%}&;!+_*S2tlnnJnz0EKeRmw-Y!@9ob!XQBwiv}^u9MkaXHvM=!<3YX;+2#5Cj5pp?FEK750S3BgeSDtaE^ zXUM@xoV6yBFKfzvY20V&Lr0yC + + Adafruit ChronoDot - Ultra-precise Real Time Clock + +.. toctree:: + :caption: Other Links + + Download + CircuitPython Reference Documentation + CircuitPython Support Forum + Discord Chat + Adafruit Learning System + Adafruit Blog + Adafruit Store + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From 7f5fe5f9f42806793970f7bc973543d752326179 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 09:50:38 -0600 Subject: [PATCH 03/10] updated .travis & .readthedocs yml --- readthedocs.yml => .readthedocs.yml | 2 ++ .travis.yml | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename readthedocs.yml => .readthedocs.yml (61%) diff --git a/readthedocs.yml b/.readthedocs.yml similarity index 61% rename from readthedocs.yml rename to .readthedocs.yml index a3a16c1..78a4671 100644 --- a/readthedocs.yml +++ b/.readthedocs.yml @@ -1,2 +1,4 @@ +python: + version: 3 requirements_file: requirements.txt diff --git a/.travis.yml b/.travis.yml index 8270577..7260835 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,15 +16,17 @@ deploy: provider: releases api_key: $GITHUB_TOKEN file_glob: true - file: bundles/* + file: $TRAVIS_BUILD_DIR/bundles/* skip_cleanup: true + overwrite: true on: tags: true install: - - pip install pylint circuitpython-build-tools + - pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme script: - pylint adafruit_ds3231.py - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ds3231 --library_location . + - cd docs && sphinx-build -E -W -b html . _build/html From 16dabe23aa0c3fa6d327405aa775d0279eec7e4a Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 09:56:07 -0600 Subject: [PATCH 04/10] updated README --- README.rst | 93 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/README.rst b/README.rst index ab5e072..2d89314 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,13 @@ -Introduction +Introduction ============ .. image:: https://readthedocs.org/projects/adafruit-micropython-ds3231/badge/?version=latest :target: https://circuitpython.readthedocs.io/projects/ds3231/en/latest/ :alt: Documentation Status -.. image :: https://badges.gitter.im/adafruit/circuitpython.svg - :target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge - :alt: Gitter +.. image :: https://img.shields.io/discord/327254708534116352.svg + :target: https://discord.gg/nBQh6qu + :alt: Discord The datasheet for the DS3231 explains that this part is an "Extremely Accurate I²C-Integrated RTC/TCXO/Crystal". And, @@ -33,16 +33,19 @@ timekeeping, even when main power is lost. Great for datalogging and clocks, or anything where you need to really know the time. -.. image:: 3013-01.jpg +.. image:: ../docs/_static/3013-01.jpg Dependencies ============= +This driver depends on: -This driver depends on the `Register `_ -and `Bus Device `_ -libraries. Please ensure they are also available on the CircuitPython filesystem. +* `Adafruit CircuitPython `_ +* `Bus Device `_ +* `Register `_ + +Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading -`a library and driver bundle `_. +`the Adafruit library and driver bundle `_. Usage Notes =========== @@ -59,7 +62,7 @@ Of course, you must import the library to use it: import time All the Adafruit RTC libraries take an instantiated and active I2C object -(from the `busio` library) as an argument to their constructor. The way to +(from the ``busio`` library) as an argument to their constructor. The way to create an I2C object depends on the board you are using. For boards with labeled SCL and SDA pins, you can: @@ -67,8 +70,8 @@ SCL and SDA pins, you can: from board import * -You can also use pins defined by the onboard `microcontroller` through the -`microcontroller.pin` module. +You can also use pins defined by the onboard ``microcontroller`` through the +``microcontroller.pin`` module. Now, to initialize the I2C bus: @@ -86,15 +89,15 @@ the RTC object: Date and time ------------- -To set the time, you need to set ``datetime`` to a `time.struct_time` object: +To set the time, you need to set ``datetime`` to a ``time.struct_time`` object: .. code:: python rtc.datetime = time.struct_time((2017,1,9,15,6,0,0,9,-1)) After the RTC is set, you retrieve the time by reading the ``datetime`` -attribute and access the standard attributes of a struct_time such as `tm_year`, -`tm_hour` and `tm_min`. +attribute and access the standard attributes of a struct_time such as ``tm_year``, +``tm_hour`` and ``tm_min``. .. code:: python @@ -106,14 +109,14 @@ Alarm ----- To set the time, you need to set ``alarm1`` or ``alarm2`` to a tuple with a -`time.struct_time` object and string representing the frequency such as "hourly": +``time.struct_time`` object and string representing the frequency such as "hourly": .. code:: python rtc.alarm1 = (time.struct_time((2017,1,9,15,6,0,0,9,-1)), "daily") After the RTC is set, you retrieve the alarm status by reading the corresponding -`alarm1_status` or `alarm2_status` attributes. Once True, set it back to False +``alarm1_status`` or ``alarm2_status`` attributes. Once True, set it back to False to reset. .. code:: python @@ -122,10 +125,56 @@ to reset. print("wake up!") rtc.alarm1_status = False -API Reference -============= +Contributing +============ + +Contributions are welcome! Please read our `Code of Conduct +`_ +before contributing to help this project stay welcoming. + +Building locally +================ + +To build this library locally you'll need to install the +`circuitpython-build-tools `_ package. + +.. code-block:: shell + + python3 -m venv .env + source .env/bin/activate + pip install circuitpython-build-tools + +Once installed, make sure you are in the virtual environment: + +.. code-block:: shell + + source .env/bin/activate + +Then run the build: + +.. code-block:: shell + + circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ds3231 --library_location . + +Sphinx documentation +----------------------- + +Sphinx is used to build the documentation based on rST files and comments in the code. First, +install dependencies (feel free to reuse the virtual environment from above): + +.. code-block:: shell + + python3 -m venv .env + source .env/bin/activate + pip install Sphinx sphinx-rtd-theme + +Now, once you have the virtual environment activated: + +.. code-block:: shell -.. toctree:: - :maxdepth: 2 + cd docs + sphinx-build -E -W -b html . _build/html - api +This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to +view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to +locally verify it will pass. \ No newline at end of file From 084c5c6e6433580e2bedb8256bd37bd271ff984e Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 09:56:55 -0600 Subject: [PATCH 05/10] added Code of Conduct --- CODE_OF_CONDUCT.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1617586 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at support@adafruit.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From d3e2bea003c9693f85de970d6910f8e8ad6d90db Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 10:02:03 -0600 Subject: [PATCH 06/10] sphinx fix; copy+paste missed a couple chars --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index b369d67..e096b4a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -183,7 +183,7 @@ # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # -html_favicon = '_static/favicon.ic +html_favicon = '_static/favicon.ico' # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied From 4c70f33257d1c509f760b78fc5ff8fec142610fe Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 10:15:59 -0600 Subject: [PATCH 07/10] sphinx fixes; bullet list woes --- adafruit_ds3231.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adafruit_ds3231.py b/adafruit_ds3231.py index 6c4ab1e..779b01d 100644 --- a/adafruit_ds3231.py +++ b/adafruit_ds3231.py @@ -34,10 +34,11 @@ **Hardware:** * Adafruit `DS3231 Precision RTC FeatherWing `_ -(Product ID: 3028) + (Product ID: 3028) + * Adafruit `DS3231 RTC breakout `_ (Product ID: 3013) * Adafruit `ChronoDot - Ultra-precise Real Time Clock - -v2.1 `_ (Product ID: 3013) + v2.1 `_ (Product ID: 3013) **Software and Dependencies:** From de955cf308846ed0fd5a9ba92275d2b32cc28f98 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 10:20:09 -0600 Subject: [PATCH 08/10] sphinx fix; missed a bullet list woe --- adafruit_ds3231.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_ds3231.py b/adafruit_ds3231.py index 779b01d..15559cf 100644 --- a/adafruit_ds3231.py +++ b/adafruit_ds3231.py @@ -43,7 +43,8 @@ **Software and Dependencies:** * Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: -https://github.com/adafruit/circuitpython/releases + https://github.com/adafruit/circuitpython/releases + * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice From d10633b735b42a67b89e72acc67b0930f5800989 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 26 Feb 2018 18:27:37 -0600 Subject: [PATCH 09/10] updated README; image fix --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2d89314..0735a36 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ timekeeping, even when main power is lost. Great for datalogging and clocks, or anything where you need to really know the time. -.. image:: ../docs/_static/3013-01.jpg +.. image:: /docs/_static/3013-01.jpg Dependencies ============= From 28c2dcfe406b70337495247a5f7d5a975333063a Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 27 Feb 2018 19:47:33 -0600 Subject: [PATCH 10/10] refixing README image filepath --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 0735a36..2d89314 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ timekeeping, even when main power is lost. Great for datalogging and clocks, or anything where you need to really know the time. -.. image:: /docs/_static/3013-01.jpg +.. image:: ../docs/_static/3013-01.jpg Dependencies =============