From 2aee04366f2992a4a69d8a3d20f880d52a849cba Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 23 Sep 2002 11:33:04 +0000 Subject: Added timestamps of key presses, for auto-poweroff git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2372 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/button.c | 6 ++++++ firmware/drivers/button.h | 1 + 2 files changed, 7 insertions(+) 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 @@ 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 6563f1bc41..fc1d8f3d2f 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); -- cgit v1.2.3