diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/button.c | 6 | ||||
-rw-r--r-- | firmware/drivers/button.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index a0a43d2871..d6a2151dbd 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | struct event_queue button_queue; | 32 | struct event_queue button_queue; |
33 | 33 | ||
34 | long last_keypress; | ||
35 | |||
34 | /* how often we check to see if a button is pressed */ | 36 | /* how often we check to see if a button is pressed */ |
35 | #define POLL_FREQUENCY HZ/20 | 37 | #define POLL_FREQUENCY HZ/20 |
36 | 38 | ||
@@ -140,6 +142,8 @@ static void button_tick(void) | |||
140 | else | 142 | else |
141 | queue_post(&button_queue, btn, NULL); | 143 | queue_post(&button_queue, btn, NULL); |
142 | backlight_on(); | 144 | backlight_on(); |
145 | |||
146 | last_keypress = current_tick; | ||
143 | } | 147 | } |
144 | } | 148 | } |
145 | else | 149 | else |
@@ -291,6 +295,8 @@ void button_init(void) | |||
291 | PAIOR &= ~0x820; | 295 | PAIOR &= ~0x820; |
292 | queue_init(&button_queue); | 296 | queue_init(&button_queue); |
293 | tick_add_task(button_tick); | 297 | tick_add_task(button_tick); |
298 | |||
299 | last_keypress = current_tick; | ||
294 | } | 300 | } |
295 | 301 | ||
296 | static int button_read(void) | 302 | static int button_read(void) |
diff --git a/firmware/drivers/button.h b/firmware/drivers/button.h index 6563f1bc41..fc1d8f3d2f 100644 --- a/firmware/drivers/button.h +++ b/firmware/drivers/button.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "config.h" | 23 | #include "config.h" |
24 | 24 | ||
25 | extern struct event_queue button_queue; | 25 | extern struct event_queue button_queue; |
26 | extern long last_keypress; | ||
26 | 27 | ||
27 | void button_init (void); | 28 | void button_init (void); |
28 | int button_get (bool block); | 29 | int button_get (bool block); |