|
29 | 29 | __version__ = "0.0.0-auto.0" |
30 | 30 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_NeoKey.git" |
31 | 31 |
|
32 | | -from time import sleep |
33 | 32 | from micropython import const |
34 | 33 | from adafruit_seesaw.neopixel import NeoPixel |
35 | 34 | from adafruit_seesaw.seesaw import Seesaw |
|
42 | 41 | _NEOKEY1X4_NUM_COLS = const(4) |
43 | 42 | _NEOKEY1X4_NUM_KEYS = const(4) |
44 | 43 |
|
| 44 | + |
45 | 45 | class NeoKey1x4(Seesaw): |
46 | 46 | """Driver for the Adafruit NeoKey 1x4.""" |
47 | 47 |
|
48 | 48 | def __init__(self, i2c_bus, interrupt=False, addr=_NEOKEY1X4_ADDR): |
49 | 49 | super().__init__(i2c_bus, addr) |
50 | 50 | self.interrupt_enabled = interrupt |
51 | | - self.pixels = NeoPixel(self, _NEOKEY1X4_NEOPIX_PIN, |
52 | | - _NEOKEY1X4_NUM_KEYS, brightness=0.2) |
| 51 | + self.pixels = NeoPixel( |
| 52 | + self, _NEOKEY1X4_NEOPIX_PIN, _NEOKEY1X4_NUM_KEYS, brightness=0.2 |
| 53 | + ) |
53 | 54 | # set the pins to inputs, pullups |
54 | 55 | for b in range(4, 8): |
55 | 56 | self.pin_mode(b, self.INPUT_PULLUP) |
56 | 57 |
|
57 | 58 | def __getitem__(self, index): |
58 | 59 | if not isinstance(index, int) or (index < 0) or (index > 3): |
59 | 60 | raise RuntimeError("Index must be 0 thru 3") |
60 | | - return not self.digital_read(index+4) |
| 61 | + return not self.digital_read(index + 4) |
0 commit comments