Skip to content

Commit

Permalink
mypy improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeharker committed Oct 25, 2024
1 parent e8eca21 commit b6aa649
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions adafruit_neotrellis/multitrellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def set_callback(self, x: int, y: int, function: CallbackType):
pad = self._key_pads[y][x]
pad.callbacks[pad.key_index(x, y)] = function


def get_callback(self, x: int, y: int) -> Optional[CallbackType]:
"""Get a callback function for when an event for the key at index x, y
(measured from the top lefthand corner) is detected."""
pad = self._key_pads[y][x]
return pad.callbacks[pad.key_index(x, y)]

def color(self, x: int, y: int, color: PixelType):
"""Set the color of the pixel at index x, y measured from the top
lefthand corner of the matrix"""
Expand Down
2 changes: 1 addition & 1 deletion adafruit_neotrellis/neotrellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, i2c_bus, interrupt=False,
self.callbacks = [None] * _NEO_TRELLIS_NUM_KEYS
self.pixels = NeoPixel(self, _NEO_TRELLIS_NEOPIX_PIN, _NEO_TRELLIS_NUM_KEYS)

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

0 comments on commit b6aa649

Please sign in to comment.