mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-12 18:49:07 +00:00
modtrezormsg: cleanup touch methods
This commit is contained in:
parent
f443407fae
commit
c50943bbf0
@ -31,8 +31,7 @@ ssize_t msg_send(uint8_t iface, const uint8_t *buf, size_t len)
|
||||
return len;
|
||||
}
|
||||
|
||||
// this should match values used in trezorui_poll_sdl_event() in modtrezorui/display-unix.h
|
||||
uint32_t msg_poll_ui_event(void)
|
||||
uint32_t msg_poll_touch(void)
|
||||
{
|
||||
return touch_event();
|
||||
return touch_read();
|
||||
}
|
||||
|
@ -68,7 +68,9 @@ ssize_t msg_send(uint8_t iface, const uint8_t *buf, size_t len)
|
||||
return r;
|
||||
}
|
||||
|
||||
// from modtrezorui:
|
||||
uint32_t trezorui_poll_event(void);
|
||||
extern uint32_t trezorui_poll_event(void);
|
||||
|
||||
#define msg_poll_ui_event trezorui_poll_event
|
||||
uint32_t msg_poll_touch(void)
|
||||
{
|
||||
return trezorui_poll_event();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ STATIC mp_obj_t mod_TrezorMsg_Msg_select(mp_obj_t self, mp_obj_t timeout_us) {
|
||||
timeout = 0;
|
||||
}
|
||||
for(;;) {
|
||||
uint32_t e = msg_poll_ui_event();
|
||||
uint32_t e = msg_poll_touch();
|
||||
if (e) {
|
||||
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);
|
||||
|
@ -16,7 +16,7 @@ void touch_init(void)
|
||||
i2c_init(&I2CHandle1);
|
||||
}
|
||||
|
||||
uint32_t touch_event(void)
|
||||
uint32_t touch_read(void)
|
||||
{
|
||||
static uint8_t data[16], old_data[16];
|
||||
if (HAL_OK != HAL_I2C_Master_Receive(&I2CHandle1, 56 << 1, data, 16, 1)) {
|
||||
|
Loading…
Reference in New Issue
Block a user