diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-09-30 08:55:22 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-09-30 08:55:22 +0000 |
| commit | cfec25bb9e7df607f93cadf3e4d76b558c7db95d (patch) | |
| tree | 02d90e3c43d0f83180c583183f6506a98816f79f /firmware/drivers/button.c | |
| parent | 07557e5612723897fee21e62795dabc0ad0925f8 (diff) | |
| download | rockbox-cfec25bb9e7df607f93cadf3e4d76b558c7db95d.zip rockbox-cfec25bb9e7df607f93cadf3e4d76b558c7db95d.tar.gz rockbox-cfec25bb9e7df607f93cadf3e4d76b558c7db95d.tar.bz2 rockbox-cfec25bb9e7df607f93cadf3e4d76b558c7db95d.tar.xz | |
A lot more stable remote control handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2447 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
| -rw-r--r-- | firmware/drivers/button.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index d6a2151..9953f1a 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; |