|
21 | 21 | **Software and Dependencies:**
|
22 | 22 |
|
23 | 23 | * Adafruit CircuitPython firmware for the supported boards:
|
24 |
| - https://github.com/adafruit/circuitpython/releases |
25 |
| -
|
| 24 | + https://circuitpython.org/downloads |
26 | 25 | * Adafruit's Bus Device library:
|
27 | 26 | https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
| 27 | +* Adafruit's Register library: |
| 28 | + https://github.com/adafruit/Adafruit_CircuitPython_Register |
28 | 29 |
|
29 | 30 | """
|
30 | 31 |
|
|
162 | 163 | class MLX90393: # pylint: disable=too-many-instance-attributes
|
163 | 164 | """
|
164 | 165 | Driver for the MLX90393 magnetometer.
|
165 |
| - :param i2c_bus: The `busio.I2C` object to use. This is the only |
166 |
| - required parameter. |
167 |
| - :param int address: (optional) The I2C address of the device. |
168 |
| - :param int gain: (optional) The gain level to apply. |
169 |
| - :param bool debug: (optional) Enable debug output. |
| 166 | +
|
| 167 | + :param i2c_bus: The I2C bus the device is connected to |
| 168 | + :param int address: The I2C device address. Defaults to :const:`0x0C` |
| 169 | + :param int gain: The gain level to apply. Defaults to :const:`GAIN_1X` |
| 170 | + :param bool debug: Enable debug output. Defaults to `False` |
| 171 | +
|
| 172 | +
|
| 173 | + **Quickstart: Importing and using the device** |
| 174 | +
|
| 175 | + Here is an example of using the :class:`MLX90393` class. |
| 176 | + First you will need to import the libraries to use the sensor |
| 177 | +
|
| 178 | + .. code-block:: python |
| 179 | +
|
| 180 | + import board |
| 181 | + import adafruit_mlx90393 |
| 182 | +
|
| 183 | + Once this is done you can define your `board.I2C` object and define your sensor object |
| 184 | +
|
| 185 | + .. code-block:: python |
| 186 | +
|
| 187 | + i2c = board.I2C() # uses board.SCL and board.SDA |
| 188 | + SENSOR = adafruit_mlx90393.MLX90393(i2c) |
| 189 | +
|
| 190 | + Now you have access to the :attr:`magnetic` attribute |
| 191 | +
|
| 192 | + .. code-block:: python |
| 193 | +
|
| 194 | + MX, MY, MZ = SENSOR.magnetic |
| 195 | +
|
170 | 196 | """
|
171 | 197 |
|
172 | 198 | def __init__(
|
@@ -208,8 +234,10 @@ def _transceive(self, payload, rxlen=0):
|
208 | 234 | """
|
209 | 235 | Writes the specified 'payload' to the sensor
|
210 | 236 | Returns the results of the write attempt.
|
211 |
| - :param bytearray payload: The byte array to write to the sensor |
212 |
| - :param rxlen: (optional) The numbers of bytes to read back (default=0) |
| 237 | +
|
| 238 | + :param bytes payload: The byte array to write to the sensor |
| 239 | + :param int rxlen: numbers of bytes to read back. Defaults to :const:`0` |
| 240 | +
|
213 | 241 | """
|
214 | 242 | # Read the response (+1 to account for the mandatory status byte!)
|
215 | 243 | data = bytearray(rxlen + 1)
|
@@ -351,7 +379,7 @@ def oversampling(self, level):
|
351 | 379 |
|
352 | 380 | def display_status(self):
|
353 | 381 | """
|
354 |
| - Prints out the content of the last status byte in a human-readble |
| 382 | + Prints out the content of the last status byte in a human-readable |
355 | 383 | format.
|
356 | 384 | """
|
357 | 385 | avail = 0
|
|
0 commit comments