Skip to content

Commit

Permalink
Add time delay for init
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeharker committed Oct 29, 2024
1 parent e3747a7 commit 63cd7f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion adafruit_neotrellis/neotrellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
_NEO_TRELLIS_NUM_COLS = const(8)
_NEO_TRELLIS_NUM_KEYS = const(64)

SYNC_DELAY = const(0.0005)
INIT_DELAY = const(0.0005)

CallbackType: TypeAlias = Callable[[KeyEvent], None]

Expand Down Expand Up @@ -93,6 +95,7 @@ def __init__(self, i2c_bus, interrupt: bool = False,
self.interrupt_enabled = interrupt
self.callbacks = [None] * _NEO_TRELLIS_NUM_KEYS
self.pixels = NeoPixel(self, _NEO_TRELLIS_NEOPIX_PIN, self.width * self.height)
sleep(INIT_DELAY)

def activate_key(self, key: int, edge: int, enable: bool = True) -> None:
"""Activate or deactivate a key on the trellis. Key is the key number from
Expand All @@ -112,7 +115,7 @@ def sync(self) -> None:
"""read any events from the Trellis hardware and call associated
callbacks"""
available = self.count
sleep(0.0005) # FIXME: resolve
sleep(SYNC_DELAY) # FIXME: resolve
if available > 0:
buf = self.read_keypad(available)
for r in buf:
Expand Down

0 comments on commit 63cd7f6

Please sign in to comment.