From 32a89a284e74fa34667e0cee7d0b51fcb6ba2aa0 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 21:33:47 -0600 Subject: [PATCH 1/9] renamed examples --- ...ads1115_differential.py => ads1115_differential_simpletest.py} | 0 ...ads1115_single_ended.py => ads1115_single_ended_simpletest.py} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename examples/{ads1115_differential.py => ads1115_differential_simpletest.py} (100%) rename examples/{ads1115_single_ended.py => ads1115_single_ended_simpletest.py} (100%) diff --git a/examples/ads1115_differential.py b/examples/ads1115_differential_simpletest.py similarity index 100% rename from examples/ads1115_differential.py rename to examples/ads1115_differential_simpletest.py diff --git a/examples/ads1115_single_ended.py b/examples/ads1115_single_ended_simpletest.py similarity index 100% rename from examples/ads1115_single_ended.py rename to examples/ads1115_single_ended_simpletest.py From 7208d8add4c1aca66ebfe8de125526c14cf5ecc4 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 21:41:21 -0600 Subject: [PATCH 2/9] setup docs folder and files --- docs/_static/favicon.ico | Bin 0 -> 4414 bytes api.rst => docs/api.rst | 0 conf.py => docs/conf.py | 15 +++++++++--- docs/examples.rst | 12 ++++++++++ docs/index.rst | 49 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 docs/_static/favicon.ico rename api.rst => docs/api.rst (100%) rename conf.py => docs/conf.py (91%) create mode 100644 docs/examples.rst create mode 100644 docs/index.rst 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-t2C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1vdj2PX{PIuqOe5dracsciH6OlAZATvE8rj6ykqdIjal2 z0S0S~PwHb-5?OQ-tU-^KTG@XNrEVSvo|HIP?H;7ZhYeZkhSqh-{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 + + ADS1115 16-Bit ADC - 4 Channel with Programmable Gain Amplifier + +.. 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 f2104c0fe13661d3494594877f7abe54b5064c45 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 21:44:20 -0600 Subject: [PATCH 3/9] updated travis & readthedocs yml files --- readthedocs.yml => .readthedocs.yml | 0 .travis.yml | 5 +++-- 2 files changed, 3 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 18eb258..bde19a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,15 +16,16 @@ deploy: provider: releases api_key: $GITHUB_TOKEN file_glob: true - file: bundles/* + file: $TRAVIS_BUILD_DIR/bundles/* skip_cleanup: true on: tags: true install: - - pip install pylint circuitpython-build-tools + - pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme script: - pylint adafruit_ads1x15/*.py - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ads1x15 --library_location . + - cd docs && sphinx-build -E -W -b html . _build/html From f6df75a31b7c800f4a27a88552cf067d608606e2 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 21:50:15 -0600 Subject: [PATCH 4/9] updated README --- README.rst | 56 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 18b1693..c3e69f1 100644 --- a/README.rst +++ b/README.rst @@ -6,9 +6,9 @@ Introduction :target: https://circuitpython.readthedocs.io/projects/CircuitPython_ADS1x15/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 Support for the ADS1x15 series of analog-to-digital converters. Available in 12-bit (ADS1015) and 16-bit (ADS1115) versions. @@ -65,10 +65,50 @@ 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-ads1x15 --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 + + cd docs + sphinx-build -E -W -b html . _build/html -.. toctree:: - :maxdepth: 2 +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. - api From 761581e2e1a69d1d9a5c93a7dbfc37707dc19d91 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 22:31:58 -0600 Subject: [PATCH 5/9] sphinx autodoc fails on differential; testing sphinx build in steps --- docs/api.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 66ca1db..4ac960f 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3,9 +3,3 @@ .. automodule:: adafruit_ads1x15 :members: - -.. automodule:: differential - :members: - -.. automodule:: single_ended - :members: From 096c34738b22fd350162dc92097b0072fe6ab9a1 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 22:38:30 -0600 Subject: [PATCH 6/9] sphinx autodoc now fails on api->no title; still testing --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index 4ac960f..b22112e 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,5 +1,5 @@ .. If you created a package, create one automodule per module in the package. -.. automodule:: adafruit_ads1x15 +.. automodule:: ../adafruit_ads1x15/adafruit_ads1x15 :members: From ef0bdc10d50d25169a8444be94a2ec8f300c0375 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 22:47:07 -0600 Subject: [PATCH 7/9] sphinx autodoc still failing; still testing --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index b22112e..84b245b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,5 +1,5 @@ .. If you created a package, create one automodule per module in the package. -.. automodule:: ../adafruit_ads1x15/adafruit_ads1x15 +.. automodule:: adafruit_ads1x15.adafruit_ads1x15 :members: From 0824a2f7d82094e3a3bc65012f0aa3ba5b4b00b9 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 22:53:03 -0600 Subject: [PATCH 8/9] sphinx autodoc fix --- docs/api.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 84b245b..0583855 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3,3 +3,9 @@ .. automodule:: adafruit_ads1x15.adafruit_ads1x15 :members: + +.. automodule:: adafruit_ads1x15.differential + :members: + +.. automodule:: adafruit_ads1x15.single_ended + :members: \ No newline at end of file From 10c5f5484e8bea867688d59460e875ca84a4c19d Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 22 Feb 2018 22:56:40 -0600 Subject: [PATCH 9/9] sphinx docstring indentation fix --- adafruit_ads1x15/differential.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/adafruit_ads1x15/differential.py b/adafruit_ads1x15/differential.py index 1e1f9be..9a4a148 100644 --- a/adafruit_ads1x15/differential.py +++ b/adafruit_ads1x15/differential.py @@ -46,10 +46,10 @@ def __getitem__(self, key): def read_adc_difference(self, differential, gain=1, data_rate=None): """Read the difference between two ADC channels and return the ADC value as a signed integer result. Differential must be one of: - - 0 = Channel 0 minus channel 1 - - 1 = Channel 0 minus channel 3 - - 2 = Channel 1 minus channel 3 - - 3 = Channel 2 minus channel 3 + - 0 = Channel 0 minus channel 1 + - 1 = Channel 0 minus channel 3 + - 2 = Channel 1 minus channel 3 + - 3 = Channel 2 minus channel 3 """ assert 0 <= differential <= 3, 'Differential must be a value within 0-3!' # Perform a single shot read using the provided differential value @@ -59,10 +59,10 @@ def read_adc_difference(self, differential, gain=1, data_rate=None): def read_volts_difference(self, differential, gain=1, data_rate=None): """Read the difference between two ADC channels and return the voltage value as a floating point result. Differential must be one of: - - 0 = Channel 0 minus channel 1 - - 1 = Channel 0 minus channel 3 - - 2 = Channel 1 minus channel 3 - - 3 = Channel 2 minus channel 3 + - 0 = Channel 0 minus channel 1 + - 1 = Channel 0 minus channel 3 + - 2 = Channel 1 minus channel 3 + - 3 = Channel 2 minus channel 3 """ assert 0 <= differential <= 3, 'Differential must be a value within 0-3!' raw = self.read_adc_difference(differential, gain, data_rate) @@ -72,10 +72,10 @@ def read_volts_difference(self, differential, gain=1, data_rate=None): def start_adc_difference(self, differential, gain=1, data_rate=None): """Start continuous ADC conversions between two ADC channels. Differential must be one of: - - 0 = Channel 0 minus channel 1 - - 1 = Channel 0 minus channel 3 - - 2 = Channel 1 minus channel 3 - - 3 = Channel 2 minus channel 3 + - 0 = Channel 0 minus channel 1 + - 1 = Channel 0 minus channel 3 + - 2 = Channel 1 minus channel 3 + - 3 = Channel 2 minus channel 3 Will return an initial conversion result, then call the get_last_result() function continuously to read the most recent conversion result. Call stop_adc() to stop conversions.