track new api

This commit is contained in:
Peter D. Gray 2024-01-26 10:50:52 -05:00
parent 248f5f769b
commit cd8733e5c8
No known key found for this signature in database
GPG Key ID: A2DCD558C2BE5D7C

View File

@ -7,7 +7,7 @@ NUM_COLS = const(10)
class Touch:
# Misnomer: emulating a membrane now, not a touch interface
# Misnomer: emulating a membrane numpad or qwerty keyboard, not a touch interface
# NOTE: doesn't do key repeat well
def __init__(self, *a, **kw):
@ -36,11 +36,12 @@ class Touch:
# - pad with -1
pressed = await s.read(5)
new_presses = set(kn for kn in pressed if kn!=255 and not numpad.is_pressed[kn])
for kn in range(NUM_ROWS * NUM_COLS):
numpad.is_pressed[kn] = (0 if kn not in pressed else 1)
# Q1 simulator sends keynumbers, from shared/charcodes.py
numpad.process_chg_state()
numpad.process_chg_state(new_presses)
else:
# rx's any key that is pressed and now released
key = await s.read(1)