From 170c9a7884ac711d3825942adbc76d7ecdd8b8c3 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Sep 2019 17:50:09 -0400 Subject: [PATCH 1/2] Update with version info, README --- README.rst | 41 +++++++++++++++++++++++++++++++++++++++-- adafruit_fxos8700.py | 3 +++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2480daf..725b0e0 100644 --- a/README.rst +++ b/README.rst @@ -27,10 +27,47 @@ Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading `the Adafruit library and driver bundle `_. +Installing from PyPI +===================== +On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from +PyPI `_. To install for current user: + +.. code-block:: shell + + pip3 install adafruit-circuitpython-fxos8700 + +To install system-wide (this may be required in some cases): + +.. code-block:: shell + + sudo pip3 install adafruit-circuitpython-fxos8700 + +To install in a virtual environment in your current project: + +.. code-block:: shell + + mkdir project-name && cd project-name + python3 -m venv .env + source .env/bin/activate + pip3 install adafruit-circuitpython-fxos8700 + Usage Example ============= -See examples/simpletest.py for a demo of the usage. +.. code-block:: python + + import time + import board + import busio + import adafruit_fxas21002c + + i2c = busio.I2C(board.SCL, board.SDA) + sensor = adafruit_fxas21002c.FXAS21002C(i2c) + + while True: + gyro_x, gyro_y, gyro_z = sensor.gyroscope + print('Gyroscope (radians/s): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(gyro_x, gyro_y, gyro_z)) + time.sleep(1.0) Contributing ============ @@ -84,4 +121,4 @@ Now, once you have the virtual environment activated: 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 +locally verify it will pass diff --git a/adafruit_fxos8700.py b/adafruit_fxos8700.py index 413158c..d67b16c 100644 --- a/adafruit_fxos8700.py +++ b/adafruit_fxos8700.py @@ -53,6 +53,9 @@ import adafruit_bus_device.i2c_device as i2c_dev from micropython import const +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700.git" + # Register addresses and other constants: # pylint: disable=bad-whitespace _FXOS8700_ADDRESS = const(0x1F) # 0011111 From 397bae52e2a9d8abfa96e2d92d2b2aa61d1fb6c0 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Sep 2019 17:51:59 -0400 Subject: [PATCH 2/2] Update example --- README.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 725b0e0..d43b7de 100644 --- a/README.rst +++ b/README.rst @@ -59,14 +59,16 @@ Usage Example import time import board import busio - import adafruit_fxas21002c + import adafruit_fxos8700 i2c = busio.I2C(board.SCL, board.SDA) - sensor = adafruit_fxas21002c.FXAS21002C(i2c) + sensor = adafruit_fxos8700.FXOS8700(i2c) while True: - gyro_x, gyro_y, gyro_z = sensor.gyroscope - print('Gyroscope (radians/s): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(gyro_x, gyro_y, gyro_z)) + accel_x, accel_y, accel_z = sensor.accelerometer + mag_x, mag_y, mag_z = sensor.magnetometer + print('Acceleration (m/s^2): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(accel_x, accel_y, accel_z)) + print('Magnetometer (uTesla): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(mag_x, mag_y, mag_z)) time.sleep(1.0) Contributing