1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 03:18:20 +00:00

add checking of buttons to bootloader

This commit is contained in:
Pavol Rusnak 2016-10-06 15:02:44 +02:00
parent d767e52055
commit d7ff70caf6
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 19 additions and 0 deletions

View File

@ -161,6 +161,8 @@ int main(void)
show_unofficial_warning(hash); show_unofficial_warning(hash);
} }
delay(100000);
load_app(); load_app();
} }

View File

@ -483,9 +483,26 @@ void usbInit(void)
usbd_register_set_config_callback(usbd_dev, hid_set_config); usbd_register_set_config_callback(usbd_dev, hid_set_config);
} }
void checkButtons(void)
{
uint16_t state = gpio_port_read(BTN_PORT);
if ((state & (BTN_PIN_YES | BTN_PIN_NO)) != (BTN_PIN_YES | BTN_PIN_NO)) {
if ((state & BTN_PIN_NO) != BTN_PIN_NO) {
oledInvert(0, 0, 3, 3);
}
if ((state & BTN_PIN_YES) != BTN_PIN_YES) {
oledInvert(OLED_WIDTH - 4, 0, OLED_WIDTH - 1, 3);
}
oledRefresh();
}
}
void usbLoop(void) void usbLoop(void)
{ {
for (;;) { for (;;) {
usbd_poll(usbd_dev); usbd_poll(usbd_dev);
if (flash_state == STATE_READY || flash_state == STATE_OPEN) {
checkButtons();
}
} }
} }