From ce15cbd41ad8bed9263583c1ada4f498094f1eff Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 21:57:27 -0600 Subject: [PATCH 01/12] setup docs folder; removed old api index file --- adafruit_ht16k33/index.rst | 21 ---------------- docs/_static/favicon.ico | Bin 0 -> 4414 bytes docs/api.rst | 11 +++++++++ conf.py => docs/conf.py | 15 +++++++++--- docs/examples.rst | 12 +++++++++ docs/index.rst | 49 +++++++++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+), 24 deletions(-) delete mode 100644 adafruit_ht16k33/index.rst create mode 100644 docs/_static/favicon.ico create mode 100644 docs/api.rst rename conf.py => docs/conf.py (90%) create mode 100644 docs/examples.rst create mode 100644 docs/index.rst diff --git a/adafruit_ht16k33/index.rst b/adafruit_ht16k33/index.rst deleted file mode 100644 index e7528fc..0000000 --- a/adafruit_ht16k33/index.rst +++ /dev/null @@ -1,21 +0,0 @@ - -Variety of HT16K33 displays -=========================================== - -`ht16k33` - Base class for the displays ------------------------------------------------------ - -.. automodule:: adafruit_ht16k33.ht16k33 - :members: - -`matrix` - Matrix of dots in the displays ------------------------------------------------------ - -.. automodule:: adafruit_ht16k33.matrix - :members: - -`segments` - Segment display such as those on alarm clocks ------------------------------------------------------------- - -.. automodule:: adafruit_ht16k33.segments - :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%buwN%i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E!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 c180407958c4eee639fab598b9b7c3d87ea4b821 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 21:59:05 -0600 Subject: [PATCH 02/12] 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 d479da8..e02b140 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_ht16k33/*.py - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,undefined-variable,wildcard-import examples/*.py) - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ht16k33 --library_location . + - cd docs && sphinx-build -E -W -b html . _build/html From 31626e94f0d09a879b266a4d9ecb65ef717f9d41 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:01:11 -0600 Subject: [PATCH 03/12] updated README --- README.rst | 61 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 7726650..fae3317 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -Introduction +Introduction ============ .. image:: https://readthedocs.org/projects/adafruit-circuitpython-ht16k33/badge/?version=latest @@ -15,9 +15,15 @@ It supports both 16x8 and 8x8 matrices, as well as 7- and 14-segment displays. Note this library is intended for Adafruit CircuitPython's API. For a library compatible with MicroPython machine API see this library: https://github.com/adafruit/micropython-adafruit-ht16k33 -Installation +Dependencies ============= -This driver depends on many other libraries! Please install it by downloading +This driver depends on: + +* `Adafruit CircuitPython `_ +* `Bus Device `_ + +Please ensure all dependencies are available on the CircuitPython filesystem. +This is easily achieved by downloading `the Adafruit library and driver bundle `_. Usage Example @@ -65,10 +71,49 @@ Contributions are welcome! Please read our `Code of Conduct `_ before contributing to help this project stay welcoming. -API Reference -============= +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-ht16k33 --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 - adafruit_ht16k33/index +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 502d8deb35a596243d427c02c0150c28beeeec08 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:07:02 -0600 Subject: [PATCH 04/12] updated Related Products; no Trellis here --- docs/index.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index e9cd846..6492fca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,7 +28,11 @@ Table of Contents Too many Adafruit LED Matrices, 7-Segment Displays, and Breakout Boards to list. But here is a handy search link. -Adafruit HT16K33 Products + Adafruit HT16K33 Products + + Note: This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: + + CircuitPython Trellis Library .. toctree:: :caption: Other Links From 5e21438fe35897cc748530e713b4e7fe22430984 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:10:35 -0600 Subject: [PATCH 05/12] updated docsstrings; removed 'get/set' statements --- adafruit_ht16k33/ht16k33.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_ht16k33/ht16k33.py b/adafruit_ht16k33/ht16k33.py index a29a851..d69e491 100644 --- a/adafruit_ht16k33/ht16k33.py +++ b/adafruit_ht16k33/ht16k33.py @@ -51,7 +51,7 @@ def _write_cmd(self, byte): self.i2c_device.write(self._temp) def blink_rate(self, rate=None): - """Get or set the blink rate. Range 0-3.""" + """The blink rate. Range 0-3.""" if rate is None: return self._blink_rate rate = rate & 0x03 @@ -61,7 +61,7 @@ def blink_rate(self, rate=None): return None def brightness(self, brightness): - """Get or set the brightness. Range 0-15.""" + """The brightness. Range 0-15.""" if brightness is None: return self._brightness brightness = brightness & 0x0F From 3a2fd4bd35a12c3f1d2e32ef186bace2e7f5f1f0 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:22:32 -0600 Subject: [PATCH 06/12] my Travis is borked; stab-in-the-dark pylint/sphinx fixes --- adafruit_ht16k33/ht16k33.py | 8 +++++++- adafruit_ht16k33/matrix.py | 7 ++++--- adafruit_ht16k33/segments.py | 11 ++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/adafruit_ht16k33/ht16k33.py b/adafruit_ht16k33/ht16k33.py index d69e491..d02b689 100644 --- a/adafruit_ht16k33/ht16k33.py +++ b/adafruit_ht16k33/ht16k33.py @@ -20,7 +20,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""".. currentmodule:: adafruit_ht16k33""" +""" +`adafruit_ht16k33.ht16k33` +=========================== + +* Authors: Radomir Dopieralski & Tony DiCola for Adafruit Industries + +""" from adafruit_bus_device import i2c_device from micropython import const diff --git a/adafruit_ht16k33/matrix.py b/adafruit_ht16k33/matrix.py index da1b44b..9b0bd06 100644 --- a/adafruit_ht16k33/matrix.py +++ b/adafruit_ht16k33/matrix.py @@ -20,10 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Matrix Displays -**************** +""" +Matrix Displays +================ -.. currentmodule:: adafruit_ht16k33.matrix""" +""" from adafruit_ht16k33.ht16k33 import HT16K33 diff --git a/adafruit_ht16k33/segments.py b/adafruit_ht16k33/segments.py index d58f38a..4cc9d47 100644 --- a/adafruit_ht16k33/segments.py +++ b/adafruit_ht16k33/segments.py @@ -20,13 +20,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Segment Displays -**************** - -.. currentmodule:: adafruit_ht16k33.segments""" +""" +Segment Displays +================= +""" from adafruit_ht16k33.ht16k33 import HT16K33 +# pylint disable=bad-whitespace CHARS = ( 0b00000000, 0b00000000, # 0b01000000, 0b00000110, # ! @@ -144,7 +145,7 @@ 0x71, # F 0x40, # - ) - +# pylint enable=bad-whitespace class Seg14x4(HT16K33): """Alpha-numeric, 14-segment display.""" From 6d5f3e4c1bd32918ea2008eb7e9b8d47f64f301c Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:28:28 -0600 Subject: [PATCH 07/12] sphinx conf.py had an extra autodoc_mock_import setting that cleared out the import mocks --- docs/conf.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 2880ce1..1a97cbd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,9 +23,6 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None), 'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} -# Libraries we depend on but don't need for generating docs. -autodoc_mock_imports = [] - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From b03043229cf97a70b1a94a0e0485aacf3584861d Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:30:25 -0600 Subject: [PATCH 08/12] fixed typo --- docs/examples.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/examples.rst b/docs/examples.rst index f72abe9..ab9c3a8 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -7,6 +7,6 @@ Ensure your device works with this simple test. :caption: examples/matrix.py :linenos: -.. literalinclude:: ../examples/segment.py - :caption: examples/segment.py +.. literalinclude:: ../examples/segments.py + :caption: examples/segments.py :linenos: From ab2164851f76407cd90087c5adb769680e19e505 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:40:15 -0600 Subject: [PATCH 09/12] updated README; moved Trellis note from index.rst --- README.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index fae3317..ed1dd5e 100644 --- a/README.rst +++ b/README.rst @@ -12,8 +12,14 @@ This is a library for using the I²C-based LED matrices with the HT16K33 chip. It supports both 16x8 and 8x8 matrices, as well as 7- and 14-segment displays. -Note this library is intended for Adafruit CircuitPython's API. For a library -compatible with MicroPython machine API see this library: https://github.com/adafruit/micropython-adafruit-ht16k33 +**Notes** + +#. This library is intended for Adafruit CircuitPython's API. For a library +compatible with MicroPython machine API see this `library `_. + +#. Note: This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: + + `CircuitPython Trellis Library `_ Dependencies ============= From 3562a30292776b98caad262f9f7c044b40e09094 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:40:39 -0600 Subject: [PATCH 10/12] cleaned up Related Products entry --- docs/index.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 6492fca..8f1a122 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -26,14 +26,8 @@ Table of Contents .. toctree:: :caption: Related Products - Too many Adafruit LED Matrices, 7-Segment Displays, and Breakout Boards to list. But here is a handy search link. - Adafruit HT16K33 Products - Note: This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: - - CircuitPython Trellis Library - .. toctree:: :caption: Other Links From 436522a29d3fc42c105e2f24108ed5c984a363e8 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sun, 25 Feb 2018 22:49:54 -0600 Subject: [PATCH 11/12] update README; re-formatting --- README.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index ed1dd5e..90c0a0f 100644 --- a/README.rst +++ b/README.rst @@ -12,14 +12,11 @@ This is a library for using the I²C-based LED matrices with the HT16K33 chip. It supports both 16x8 and 8x8 matrices, as well as 7- and 14-segment displays. -**Notes** +* **Notes** -#. This library is intended for Adafruit CircuitPython's API. For a library -compatible with MicroPython machine API see this `library `_. + #. This library is intended for Adafruit CircuitPython's API. For a library compatible with MicroPython machine API see this `library `_. -#. Note: This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: - - `CircuitPython Trellis Library `_ + #. This library does not work with the Trellis 4x4 LED+Keypad board. For that product use: `CircuitPython Trellis Library `_ Dependencies ============= From 9d07c1ee0ce460d68fde836b2c45dccc3edb724d Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 27 Feb 2018 18:16:48 -0600 Subject: [PATCH 12/12] removed pylint bad-whitespace --- adafruit_ht16k33/segments.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_ht16k33/segments.py b/adafruit_ht16k33/segments.py index 4cc9d47..3aab115 100644 --- a/adafruit_ht16k33/segments.py +++ b/adafruit_ht16k33/segments.py @@ -27,7 +27,6 @@ from adafruit_ht16k33.ht16k33 import HT16K33 -# pylint disable=bad-whitespace CHARS = ( 0b00000000, 0b00000000, # 0b01000000, 0b00000110, # ! @@ -145,7 +144,7 @@ 0x71, # F 0x40, # - ) -# pylint enable=bad-whitespace + class Seg14x4(HT16K33): """Alpha-numeric, 14-segment display."""