From f87a71681e0ab75850561d5a48ba3074f56fd693 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 17:49:11 -0600 Subject: [PATCH 01/12] renamed example; 1 learn guide requires update --- examples/{simpletest.py => lsm9ds0_simpletest.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{simpletest.py => lsm9ds0_simpletest.py} (100%) diff --git a/examples/simpletest.py b/examples/lsm9ds0_simpletest.py similarity index 100% rename from examples/simpletest.py rename to examples/lsm9ds0_simpletest.py From aae1a229876fd0f3592e30bb8699bafba028b0f1 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:09:23 -0600 Subject: [PATCH 02/12] setup docs folder --- docs/_static/favicon.ico | Bin 0 -> 4414 bytes api.rst => docs/api.rst | 0 conf.py => docs/conf.py | 15 +++++++++--- docs/examples.rst | 8 +++++++ docs/index.rst | 49 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 docs/_static/favicon.ico rename api.rst => docs/api.rst (100%) rename conf.py => docs/conf.py (90%) 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-t2CPorj8^KJrMX}QK zp+e<;4ldpXz~=)2GxNy811&)gt-}Q*yVQpsxr@VMoA##{)$1~=bZ1MmjeFw?uT(`8 z^g=09<=zW%r%buwN%iHtuKSg|+r7HkT0PYN*_u9k1;^Ss-Z!RBfJ?Un4w(awqp2b3 z%+myoFis_lTlCrGx2z$0BQdh+7?!J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QV zsdDb3@k2e`C$1I5ML5U0Qs0C1GAp^?!*`=|Nm(vWz3j*j*8ucum2;r0^-6Aca=Gv) zc%}&;!+_*S2tlnnJnz0EKeRmw-Y!@9ob!XQBwiv}^u9MkaXHvM=!<3YX;+2#5Cj5pp?FEK750S3BgeSDtaE^ zXUM@xoV6yBFKfzvY20V&Lr0yC + + FLORA 9-DOF Accelerometer/Gyroscope/Magnetometer - LSM9DS0 + +.. 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 294b199e6b057c797c804573fe50f1c27dc25d98 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:10:40 -0600 Subject: [PATCH 03/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 d4dbadb..11b077c 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_lsm9ds0.py - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py) - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-lsm9ds0 --library_location . + - cd docs && sphinx-build -E -W -b html . _build/html From 3e323dd867102225744e931f23fca4a4a78c875a Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:11:49 -0600 Subject: [PATCH 04/12] updated README --- README.rst | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index f5c815a..2b40848 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ This is easily achieved by downloading Usage Example ============= -See examples/simpletest.py for a demo of the usage. +See examples/lsm9ds0_simpletest.py for a demo of the usage. Contributing ============ @@ -35,10 +35,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-lsm9ds0 --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 a355f8ae4224518f6d3f2bd83a624f5564c48a01 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:13:56 -0600 Subject: [PATCH 05/12] updated info docstring --- adafruit_lsm9ds0.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index 1a25d0e..ce729a2 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -30,6 +30,23 @@ See examples/simpletest.py for a demo of the usage. * Author(s): Tony DiCola + +Implementation Notes +-------------------- + +**Hardware:** + +* `Adafruit 9-DOF Accel/Mag/Gyro+Temp Breakout Board - LSM9DS0 + `_ + +* `FLORA 9-DOF Accelerometer/Gyroscope/Magnetometer - LSM9DS0 + `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: + https://github.com/adafruit/circuitpython/releases +* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice """ try: import struct From eed6cb91c57dc95941cbdedec20138a27145d9ea Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:19:12 -0600 Subject: [PATCH 06/12] sphinx fix --- adafruit_lsm9ds0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index ce729a2..0665dfe 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -25,7 +25,7 @@ CircuitPython module for the LSM9DS0 accelerometer, magnetometer, gyroscope. Based on the driver from: - https://github.com/adafruit/Adafruit_LSM9DS0 +https://github.com/adafruit/Adafruit_LSM9DS0 See examples/simpletest.py for a demo of the usage. From 1d848ee9c6943c277f74cd23c985041ac7d1234c Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 18:36:41 -0600 Subject: [PATCH 07/12] sphin fix2 --- adafruit_lsm9ds0.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index 0665dfe..f35ceae 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -36,10 +36,10 @@ **Hardware:** -* `Adafruit 9-DOF Accel/Mag/Gyro+Temp Breakout Board - LSM9DS0 +* `Adafruit 9-DOF Accel, Mag, Gyro, & Temp Breakout Board - LSM9DS0 `_ -* `FLORA 9-DOF Accelerometer/Gyroscope/Magnetometer - LSM9DS0 +* `FLORA 9-DOF Accelerometer, Gyroscope, Magnetometer - LSM9DS0 `_ **Software and Dependencies:** From 96f28ea70e9e7c462aeab4bd33422dd3f38dbc6d Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 19:01:56 -0600 Subject: [PATCH 08/12] sphin fix2.1 --- adafruit_lsm9ds0.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index f35ceae..631726c 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -36,11 +36,11 @@ **Hardware:** -* `Adafruit 9-DOF Accel, Mag, Gyro, & Temp Breakout Board - LSM9DS0 - `_ +* Adafruit `9-DOF Accel/Mag/Gyro+Temp Breakout Board - LSM9DS0 + `_ (Product ID: 2021) -* `FLORA 9-DOF Accelerometer, Gyroscope, Magnetometer - LSM9DS0 - `_ +* FLORA `9-DOF Accelerometer/Gyroscope/Magnetometer - LSM9DS0 + `_ (Product ID: 2020) **Software and Dependencies:** From e5f6b3885439f84c658d11f0fb5d516671f593a1 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Thu, 1 Mar 2018 19:57:41 -0600 Subject: [PATCH 09/12] remove 'get/set' docstring statements; finally remembered to look --- adafruit_lsm9ds0.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index 631726c..ba8fc06 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -170,7 +170,7 @@ def __init__(self): @property def accel_range(self): - """Get and set the accelerometer range. Must be a value of: + """The accelerometer range. Must be a value of: - ACCELRANGE_2G - ACCELRANGE_4G - ACCELRANGE_6G @@ -201,7 +201,7 @@ def accel_range(self, val): @property def mag_gain(self): - """Get and set the magnetometer gain. Must be a value of: + """The magnetometer gain. Must be a value of: - MAGGAIN_2GAUSS - MAGGAIN_4GAUSS - MAGGAIN_8GAUSS @@ -229,7 +229,7 @@ def mag_gain(self, val): @property def gyro_scale(self): - """Get and set the gyroscope scale. Must be a value of: + """The gyroscope scale. Must be a value of: - GYROSCALE_245DPS - GYROSCALE_500DPS - GYROSCALE_2000DPS @@ -265,7 +265,7 @@ def read_accel_raw(self): @property def accelerometer(self): - """Get the accelerometer X, Y, Z axis values as a 3-tuple of + """Returns the accelerometer X, Y, Z axis values as a 3-tuple of m/s^2 values. """ raw = self.read_accel_raw() @@ -286,7 +286,7 @@ def read_mag_raw(self): @property def magnetometer(self): - """Get the magnetometer X, Y, Z axis values as a 3-tuple of + """Returns the magnetometer X, Y, Z axis values as a 3-tuple of gauss values. """ raw = self.read_mag_raw() @@ -306,7 +306,7 @@ def read_gyro_raw(self): @property def gyroscope(self): - """Get the gyroscope X, Y, Z axis values as a 3-tuple of + """Returns the gyroscope X, Y, Z axis values as a 3-tuple of degrees/second values. """ raw = self.read_mag_raw() @@ -325,7 +325,7 @@ def read_temp_raw(self): @property def temperature(self): - """Get the temperature of the sensor in degrees Celsius.""" + """Returns the temperature of the sensor in degrees Celsius.""" # This is just a guess since the starting point (21C here) isn't documented :( temp = self.read_temp_raw() temp = 21.0 + temp/8 From c07fd88ff7b18b05e1f109fcc7477412035f87a8 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Tue, 6 Mar 2018 20:37:55 -0600 Subject: [PATCH 10/12] updated docstrings; removed 'returns' --- adafruit_lsm9ds0.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index ba8fc06..0786c18 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -265,7 +265,7 @@ def read_accel_raw(self): @property def accelerometer(self): - """Returns the accelerometer X, Y, Z axis values as a 3-tuple of + """The accelerometer X, Y, Z axis values as a 3-tuple of m/s^2 values. """ raw = self.read_accel_raw() @@ -286,7 +286,7 @@ def read_mag_raw(self): @property def magnetometer(self): - """Returns the magnetometer X, Y, Z axis values as a 3-tuple of + """The magnetometer X, Y, Z axis values as a 3-tuple of gauss values. """ raw = self.read_mag_raw() @@ -306,7 +306,7 @@ def read_gyro_raw(self): @property def gyroscope(self): - """Returns the gyroscope X, Y, Z axis values as a 3-tuple of + """The gyroscope X, Y, Z axis values as a 3-tuple of degrees/second values. """ raw = self.read_mag_raw() @@ -325,7 +325,7 @@ def read_temp_raw(self): @property def temperature(self): - """Returns the temperature of the sensor in degrees Celsius.""" + """The temperature of the sensor in degrees Celsius.""" # This is just a guess since the starting point (21C here) isn't documented :( temp = self.read_temp_raw() temp = 21.0 + temp/8 From f97265a62983431a7cd26e33536543c62a6509ae Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 10 Mar 2018 10:56:51 -0600 Subject: [PATCH 11/12] updated README; added Travis badge --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index 2b40848..d2eba8f 100644 --- a/README.rst +++ b/README.rst @@ -10,6 +10,10 @@ Introduction :target: https://discord.gg/nBQh6qu :alt: Discord +.. image:: https://travis-ci.org/adafruit/Adafruit_CircuitPython_LSM9DS0.svg?branch=master + :target: https://travis-ci.org/adafruit/Adafruit_CircuitPython_LSM9DS0 + :alt: Build Status + CircuitPython module for the LSM9DS0 accelerometer, magnetometer, gyroscope. Dependencies From c3fc3cdc6e819dbe1a5c1ec43ea94b9cb03b74f1 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Sat, 10 Mar 2018 10:57:28 -0600 Subject: [PATCH 12/12] updated conf.py; bus device intersphinx link --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index c6a8630..fd7b010 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ # autodoc module docs will fail to generate with a warning. autodoc_mock_imports = ["adafruit_bus_device", "micropython"] -intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} +intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates']