/ README.rst
README.rst
1 Introduction 2 ============ 3 4 .. image:: https://readthedocs.org/projects/adafruit-circuitpython-debug_i2c/badge/?version=latest 5 :target: https://circuitpython.readthedocs.io/projects/debug_i2c/en/latest/ 6 :alt: Documentation Status 7 8 .. image:: https://img.shields.io/discord/327254708534116352.svg 9 :target: https://adafru.it/discord 10 :alt: Discord 11 12 .. image:: https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C/workflows/Build%20CI/badge.svg 13 :target: https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C/actions 14 :alt: Build Status 15 16 Wrapper library for debugging I2C. 17 18 19 Dependencies 20 ============= 21 This driver depends on: 22 23 * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_ 24 25 Please ensure all dependencies are available on the CircuitPython filesystem. 26 This is easily achieved by downloading 27 `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_. 28 29 Usage Example 30 ============= 31 32 This example uses the LIS3DH accelerometer. This lib can be used with any I2C device. Save 33 the code to your board. 34 35 .. code-block:: python 36 37 import adafruit_lis3dh 38 from adafruit_debug_i2c import DebugI2C 39 import busio 40 import board 41 import digitalio 42 43 i2c = DebugI2C(busio.I2C(board.SCL, board.SDA)) 44 int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT) 45 accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1) 46 47 print(accelerometer.acceleration) 48 49 for i in range(2): 50 print(accelerometer.acceleration) 51 52 53 Contributing 54 ============ 55 56 Contributions are welcome! Please read our `Code of Conduct 57 <https://github.com/adafruit/Adafruit_CircuitPython_Debug_I2C/blob/master/CODE_OF_CONDUCT.md>`_ 58 before contributing to help this project stay welcoming. 59 60 Building locally 61 ================ 62 63 Zip release files 64 ----------------- 65 66 To build this library locally you'll need to install the 67 `circuitpython-build-tools <https://github.com/adafruit/circuitpython-build-tools>`_ package. 68 69 .. code-block:: shell 70 71 python3 -m venv .env 72 source .env/bin/activate 73 pip install circuitpython-build-tools 74 75 Once installed, make sure you are in the virtual environment: 76 77 .. code-block:: shell 78 79 source .env/bin/activate 80 81 Then run the build: 82 83 .. code-block:: shell 84 85 circuitpython-build-bundles --filename_prefix adafruit-circuitpython-debug_i2c --library_location . 86 87 Sphinx documentation 88 ----------------------- 89 90 Sphinx is used to build the documentation based on rST files and comments in the code. First, 91 install dependencies (feel free to reuse the virtual environment from above): 92 93 .. code-block:: shell 94 95 python3 -m venv .env 96 source .env/bin/activate 97 pip install Sphinx sphinx-rtd-theme 98 99 Now, once you have the virtual environment activated: 100 101 .. code-block:: shell 102 103 cd docs 104 sphinx-build -E -W -b html . _build/html 105 106 This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to 107 view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to 108 locally verify it will pass.