Skip to content

Commit b6aa649

Browse files
committed
mypy improvements
1 parent e8eca21 commit b6aa649

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

adafruit_neotrellis/multitrellis.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ def set_callback(self, x: int, y: int, function: CallbackType):
123123
pad = self._key_pads[y][x]
124124
pad.callbacks[pad.key_index(x, y)] = function
125125

126+
127+
def get_callback(self, x: int, y: int) -> Optional[CallbackType]:
128+
"""Get a callback function for when an event for the key at index x, y
129+
(measured from the top lefthand corner) is detected."""
130+
pad = self._key_pads[y][x]
131+
return pad.callbacks[pad.key_index(x, y)]
132+
126133
def color(self, x: int, y: int, color: PixelType):
127134
"""Set the color of the pixel at index x, y measured from the top
128135
lefthand corner of the matrix"""

adafruit_neotrellis/neotrellis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, i2c_bus, interrupt=False,
9191
self.callbacks = [None] * _NEO_TRELLIS_NUM_KEYS
9292
self.pixels = NeoPixel(self, _NEO_TRELLIS_NEOPIX_PIN, _NEO_TRELLIS_NUM_KEYS)
9393

94-
def activate_key(self, key, edge, enable=True):
94+
def activate_key(self, key: int, edge: int, enable: bool = True):
9595
"""Activate or deactivate a key on the trellis. Key is the key number from
9696
0 to 16. Edge specifies what edge to register an event on and can be
9797
NeoTrellis.EDGE_FALLING or NeoTrellis.EDGE_RISING. enable should be set

0 commit comments

Comments
 (0)