From a055f4e8fb97ad66118512eb75bff1194e38b34a Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 29 Sep 2017 10:11:12 +0200 Subject: [PATCH] boardloader+bootloader: remove unneded STM32 include --- embed/boardloader/main.c | 2 -- embed/bootloader/main.c | 4 +--- embed/trezorhal/touch.c | 12 ++++++++++++ embed/trezorhal/touch.h | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/embed/boardloader/main.c b/embed/boardloader/main.c index 23d607f69f..a2953136d4 100644 --- a/embed/boardloader/main.c +++ b/embed/boardloader/main.c @@ -1,5 +1,3 @@ -#include STM32_HAL_H - #include #include "common.h" diff --git a/embed/bootloader/main.c b/embed/bootloader/main.c index bacf52e9a2..6c4bb1c32c 100644 --- a/embed/bootloader/main.c +++ b/embed/bootloader/main.c @@ -1,5 +1,3 @@ -#include STM32_HAL_H - #include #include #include @@ -82,7 +80,7 @@ void check_and_jump(void) display_printf("valid firmware signature\n"); display_vendor(vhdr.vimg, (const char *)vhdr.vstr, vhdr.vstr_len, hdr.version); - HAL_Delay(1000); // TODO: remove? + touch_click(); jump_to(FIRMWARE_START + vhdr.hdrlen + HEADER_SIZE); } else { diff --git a/embed/trezorhal/touch.c b/embed/trezorhal/touch.c index 6b8fb90fee..578fff336e 100644 --- a/embed/trezorhal/touch.c +++ b/embed/trezorhal/touch.c @@ -79,6 +79,18 @@ uint32_t touch_read(void) { return 0; } +void touch_click(void) +{ + // 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) { } + // flush touch events if any + while (touch_read()) { } +} + void I2C1_EV_IRQHandler(void) { HAL_I2C_EV_IRQHandler(&i2c_handle); } diff --git a/embed/trezorhal/touch.h b/embed/trezorhal/touch.h index 2184031bec..7bdf3af8b8 100644 --- a/embed/trezorhal/touch.h +++ b/embed/trezorhal/touch.h @@ -14,5 +14,6 @@ int touch_init(void); uint32_t touch_read(void); +void touch_click(void); #endif