mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Added variable to cancel button press.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -74,13 +74,15 @@ bool is_req_button_pending() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t button_timeout = 15000;
|
uint32_t button_timeout = 15000;
|
||||||
|
bool cancel_button = false;
|
||||||
|
|
||||||
bool wait_button() {
|
bool wait_button() {
|
||||||
uint32_t start_button = board_millis();
|
uint32_t start_button = board_millis();
|
||||||
bool timeout = false;
|
bool timeout = false;
|
||||||
|
cancel_button = false;
|
||||||
led_set_blink((1000 << 16) | 100);
|
led_set_blink((1000 << 16) | 100);
|
||||||
req_button_pending = true;
|
req_button_pending = true;
|
||||||
while (board_button_read() == false) {
|
while (board_button_read() == false && cancel_button == false) {
|
||||||
execute_tasks();
|
execute_tasks();
|
||||||
//sleep_ms(10);
|
//sleep_ms(10);
|
||||||
if (start_button + button_timeout < board_millis()) { /* timeout */
|
if (start_button + button_timeout < board_millis()) { /* timeout */
|
||||||
@@ -89,7 +91,7 @@ bool wait_button() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
while (board_button_read() == true) {
|
while (board_button_read() == true && cancel_button == false) {
|
||||||
execute_tasks();
|
execute_tasks();
|
||||||
//sleep_ms(10);
|
//sleep_ms(10);
|
||||||
if (start_button + 15000 < board_millis()) { /* timeout */
|
if (start_button + 15000 < board_millis()) { /* timeout */
|
||||||
@@ -100,7 +102,7 @@ bool wait_button() {
|
|||||||
}
|
}
|
||||||
led_set_blink(BLINK_PROCESSING);
|
led_set_blink(BLINK_PROCESSING);
|
||||||
req_button_pending = false;
|
req_button_pending = false;
|
||||||
return timeout;
|
return timeout || cancel_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct apdu apdu;
|
struct apdu apdu;
|
||||||
|
|||||||
Reference in New Issue
Block a user