1
0
Fork 0
forked from len0rd/rockbox

Added timestamps of key presses, for auto-poweroff

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2372 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-09-23 11:33:04 +00:00
parent d4e2ee56ef
commit 2aee04366f
2 changed files with 7 additions and 0 deletions

View file

@ -31,6 +31,8 @@
struct event_queue button_queue; struct event_queue button_queue;
long last_keypress;
/* how often we check to see if a button is pressed */ /* how often we check to see if a button is pressed */
#define POLL_FREQUENCY HZ/20 #define POLL_FREQUENCY HZ/20
@ -140,6 +142,8 @@ static void button_tick(void)
else else
queue_post(&button_queue, btn, NULL); queue_post(&button_queue, btn, NULL);
backlight_on(); backlight_on();
last_keypress = current_tick;
} }
} }
else else
@ -291,6 +295,8 @@ void button_init(void)
PAIOR &= ~0x820; PAIOR &= ~0x820;
queue_init(&button_queue); queue_init(&button_queue);
tick_add_task(button_tick); tick_add_task(button_tick);
last_keypress = current_tick;
} }
static int button_read(void) static int button_read(void)

View file

@ -23,6 +23,7 @@
#include "config.h" #include "config.h"
extern struct event_queue button_queue; extern struct event_queue button_queue;
extern long last_keypress;
void button_init (void); void button_init (void);
int button_get (bool block); int button_get (bool block);