|
1 |
| -# SPDX-FileCopyrightText: 2018 Dean Miller for Adafruit Industries |
| 1 | +# SPDX-FileCopyrightText: 2021 Dean Miller for Adafruit Industries |
2 | 2 | #
|
3 | 3 | # SPDX-License-Identifier: MIT
|
4 | 4 |
|
5 | 5 | """
|
6 | 6 | ``adafruit_neotrellis``
|
7 | 7 | ====================================================
|
8 | 8 |
|
9 |
| -4x4 elastomer buttons and RGB LEDs |
| 9 | +A CircuitPython driver class for the 4x4 NeoTrellis with elastomer buttons and |
| 10 | +NeoPixel RGB LEDs. |
10 | 11 |
|
11 | 12 | * Author(s): Dean Miller, JG for CedarGroveMakerStudios
|
12 | 13 |
|
|
15 | 16 |
|
16 | 17 | **Hardware:**
|
17 | 18 |
|
| 19 | +* 'NeoTrellis RGB Driver PCB for 4x4 Keypad, PID: 3954 |
| 20 | + <https://www.adafruit.com/product/3954>' |
| 21 | +
|
18 | 22 | **Software and Dependencies:**
|
19 | 23 |
|
20 | 24 | * Adafruit CircuitPython firmware for the supported boards:
|
|
24 | 28 | https://github.com/adafruit/Adafruit_CircuitPython_seesaw/releases
|
25 | 29 | """
|
26 | 30 |
|
27 |
| -# imports |
28 |
| - |
29 |
| -__version__ = "1.1.8" |
| 31 | +__version__ = "0.0.0-auto.0" |
30 | 32 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_neotrellis.git"
|
31 | 33 |
|
32 | 34 | from time import sleep
|
@@ -54,14 +56,26 @@ def _seesaw_key(xval):
|
54 | 56 |
|
55 | 57 |
|
56 | 58 | class NeoTrellis(Keypad):
|
57 |
| - """Driver for the Adafruit NeoTrellis.""" |
58 |
| - |
59 |
| - def __init__(self, i2c_bus, interrupt=False, addr=_NEO_TRELLIS_ADDR, drdy=None, brightness=1.0): |
| 59 | + """Driver for the Adafruit 4x4 NeoTrellis.""" |
| 60 | + |
| 61 | + def __init__( |
| 62 | + self, |
| 63 | + i2c_bus, |
| 64 | + interrupt=False, |
| 65 | + addr=_NEO_TRELLIS_ADDR, |
| 66 | + drdy=None, |
| 67 | + brightness=1.0, |
| 68 | + ): |
60 | 69 | super().__init__(i2c_bus, addr, drdy)
|
61 | 70 | self.interrupt_enabled = interrupt
|
62 | 71 | self._brightness = brightness
|
63 | 72 | self.callbacks = [None] * _NEO_TRELLIS_NUM_KEYS
|
64 |
| - self.pixels = NeoPixel(self, _NEO_TRELLIS_NEOPIX_PIN, _NEO_TRELLIS_NUM_KEYS, brightness=self._brightness) |
| 73 | + self.pixels = NeoPixel( |
| 74 | + self, |
| 75 | + _NEO_TRELLIS_NEOPIX_PIN, |
| 76 | + _NEO_TRELLIS_NUM_KEYS, |
| 77 | + brightness=self._brightness, |
| 78 | + ) |
65 | 79 |
|
66 | 80 | def activate_key(self, key, edge, enable=True):
|
67 | 81 | """Activate or deactivate a key on the trellis. Key is the key number from
|
@@ -89,9 +103,12 @@ def sync(self):
|
89 | 103 |
|
90 | 104 | @property
|
91 | 105 | def brightness(self):
|
| 106 | + """The NeoPixel brightness level of the board.""" |
92 | 107 | return self._brightness
|
93 | 108 |
|
94 | 109 | @brightness.setter
|
95 | 110 | def brightness(self, new_brightness):
|
| 111 | + """Select a NeoPixel brightness level for the board. A valid brightness |
| 112 | + value is in the range of 0.0 to 1.0.""" |
96 | 113 | self._brightness = new_brightness
|
97 | 114 | self.pixels.brightness = self._brightness
|
0 commit comments