refactor(core/bootloader): inline "wait for click" into ui_screen_boot_click

pull/2879/head
matejcik 1 year ago
parent e10b6ecc26
commit 288cd11b2a

@ -110,6 +110,46 @@ void ui_screen_boot_wait(int wait_seconds) {
display_refresh();
}
#if defined USE_TOUCH
#include "touch/touch.h"
void ui_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()) {
}
}
#elif defined USE_BUTTON
#include "button.h"
void ui_click(void) {
for (;;) {
button_read();
if (button_state_left() != 0 && button_state_right() != 0) {
break;
}
}
for (;;) {
button_read();
if (button_state_left() != 1 && button_state_right() != 1) {
break;
}
}
}
#else
#error "No input method defined"
#endif
void ui_screen_boot_click(void) {
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5,
@ -117,6 +157,7 @@ void ui_screen_boot_click(void) {
boot_background);
PIXELDATA_DIRTY();
display_refresh();
ui_click();
}
// welcome UI

@ -75,6 +75,4 @@ void ui_screen_boot_empty(bool fading);
#define INPUT_INFO 0x08 // Info icon
// clang-format on
int ui_user_input(int zones);
#endif

@ -513,24 +513,6 @@ int bootloader_main(void) {
if ((vhdr.vtrust & VTRUST_CLICK) == 0) {
ui_screen_boot_click();
#if defined USE_TOUCH
touch_click();
#elif defined USE_BUTTON
for (;;) {
button_read();
if (button_state_left() != 0 && button_state_right() != 0) {
break;
}
}
for (;;) {
button_read();
if (button_state_left() != 1 && button_state_right() != 1) {
break;
}
}
#else
#error Unknown Trezor model
#endif
}
ui_fadeout();

Loading…
Cancel
Save