|  | 
| 9 | 9 | Driver for the AS726x spectral sensors | 
| 10 | 10 | 
 | 
| 11 | 11 | * Author(s): Dean Miller | 
|  | 12 | +
 | 
|  | 13 | +Implementation Notes | 
|  | 14 | +-------------------- | 
|  | 15 | +
 | 
|  | 16 | +**Hardware:** | 
|  | 17 | +
 | 
|  | 18 | +* Adafruit `AS7262 6-Channel Visible Light / Color Sensor Breakout | 
|  | 19 | +  <https://www.adafruit.com/product/3779>`_ (Product ID: 3779) | 
|  | 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 | +
 | 
| 12 | 28 | """ | 
| 13 | 29 | 
 | 
| 14 | 30 | import time | 
| @@ -281,8 +297,10 @@ def integration_time(self, val): | 
| 281 | 297 |     def start_measurement(self): | 
| 282 | 298 |         """Begin a measurement. | 
| 283 | 299 | 
 | 
| 284 |  | -        This will set the device to One Shot mode and values will not change after `data_ready` | 
| 285 |  | -        until `start_measurement` is called again or the `conversion_mode` is changed.""" | 
|  | 300 | +        This will set the device to One Shot mode and values will | 
|  | 301 | +        not change after `data_ready` until :meth:`start_measurement` | 
|  | 302 | +        is called again or the :meth:`conversion_mode` is changed. | 
|  | 303 | +        """ | 
| 286 | 304 |         state = self._virtual_read(_AS726X_CONTROL_SETUP) | 
| 287 | 305 |         state &= ~(0x02) | 
| 288 | 306 |         self._virtual_write(_AS726X_CONTROL_SETUP, state) | 
| @@ -382,7 +400,39 @@ def _virtual_write(self, addr, value): | 
| 382 | 400 | class AS726x_I2C(AS726x): | 
| 383 | 401 |     """AS726x spectral sensor via I2C. | 
| 384 | 402 | 
 | 
| 385 |  | -    :param ~busio.I2C i2c_bus: The I2C bus connected to the sensor | 
|  | 403 | +    :param ~busio.I2C i2c_bus: The I2C bus the AS726x is connected to | 
|  | 404 | +    :param int address: The I2C device address. Defaults to :const:`0x49` | 
|  | 405 | +
 | 
|  | 406 | +
 | 
|  | 407 | +    **Quickstart: Importing and using the AS726x** | 
|  | 408 | +
 | 
|  | 409 | +        Here is an example of using the :class:`AS726x_I2C` class. | 
|  | 410 | +        First you will need to import the libraries to use the sensor | 
|  | 411 | +
 | 
|  | 412 | +        .. code-block:: python | 
|  | 413 | +
 | 
|  | 414 | +            import board | 
|  | 415 | +            from adafruit_as726x import AS726x_I2C | 
|  | 416 | +
 | 
|  | 417 | +        Once this is done you can define your `board.I2C` object and define your sensor object | 
|  | 418 | +
 | 
|  | 419 | +        .. code-block:: python | 
|  | 420 | +
 | 
|  | 421 | +            i2c = board.I2C()  # uses board.SCL and board.SDA | 
|  | 422 | +            sensor = AS726x_I2C(i2c) | 
|  | 423 | +
 | 
|  | 424 | +        Now you have access to the different color attributes | 
|  | 425 | +
 | 
|  | 426 | +        .. code-block:: python | 
|  | 427 | +
 | 
|  | 428 | +            violet = sensor.violet | 
|  | 429 | +            blue = sensor.blue | 
|  | 430 | +            green = sensor.green | 
|  | 431 | +            yellow = sensor.yellow | 
|  | 432 | +            orange = sensor.orange | 
|  | 433 | +            red = sensor.red | 
|  | 434 | +
 | 
|  | 435 | +
 | 
| 386 | 436 |     """ | 
| 387 | 437 | 
 | 
| 388 | 438 |     def __init__(self, i2c_bus, address=_AS726X_ADDRESS): | 
| @@ -449,6 +499,37 @@ class AS726x_UART(AS726x): | 
| 449 | 499 |     """AS726x spectral sensor via UART. | 
| 450 | 500 | 
 | 
| 451 | 501 |     :param ~busio.UART uart: The UART connected to the sensor | 
|  | 502 | +
 | 
|  | 503 | +
 | 
|  | 504 | +    **Quickstart: Importing and using the AS726x** | 
|  | 505 | +
 | 
|  | 506 | +        Here is an example of using the :class:`AS726x_I2C` class. | 
|  | 507 | +        First you will need to import the libraries to use the sensor | 
|  | 508 | +
 | 
|  | 509 | +        .. code-block:: python | 
|  | 510 | +
 | 
|  | 511 | +            import board | 
|  | 512 | +            from adafruit_as726x import AS726x_UART | 
|  | 513 | +
 | 
|  | 514 | +        Once this is done you can define your `board.UART` object and define your sensor object | 
|  | 515 | +
 | 
|  | 516 | +        .. code-block:: python | 
|  | 517 | +
 | 
|  | 518 | +            uart = board.UART()  # uses board.SCL and board.SDA | 
|  | 519 | +            sensor = AS726x_UART(uart) | 
|  | 520 | +
 | 
|  | 521 | +        Now you have access to the different color attributes | 
|  | 522 | +
 | 
|  | 523 | +        .. code-block:: python | 
|  | 524 | +
 | 
|  | 525 | +            violet = sensor.violet | 
|  | 526 | +            blue = sensor.blue | 
|  | 527 | +            green = sensor.green | 
|  | 528 | +            yellow = sensor.yellow | 
|  | 529 | +            orange = sensor.orange | 
|  | 530 | +            red = sensor.red | 
|  | 531 | +
 | 
|  | 532 | +
 | 
| 452 | 533 |     """ | 
| 453 | 534 | 
 | 
| 454 | 535 |     def __init__(self, uart): | 
|  | 
0 commit comments