bootentry: Don't consider a reset in less than 10ms a double click

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-08-03 15:05:38 -04:00 committed by Eric Callahan
parent 1b71e856a4
commit c85d2cc38a

View File

@ -28,18 +28,22 @@ check_button_pressed(void)
return gpio_in_read(button) == button_high;
}
#define DOUBLE_CLICK_MIN_US 10000
#define DOUBLE_CLICK_MAX_US 500000
// Check for a bootloader request via double tap of reset button
static void
check_double_reset(void)
{
if (!CONFIG_ENABLE_DOUBLE_RESET)
return;
// set request signature and delay for two seconds. This enters the bootloader if
// Set request signature and delay - this enters the bootloader if
// the reset button is double clicked
udelay(DOUBLE_CLICK_MIN_US);
set_bootup_code(REQUEST_CANBOOT);
udelay(500000);
udelay(DOUBLE_CLICK_MAX_US - DOUBLE_CLICK_MIN_US);
// No reset, clear the bootup code
set_bootup_code(0);
// No reset, read the key back out to clear it
}
// Check if bootloader or application should be started