|
36 | 36 | #include "shared-bindings/is31fl3741/IS31FL3741.h"
|
37 | 37 |
|
38 | 38 |
|
39 |
| -//| """Low-level neopixel implementation |
| 39 | +//| """Low-level is31fl3741 implementation |
40 | 40 | //|
|
41 |
| -//| The `neopixel_write` module contains a helper method to write out bytes in |
42 |
| -//| the 800khz neopixel protocol. |
| 41 | +//| The `is31fl3741_write` module contains a helper method to write out bytes in |
| 42 | +//| over the I2C bus. |
43 | 43 | //|
|
44 |
| -//| For example, to turn off a single neopixel (like the status pixel on Express |
45 |
| -//| boards.) |
| 44 | +//| def is31fl3741_write(i2c: busio.I2c, addr: int, mapping: Tuple[int, ...], buf: ReadableBuffer) -> None: |
| 45 | +//| """Write buf out on the given I2C bus. |
46 | 46 | //|
|
47 |
| -//| .. code-block:: python |
48 |
| -//| |
49 |
| -//| import board |
50 |
| -//| import neopixel_write |
51 |
| -//| import digitalio |
52 |
| -//| |
53 |
| -//| pin = digitalio.DigitalInOut(board.NEOPIXEL) |
54 |
| -//| pin.direction = digitalio.Direction.OUTPUT |
55 |
| -//| pixel_off = bytearray([0, 0, 0]) |
56 |
| -//| neopixel_write.neopixel_write(pin, pixel_off)""" |
57 |
| -//| |
58 |
| -//| def neopixel_write(digitalinout: digitalio.DigitalInOut, buf: ReadableBuffer) -> None: |
59 |
| -//| """Write buf out on the given DigitalInOut. |
60 |
| -//| |
61 |
| -//| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with |
| 47 | +//| :param ~busio.I2C i2c: the I2C bus to output with |
| 48 | +//| :param ~int addr: the I2C address of the IS31FL3741 device |
| 49 | +//| :param ~Tuple[int, ...] mapping: map the pixels in the buffer to the order addressed by the driver chip |
62 | 50 | //| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order"""
|
63 | 51 | //| ...
|
64 |
| -// STATIC mp_obj_t is31fl3741_is31fl3741_write(mp_obj_t i2c_obj, mp_obj_t device_addr_obj, mp_obj_t mapping, mp_obj_t buf) { |
65 | 52 | STATIC mp_obj_t is31fl3741_is31fl3741_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
66 | 53 | enum { ARG_i2c, ARG_addr, ARG_mapping, ARG_buffer };
|
67 | 54 | static const mp_arg_t allowed_args[] = {
|
@@ -92,6 +79,12 @@ STATIC mp_obj_t is31fl3741_is31fl3741_write(size_t n_args, const mp_obj_t *pos_a
|
92 | 79 | }
|
93 | 80 | MP_DEFINE_CONST_FUN_OBJ_KW(is31fl3741_is31fl3741_write_obj, 0, is31fl3741_is31fl3741_write);
|
94 | 81 |
|
| 82 | +//| def is31fl3741_init(i2c: busio.I2c, addr: int) -> None: |
| 83 | +//| """Initialize the IS31FL3741 device. |
| 84 | +//| |
| 85 | +//| :param ~busio.I2C i2c: the I2C bus to output with |
| 86 | +//| :param ~int addr: the I2C address of the IS31FL3741 device |
| 87 | +//| ... |
95 | 88 | STATIC mp_obj_t is31fl3741_is31fl3741_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
96 | 89 | enum { ARG_i2c, ARG_addr };
|
97 | 90 | static const mp_arg_t allowed_args[] = {
|
|
0 commit comments