mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
embed: add confirm/cancel actions to touch events
This commit is contained in:
parent
e3607156d8
commit
01a876f486
@ -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);
|
||||
|
@ -22,9 +22,11 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#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);
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user