summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/button.c6
-rw-r--r--firmware/drivers/button.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index a0a43d2..d6a2151 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -31,6 +31,8 @@
struct event_queue button_queue;
+long last_keypress;
+
/* how often we check to see if a button is pressed */
#define POLL_FREQUENCY HZ/20
@@ -140,6 +142,8 @@ static void button_tick(void)
else
queue_post(&button_queue, btn, NULL);
backlight_on();
+
+ last_keypress = current_tick;
}
}
else
@@ -291,6 +295,8 @@ void button_init(void)
PAIOR &= ~0x820;
queue_init(&button_queue);
tick_add_task(button_tick);
+
+ last_keypress = current_tick;
}
static int button_read(void)
diff --git a/firmware/drivers/button.h b/firmware/drivers/button.h
index 6563f1b..fc1d8f3 100644
--- a/firmware/drivers/button.h
+++ b/firmware/drivers/button.h
@@ -23,6 +23,7 @@
#include "config.h"
extern struct event_queue button_queue;
+extern long last_keypress;
void button_init (void);
int button_get (bool block);