1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

trezorhal: return position of last touch event from touch_click

This commit is contained in:
Pavol Rusnak 2017-10-24 17:59:25 +02:00
parent 34f363f903
commit d2ecae71d7
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 6 additions and 3 deletions

View File

@ -73,14 +73,17 @@ uint32_t touch_read(void)
return 0;
}
void touch_click(void)
uint32_t touch_click(void)
{
uint32_t r;
// flush touch events if any
while (touch_read()) { }
// wait for TOUCH_START
while ((touch_read() & TOUCH_START) == 0) { }
// wait for TOUCH_END
while ((touch_read() & TOUCH_END) == 0) { }
while (((r = touch_read()) & TOUCH_END) == 0) { }
// flush touch events if any
while (touch_read()) { }
// return last touch coordinate
return r;
}

View File

@ -17,6 +17,6 @@
void touch_init(void);
uint32_t touch_read(void);
void touch_click(void);
uint32_t touch_click(void);
#endif