Skip to content

Commit

Permalink
Merge pull request #10 from kattni/fix-up
Browse files Browse the repository at this point in the history
Update with version info, README
  • Loading branch information
ladyada authored Sep 23, 2019
2 parents 27baaaf + abe726a commit a5f161d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
45 changes: 41 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

Introduction
============

.. image:: https://readthedocs.org/projects/adafruit-circuitpython-fxas21002c/badge/?version=latest
:target: https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/
:alt: Documentation Status

.. image :: https://img.shields.io/discord/327254708534116352.svg
.. image:: https://img.shields.io/discord/327254708534116352.svg
:target: https://discord.gg/nBQh6qu
:alt: Discord

Expand All @@ -27,10 +26,48 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.

Installing from PyPI
=====================
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-fxas21002c/>`_. To install for current user:

.. code-block:: shell
pip3 install adafruit-circuitpython-fxas21002c
To install system-wide (this may be required in some cases):

.. code-block:: shell
sudo pip3 install adafruit-circuitpython-fxas21002c
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-fxas21002c
Usage Example
=============

See examples/simpletest.py for an example 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
============
Expand Down Expand Up @@ -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.
locally verify it will pass.
3 changes: 3 additions & 0 deletions adafruit_fxas21002c.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
except ImportError:
import struct

__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C.git"

import adafruit_bus_device.i2c_device as i2c_dev
from micropython import const

Expand Down

0 comments on commit a5f161d

Please sign in to comment.