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.tar.gz rockbox-cfec25bb9e7df607f93cadf3e4d76b558c7db95d.zip |
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 d6a2151dbd..9953f1aa22 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "kernel.h" | 28 | #include "kernel.h" |
29 | #include "backlight.h" | 29 | #include "backlight.h" |
30 | #include "adc.h" | 30 | #include "adc.h" |
31 | #include "serial.h" | ||
31 | 32 | ||
32 | struct event_queue button_queue; | 33 | struct event_queue button_queue; |
33 | 34 | ||
@@ -52,18 +53,27 @@ static int button_read(void); | |||
52 | 53 | ||
53 | static void button_tick(void) | 54 | static void button_tick(void) |
54 | { | 55 | { |
55 | static int tick=0; | 56 | static int tick = 0; |
56 | static int count=0; | 57 | static int count = 0; |
57 | static int lastbtn=0; | 58 | static int lastbtn = 0; |
58 | static int repeat_speed=REPEAT_INTERVAL_START; | 59 | static int repeat_speed = REPEAT_INTERVAL_START; |
59 | static bool repeat=false; | 60 | static bool repeat = false; |
60 | int diff; | 61 | int diff; |
62 | int btn; | ||
61 | 63 | ||
64 | /* Post events for the remote control */ | ||
65 | btn = remote_control_rx(); | ||
66 | if(btn) | ||
67 | { | ||
68 | queue_post(&button_queue, btn, NULL); | ||
69 | backlight_on(); | ||
70 | } | ||
71 | |||
62 | /* only poll every X ticks */ | 72 | /* only poll every X ticks */ |
63 | if ( ++tick >= POLL_FREQUENCY ) | 73 | if ( ++tick >= POLL_FREQUENCY ) |
64 | { | 74 | { |
65 | bool post = false; | 75 | bool post = false; |
66 | int btn = button_read(); | 76 | btn = button_read(); |
67 | 77 | ||
68 | /* Find out if a key has been released */ | 78 | /* Find out if a key has been released */ |
69 | diff = btn ^ lastbtn; | 79 | diff = btn ^ lastbtn; |
@@ -91,7 +101,7 @@ static void button_tick(void) | |||
91 | if (count == 0) { | 101 | if (count == 0) { |
92 | post = true; | 102 | post = true; |
93 | /* yes we have repeat */ | 103 | /* yes we have repeat */ |
94 | repeat_speed--; | 104 | repeat_speed--; |
95 | if (repeat_speed < REPEAT_INTERVAL_FINISH) | 105 | if (repeat_speed < REPEAT_INTERVAL_FINISH) |
96 | repeat_speed = REPEAT_INTERVAL_FINISH; | 106 | repeat_speed = REPEAT_INTERVAL_FINISH; |
97 | count = repeat_speed; | 107 | count = repeat_speed; |