Skip to content

Commit 51a0eb1

Browse files
committed
libs/hardware/matrix_keyboard: Modify key mapping.
The navigation keys are consistent with the direction keys of cardkb. Signed-off-by: lbuque <[email protected]>
1 parent 0f4748b commit 51a0eb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

m5stack/libs/hardware/matrix_keyboard.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ def tick(self) -> None:
4040
self._keys.append(0x08)
4141
elif status.space:
4242
self._keys.append(0x20)
43+
elif status.fn:
44+
if len(status.word) == 0:
45+
return
46+
if status.word[0] == 47: # right
47+
self._keys.append(183)
48+
elif status.word[0] == 44: # left
49+
self._keys.append(180)
50+
elif status.word[0] == 59: # up
51+
self._keys.append(181)
52+
elif status.word[0] == 46: # down
53+
self._keys.append(182)
54+
elif status.word[0] == 96: # ESC
55+
self._keys.append(0x1B)
4356
else:
4457
for word in status.word:
4558
self._keys.append(word)

0 commit comments

Comments
 (0)