3131
3232from typing import List , Sequence
3333
34- from adafruit_neotrellis .neotrellis import NeoTrellis
34+ from adafruit_neotrellis .neotrellis import CallbackType , NeoTrellis
35+ from adafruit_seesaw .neopixel import PixelType
3536
3637
3738class MultiTrellis :
@@ -42,7 +43,7 @@ class MultiTrellis:
4243 _cols : int
4344 _key_pads : List [List [NeoTrellis ]]
4445
45- def __init__ (self , neotrellis_array ):
46+ def __init__ (self , neotrellis_array : List [ List [ NeoTrellis ]] ):
4647 self ._trelli = neotrellis_array
4748 self ._rows = len (neotrellis_array )
4849 self ._cols = len (neotrellis_array [0 ])
@@ -107,7 +108,7 @@ def __getitem__(self, subscript: int) -> Sequence[NeoTrellis]:
107108 def get_keypad (self , x : int , y : int ) -> NeoTrellis :
108109 return self ._key_pads [y ][x ]
109110
110- def activate_key (self , x , y , edge , enable = True ):
111+ def activate_key (self , x : int , y : int , edge : int , enable : bool = True ):
111112 """Activate or deactivate a key on the trellis. x and y are the index
112113 of the key measured from the top lefthand corner. Edge specifies what
113114 edge to register an event on and can be NeoTrellis.EDGE_FALLING or
@@ -116,13 +117,13 @@ def activate_key(self, x, y, edge, enable=True):
116117 pad = self ._key_pads [y ][x ]
117118 pad .activate_key (pad .key_index (x , y ), enable )
118119
119- def set_callback (self , x , y , function ):
120+ def set_callback (self , x : int , y : int , function : CallbackType ):
120121 """Set a callback function for when an event for the key at index x, y
121122 (measured from the top lefthand corner) is detected."""
122123 pad = self ._key_pads [y ][x ]
123124 pad .callbacks [pad .key_index (x , y )] = function
124125
125- def color (self , x , y , color ):
126+ def color (self , x : int , y : int , color : PixelType ):
126127 """Set the color of the pixel at index x, y measured from the top
127128 lefthand corner of the matrix"""
128129 pad = self ._key_pads [y ][x ]
@@ -137,7 +138,7 @@ def data_pending(self) -> bool:
137138 return True
138139 return False
139140
140- def sync (self ):
141+ def sync (self ) -> None :
141142 """Read all trellis boards in the matrix and call any callbacks"""
142143 for py in range (self ._rows ):
143144 for px in range (self ._cols ):
0 commit comments