Skip to content

touch_keypad

touch_keypad

touch_keypad

Matrix keypad helper for touch displays on displaysys.

Divides the display into a grid of rows and columns. Returns the key number of the associated cell pressed.

Also passes through the key from any KEYDOWN events from the display.

Usage: from touch_keypad import Keypad from board_config import display_drv, broker

keys = [1, 2, 3, "A", "B", "C", "play", "pause", "esc"] keypad = Keypad(broker.poll, 0, 0, display_drv.width, display_drv.height, cols=3, rows=3, keys=keys) while True: broker.poll() if keys := keypad.read(): print(keys) # For held-key polling (e.g. continuous movement), use keypad.read_held()

Classes

Keypad

Keypad(broker, x, y, w, h, cols=3, rows=3, keys=None, translate=None)
Methods:
read
read()

Return keys pressed since the last read() (edge triggered).

read_held
read_held()

Return keys currently held down (level triggered).