mirror of
https://github.com/andreili/katapult.git
synced 2025-08-24 03:44:06 +02:00
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:
parent
1b71e856a4
commit
c85d2cc38a
@ -28,18 +28,22 @@ check_button_pressed(void)
|
|||||||
return gpio_in_read(button) == button_high;
|
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
|
// Check for a bootloader request via double tap of reset button
|
||||||
static void
|
static void
|
||||||
check_double_reset(void)
|
check_double_reset(void)
|
||||||
{
|
{
|
||||||
if (!CONFIG_ENABLE_DOUBLE_RESET)
|
if (!CONFIG_ENABLE_DOUBLE_RESET)
|
||||||
return;
|
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
|
// the reset button is double clicked
|
||||||
|
udelay(DOUBLE_CLICK_MIN_US);
|
||||||
set_bootup_code(REQUEST_CANBOOT);
|
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);
|
set_bootup_code(0);
|
||||||
// No reset, read the key back out to clear it
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if bootloader or application should be started
|
// Check if bootloader or application should be started
|
||||||
|
Loading…
x
Reference in New Issue
Block a user