From 9581b07503ce1fb26ab633c858927a9f7f097cfb Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 22:55:10 -0600 Subject: [PATCH 1/8] renamed example --- examples/{demo.py => ds1307_simpletest.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{demo.py => ds1307_simpletest.py} (100%) diff --git a/examples/demo.py b/examples/ds1307_simpletest.py similarity index 100% rename from examples/demo.py rename to examples/ds1307_simpletest.py From b9db6f5bf0d786d84b930088d50bf657fe26e76f Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:01:48 -0600 Subject: [PATCH 2/8] setup docs folder --- api.rst | 3 --- docs/_static/favicon.ico | Bin 0 -> 4414 bytes docs/api.rst | 5 +++++ conf.py => docs/conf.py | 22 ++++++++++++++---- docs/examples.rst | 8 +++++++ docs/index.rst | 47 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 78 insertions(+), 7 deletions(-) delete mode 100644 api.rst create mode 100644 docs/_static/favicon.ico create mode 100644 docs/api.rst rename conf.py => docs/conf.py (92%) create mode 100644 docs/examples.rst create mode 100644 docs/index.rst diff --git a/api.rst b/api.rst deleted file mode 100644 index 33284e3..0000000 --- a/api.rst +++ /dev/null @@ -1,3 +0,0 @@ - -.. automodule:: adafruit_ds1307 - :members: 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<=zW%r%bu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h-{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 + +.. 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 6a8273d2e1c7b390c925f0a5bb7b038d998963aa Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:03:52 -0600 Subject: [PATCH 3/8] updated .travis & .readthedocs yml --- readthedocs.yml => .readthedocs.yml | 0 .travis.yml | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename readthedocs.yml => .readthedocs.yml (100%) diff --git a/readthedocs.yml b/.readthedocs.yml similarity index 100% rename from readthedocs.yml rename to .readthedocs.yml diff --git a/.travis.yml b/.travis.yml index d8f2b75..b0448eb 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_ds1307.py - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ds1307 --library_location . + - cd docs && sphinx-build -E -W -b html . _build/html From f7cf1c5c290ebd02e23980aa06c9ee1e32f080e4 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:08:03 -0600 Subject: [PATCH 4/8] updated README --- README.rst | 74 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 12 deletions(-) diff --git a/README.rst b/README.rst index 3ab4ebf..796a7a5 100644 --- a/README.rst +++ b/README.rst @@ -6,9 +6,9 @@ Introduction :target: https://circuitpython.readthedocs.io/projects/ds1307/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 This is a great battery-backed real time clock (RTC) that allows your microcontroller project to keep track of time even if it is reprogrammed, @@ -25,15 +25,19 @@ please check out our affordable `PCF8523 RTC breakout `_. .. image:: 3296-00.jpg + :alt: DS1307 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 =========== @@ -87,10 +91,56 @@ attribute and access the standard attributes of a struct_time such as `tm_year`, print(t) print(t.tm_hour, t.tm_min) -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-ds1307 --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 52e176ae06ee3d8b76c1b348988b6134b95a50d6 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:17:39 -0600 Subject: [PATCH 5/8] sphinx fix --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 796a7a5..bfd09d3 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordable `PCF8523 RTC breakout `_. -.. image:: 3296-00.jpg +.. image:: /3296-00.jpg :alt: DS1307 Dependencies From 42cbf95a9237527001c6d5744d7ec3f436482468 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:19:48 -0600 Subject: [PATCH 6/8] sphinx fix again; won't find README image --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index bfd09d3..11269cc 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordable `PCF8523 RTC breakout `_. -.. image:: /3296-00.jpg +.. image:: ../3296-00.jpg :alt: DS1307 Dependencies From fa2a456ceac32c26739bf60b84e3aef9c761eb8a Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 24 Feb 2018 23:22:38 -0600 Subject: [PATCH 7/8] couple more sphinx fixes --- README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 11269cc..abe34d5 100644 --- a/README.rst +++ b/README.rst @@ -51,7 +51,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: @@ -59,8 +59,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: @@ -82,8 +82,8 @@ To set the time, you need to set ``datetime`` to a `time.struct_time` object: 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 From a88a3a3b218ceadf4d16abe28cb7ab6f3692bcf3 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 00:11:16 -0600 Subject: [PATCH 8/8] README image fix; wasn't showing up in github --- README.rst | 2 +- 3296-00.jpg => docs/_static/3296-00.jpg | Bin 2 files changed, 1 insertion(+), 1 deletion(-) rename 3296-00.jpg => docs/_static/3296-00.jpg (100%) diff --git a/README.rst b/README.rst index abe34d5..c966d6b 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordable `PCF8523 RTC breakout `_. -.. image:: ../3296-00.jpg +.. image:: ../docs/_static/3296-00.jpg :alt: DS1307 Dependencies diff --git a/3296-00.jpg b/docs/_static/3296-00.jpg similarity index 100% rename from 3296-00.jpg rename to docs/_static/3296-00.jpg