1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 03:18:09 +00:00

bootloader: require only left button to start the bootloader

This commit is contained in:
Pavol Rusnak 2019-02-22 15:47:34 +01:00
parent 99c6777c7c
commit 806f943116
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 3 additions and 6 deletions

View File

@ -119,11 +119,9 @@ int main(void)
mpu_config_bootloader();
#ifndef APPVER
// at least one button is unpressed
uint16_t state = gpio_port_read(BTN_PORT);
int unpressed = ((state & BTN_PIN_YES) == BTN_PIN_YES || (state & BTN_PIN_NO) == BTN_PIN_NO);
bool left_pressed = (buttonRead() & BTN_PIN_NO) == 0;
if (firmware_present_new() && unpressed) {
if (firmware_present_new() && !left_pressed) {
oledClear();
oledDrawBitmap(40, 0, &bmp_logo64_empty);

View File

@ -29,10 +29,9 @@ uint16_t buttonRead(void) {
void buttonUpdate()
{
uint16_t state;
static uint16_t last_state = BTN_PIN_YES | BTN_PIN_NO;
state = buttonRead();
uint16_t state = buttonRead();
if ((state & BTN_PIN_YES) == 0) { // Yes button is down
if ((last_state & BTN_PIN_YES) == 0) { // last Yes was down