1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 17:38:39 +00:00

modtrezormsg: cleanup touch methods

This commit is contained in:
Pavol Rusnak 2017-02-22 15:19:25 +01:00
parent f443407fae
commit c50943bbf0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 9 additions and 8 deletions

View File

@ -31,8 +31,7 @@ ssize_t msg_send(uint8_t iface, const uint8_t *buf, size_t len)
return len; return len;
} }
// this should match values used in trezorui_poll_sdl_event() in modtrezorui/display-unix.h uint32_t msg_poll_touch(void)
uint32_t msg_poll_ui_event(void)
{ {
return touch_event(); return touch_read();
} }

View File

@ -68,7 +68,9 @@ ssize_t msg_send(uint8_t iface, const uint8_t *buf, size_t len)
return r; return r;
} }
// from modtrezorui: extern uint32_t trezorui_poll_event(void);
uint32_t trezorui_poll_event(void);
#define msg_poll_ui_event trezorui_poll_event uint32_t msg_poll_touch(void)
{
return trezorui_poll_event();
}

View File

@ -119,7 +119,7 @@ STATIC mp_obj_t mod_TrezorMsg_Msg_select(mp_obj_t self, mp_obj_t timeout_us) {
timeout = 0; timeout = 0;
} }
for(;;) { for(;;) {
uint32_t e = msg_poll_ui_event(); uint32_t e = msg_poll_touch();
if (e) { if (e) {
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(4, NULL)); mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(4, NULL));
tuple->items[0] = MP_OBJ_NEW_SMALL_INT(TOUCH_IFACE); tuple->items[0] = MP_OBJ_NEW_SMALL_INT(TOUCH_IFACE);

View File

@ -16,7 +16,7 @@ void touch_init(void)
i2c_init(&I2CHandle1); i2c_init(&I2CHandle1);
} }
uint32_t touch_event(void) uint32_t touch_read(void)
{ {
static uint8_t data[16], old_data[16]; static uint8_t data[16], old_data[16];
if (HAL_OK != HAL_I2C_Master_Receive(&I2CHandle1, 56 << 1, data, 16, 1)) { if (HAL_OK != HAL_I2C_Master_Receive(&I2CHandle1, 56 << 1, data, 16, 1)) {