Skip to content

Commit b6fa050

Browse files
authored
Merge pull request #81 from jposada202020/improving_docs
improving_docs
2 parents 2f1ef83 + 9f48cfd commit b6fa050

File tree

5 files changed

+74
-21
lines changed

5 files changed

+74
-21
lines changed

README.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,33 +54,31 @@ Usage Notes
5454

5555
Of course, you must import the library to use it:
5656

57-
.. code:: python
57+
.. code:: python3
5858
5959
import adafruit_bno055
6060
6161
62-
This driver takes an instantiated and active I2C object (from the `busio` or
63-
the `bitbangio` library) as an argument to its constructor. The way to create
64-
an I2C object depends on the board you are using. For boards with labeled SCL
65-
and SDA pins, you can:
62+
This driver takes an instantiated and active I2C object as an argument to its
63+
constructor. The way to create an I2C object depends on the board you are
64+
using. For boards with labeled SCL and SDA pins, you can:
6665

67-
.. code:: python
66+
.. code:: python3
6867
69-
from busio import I2C
70-
from board import SDA, SCL
68+
import board
7169
72-
i2c = I2C(SCL, SDA)
70+
i2c = board.I2C()
7371
7472
Once you have the I2C object, you can create the sensor object:
7573

76-
.. code:: python
74+
.. code:: python3
7775
7876
sensor = adafruit_bno055.BNO055_I2C(i2c)
7977
8078
8179
And then you can start reading the measurements:
8280

83-
.. code:: python
81+
.. code:: python3
8482
8583
print(sensor.temperature)
8684
print(sensor.euler)

adafruit_bno055.py

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,30 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
``adafruit_bno055`` - Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055
6+
`adafruit_bno055`
77
=======================================================================================
88
99
This is a CircuitPython driver for the Bosch BNO055 nine degree of freedom
1010
inertial measurement unit module with sensor fusion.
1111
1212
* Author(s): Radomir Dopieralski
13+
14+
15+
**Hardware:**
16+
17+
* Adafruit `9-DOF Absolute Orientation IMU Fusion Breakout - BNO055
18+
<https://www.adafruit.com/product/4646>`_ (Product ID: 4646)
19+
20+
21+
**Software and Dependencies:**
22+
23+
* Adafruit CircuitPython firmware for the supported boards:
24+
https://circuitpython.org/downloads
25+
26+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
27+
28+
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
29+
1330
"""
1431
import time
1532
import struct
@@ -164,6 +181,31 @@ def __set__(self, obj, value):
164181
class BNO055: # pylint: disable=too-many-public-methods
165182
"""
166183
Base class for the BNO055 9DOF IMU sensor.
184+
185+
**Quickstart: Importing and using the device**
186+
187+
Here is an example of using the :class:`BNO055` class.
188+
First you will need to import the libraries to use the sensor
189+
190+
.. code-block:: python
191+
192+
import board
193+
import adafruit_bno055
194+
195+
Once this is done you can define your `board.I2C` object and define your sensor object
196+
197+
.. code-block:: python
198+
199+
i2c = board.I2C() # uses board.SCL and board.SDA
200+
sensor = adafruit_bno055.BNO055_I2C(i2c)
201+
202+
203+
Now you have access to the :attr:`acceleration` attribute among others
204+
205+
.. code-block:: python
206+
207+
sensor = accelerometer.acceleration
208+
167209
"""
168210

169211
def __init__(self):
@@ -227,11 +269,11 @@ def mode(self):
227269
| NDOF_MODE | X | X | X | X | - |
228270
+------------------+-------+---------+------+----------+----------+
229271
230-
The default mode is ``NDOF_MODE``.
272+
The default mode is :const:`NDOF_MODE`.
231273
232274
| You can set the mode using the line below:
233275
| ``sensor.mode = adafruit_bno055.ACCONLY_MODE``
234-
| replacing ``ACCONLY_MODE`` with the mode you want to use
276+
| replacing :const:`ACCONLY_MODE` with the mode you want to use
235277
236278
.. data:: CONFIG_MODE
237279
@@ -662,7 +704,7 @@ def axis_remap(self):
662704

663705
@axis_remap.setter
664706
def axis_remap(self, remap):
665-
"""Pass a tuple coinsidting of x, y, z, x_sign, y-sign, and z_sign.
707+
"""Pass a tuple consisting of x, y, z, x_sign, y-sign, and z_sign.
666708
667709
Set axis remap for each axis. The x, y, z parameter values should
668710
be set to one of AXIS_REMAP_X (0x00), AXIS_REMAP_Y (0x01), or

docs/examples.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,15 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/bno055_simpletest.py
77
:caption: examples/bno055_simpletest.py
88
:linenos:
9+
10+
11+
Raspberry PI I2C GPIO Simpletest
12+
--------------------------------
13+
14+
This example demonstrates how to instantiate the
15+
Adafruit BNO055 Sensor using this library and just
16+
the I2C bus number.
17+
18+
.. literalinclude:: ../examples/bno055_i2c-gpio_simpletest.py
19+
:caption: examples/bno055_i2c-gpio_simpletest.py
20+
:linenos:

docs/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 Learning Guide <https://learn.adafruit.com/adafruit-bno055-absolute-orientation-sensor/overview>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

29-
Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 <https://www.adafruit.com/product/2472>
31+
Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 <https://www.adafruit.com/product/4646>
3032

3133
.. toctree::
3234
:caption: Other Links

examples/bno055_simpletest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
import time
55
import board
6-
import busio
76
import adafruit_bno055
87

9-
# Use these lines for I2C
10-
i2c = busio.I2C(board.SCL, board.SDA)
8+
9+
i2c = board.I2C()
1110
sensor = adafruit_bno055.BNO055_I2C(i2c)
1211

13-
# User these lines for UART
14-
# uart = busio.UART(board.TX, board.RX)
12+
# If you are going to use UART uncomment these lines
13+
# uart = board.UART()
1514
# sensor = adafruit_bno055.BNO055_UART(uart)
1615

1716
last_val = 0xFFFF

0 commit comments

Comments
 (0)