diff --git a/embed/extmod/modtrezorio/modtrezorio.c b/embed/extmod/modtrezorio/modtrezorio.c index 1384a2c85a..2c9fb893a7 100644 --- a/embed/extmod/modtrezorio/modtrezorio.c +++ b/embed/extmod/modtrezorio/modtrezorio.c @@ -54,8 +54,10 @@ STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TOUCH), MP_OBJ_NEW_SMALL_INT(TOUCH_IFACE) }, { MP_ROM_QSTR(MP_QSTR_TOUCH_START), MP_OBJ_NEW_SMALL_INT((TOUCH_START >> 24) & 0xFFU) }, - { MP_ROM_QSTR(MP_QSTR_TOUCH_MOVE), MP_OBJ_NEW_SMALL_INT((TOUCH_MOVE >> 24) & 0xFFU) }, - { MP_ROM_QSTR(MP_QSTR_TOUCH_END), MP_OBJ_NEW_SMALL_INT((TOUCH_END >> 24) & 0xFFU) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_MOVE), MP_OBJ_NEW_SMALL_INT((TOUCH_MOVE >> 24) & 0xFFU) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_END), MP_OBJ_NEW_SMALL_INT((TOUCH_END >> 24) & 0xFFU) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_CONFIRM), MP_OBJ_NEW_SMALL_INT((TOUCH_CONFIRM >> 24) & 0xFFU) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_CANCEL), MP_OBJ_NEW_SMALL_INT((TOUCH_CANCEL >> 24) & 0xFFU) }, }; STATIC MP_DEFINE_CONST_DICT(mp_module_trezorio_globals, mp_module_trezorio_globals_table); diff --git a/embed/trezorhal/touch.h b/embed/trezorhal/touch.h index 1ac716e133..e1930d67bd 100644 --- a/embed/trezorhal/touch.h +++ b/embed/trezorhal/touch.h @@ -22,9 +22,11 @@ #include -#define TOUCH_START (1U << 24) -#define TOUCH_MOVE (2U << 24) -#define TOUCH_END (4U << 24) +#define TOUCH_START (1U << 24) +#define TOUCH_MOVE (1U << 25) +#define TOUCH_END (1U << 26) +#define TOUCH_CONFIRM (1U << 27) +#define TOUCH_CANCEL (1U << 28) void touch_init(void); void touch_power_on(void); diff --git a/embed/unix/touch.c b/embed/unix/touch.c index f01c3f1e3a..f061ee5884 100644 --- a/embed/unix/touch.c +++ b/embed/unix/touch.c @@ -67,11 +67,17 @@ uint32_t touch_read(void) } break; case SDL_KEYUP: - if (event.key.keysym.sym == SDLK_ESCAPE) { - __shutdown(); - } - if (event.key.keysym.sym == SDLK_p) { - display_save("emu"); + switch (event.key.keysym.sym) { + case SDLK_ESCAPE: + __shutdown(); + break; + case SDLK_p: + display_save("emu"); + break; + case SDLK_RIGHT: + return TOUCH_CONFIRM; + case SDLK_LEFT: + return TOUCH_CANCEL; } break; case SDL_QUIT: