1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

trezorhal: minor cleanup in touch for T1

This commit is contained in:
Pavol Rusnak 2018-10-02 19:03:06 +02:00
parent ddbcd7400f
commit 9beb6146e4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 11 additions and 4 deletions

View File

@ -24,6 +24,8 @@
#include "touch_t.h"
#elif TREZOR_MODEL == 1
#include "touch_1.h"
#else
#error Unknown TREZOR Model
#endif
uint32_t touch_click(void)

View File

@ -1,6 +1,11 @@
#define BTN_PIN_LEFT GPIO_PIN_5
#define BTN_PIN_RIGHT GPIO_PIN_2
#define DISPLAY_RESX 128
#define DISPLAY_RESY 64
#define BTN_LEFT_COORDS touch_pack_xy(0, DISPLAY_RESY - 1)
#define BTN_RIGHT_COORDS touch_pack_xy(DISPLAY_RESX - 1, DISPLAY_RESY - 1)
void touch_init(void) {
__HAL_RCC_GPIOC_CLK_ENABLE();
@ -26,17 +31,17 @@ uint32_t touch_read(void)
if (last_left != left) {
last_left = left;
if (left) {
return TOUCH_START | touch_pack_xy(0, 63);
return TOUCH_START | BTN_LEFT_COORDS;
} else {
return TOUCH_END | touch_pack_xy(0, 63);
return TOUCH_END | BTN_LEFT_COORDS;
}
}
if (last_right != right) {
last_right = right;
if (right) {
return TOUCH_START | touch_pack_xy(127, 63);
return TOUCH_START | BTN_RIGHT_COORDS;
} else {
return TOUCH_END | touch_pack_xy(127, 63);
return TOUCH_END | BTN_RIGHT_COORDS;
}
}
return 0;