Skip to content

Commit 1504223

Browse files
Fri3d Communicator Keyboard: handle ESCAPE and arrows
1 parent 518e8b2 commit 1504223

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

internal_filesystem/lib/drivers/indev/fri3d_communicator_keyboard.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import lvgl as lv
22
import keypad_framework
33

4+
import mpos.ui
5+
import mpos.ui.focus_direction
6+
47

58
_MOD_LSHIFT = 0x02
69
_MOD_RSHIFT = 0x20
@@ -121,5 +124,17 @@ def _poll(self):
121124
def _get_key(self):
122125
self._poll()
123126
if self._queue:
124-
return self._queue.pop(0)
127+
state, key = self._queue.pop(0)
128+
if state == self.PRESSED:
129+
if key == lv.KEY.ESC:
130+
mpos.ui.back_screen()
131+
elif key == lv.KEY.RIGHT:
132+
mpos.ui.focus_direction.move_focus_direction(90)
133+
elif key == lv.KEY.LEFT:
134+
mpos.ui.focus_direction.move_focus_direction(270)
135+
elif key == lv.KEY.UP:
136+
mpos.ui.focus_direction.move_focus_direction(0)
137+
elif key == lv.KEY.DOWN:
138+
mpos.ui.focus_direction.move_focus_direction(180)
139+
return state, key
125140
return None

0 commit comments

Comments
 (0)