mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-11 01:38:26 +02:00
Adding variable button timeout.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -62,6 +62,7 @@ enum {
|
|||||||
extern void led_set_blink(uint32_t mode);
|
extern void led_set_blink(uint32_t mode);
|
||||||
|
|
||||||
extern bool is_req_button_pending();
|
extern bool is_req_button_pending();
|
||||||
|
extern uint32_t button_timeout;
|
||||||
|
|
||||||
#define SW_BYTES_REMAINING_00() set_res_sw (0x61, 0x00)
|
#define SW_BYTES_REMAINING_00() set_res_sw (0x61, 0x00)
|
||||||
#define SW_WARNING_STATE_UNCHANGED() set_res_sw (0x62, 0x00)
|
#define SW_WARNING_STATE_UNCHANGED() set_res_sw (0x62, 0x00)
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ bool is_req_button_pending() {
|
|||||||
return req_button_pending;
|
return req_button_pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t button_timeout = 15000;
|
||||||
|
|
||||||
bool wait_button() {
|
bool wait_button() {
|
||||||
uint32_t start_button = board_millis();
|
uint32_t start_button = board_millis();
|
||||||
bool timeout = false;
|
bool timeout = false;
|
||||||
@@ -81,7 +83,7 @@ bool wait_button() {
|
|||||||
while (board_button_read() == false) {
|
while (board_button_read() == false) {
|
||||||
execute_tasks();
|
execute_tasks();
|
||||||
//sleep_ms(10);
|
//sleep_ms(10);
|
||||||
if (start_button + 15000 < board_millis()) { /* timeout */
|
if (start_button + button_timeout < board_millis()) { /* timeout */
|
||||||
timeout = true;
|
timeout = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user