From cfec25bb9e7df607f93cadf3e4d76b558c7db95d Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 30 Sep 2002 08:55:22 +0000 Subject: A lot more stable remote control handling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2447 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/button.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'firmware/drivers/button.c') diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index d6a2151dbd..9953f1aa22 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -28,6 +28,7 @@ #include "kernel.h" #include "backlight.h" #include "adc.h" +#include "serial.h" struct event_queue button_queue; @@ -52,18 +53,27 @@ static int button_read(void); static void button_tick(void) { - static int tick=0; - static int count=0; - static int lastbtn=0; - static int repeat_speed=REPEAT_INTERVAL_START; - static bool repeat=false; + static int tick = 0; + static int count = 0; + static int lastbtn = 0; + static int repeat_speed = REPEAT_INTERVAL_START; + static bool repeat = false; int diff; + int btn; + /* Post events for the remote control */ + btn = remote_control_rx(); + if(btn) + { + queue_post(&button_queue, btn, NULL); + backlight_on(); + } + /* only poll every X ticks */ if ( ++tick >= POLL_FREQUENCY ) { bool post = false; - int btn = button_read(); + btn = button_read(); /* Find out if a key has been released */ diff = btn ^ lastbtn; @@ -91,7 +101,7 @@ static void button_tick(void) if (count == 0) { post = true; /* yes we have repeat */ - repeat_speed--; + repeat_speed--; if (repeat_speed < REPEAT_INTERVAL_FINISH) repeat_speed = REPEAT_INTERVAL_FINISH; count = repeat_speed; -- cgit v1.2.3