diff options
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; |