diff options
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r-- | firmware/drivers/button.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 8dec7696a8..b1bfdd8957 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -35,6 +35,8 @@ struct event_queue button_queue; | |||
35 | #define REPEAT_START 6 | 35 | #define REPEAT_START 6 |
36 | #define REPEAT_INTERVAL 4 | 36 | #define REPEAT_INTERVAL 4 |
37 | 37 | ||
38 | static int repeat_mask = DEFAULT_REPEAT_MASK; | ||
39 | |||
38 | static int button_read(void); | 40 | static int button_read(void); |
39 | 41 | ||
40 | static void button_tick(void) | 42 | static void button_tick(void) |
@@ -63,9 +65,13 @@ static void button_tick(void) | |||
63 | } | 65 | } |
64 | } | 66 | } |
65 | else if (count++ > REPEAT_START) { | 67 | else if (count++ > REPEAT_START) { |
66 | post = true; | 68 | /* Only repeat if a repeatable key is pressed */ |
67 | repeat = true; | 69 | if(btn & repeat_mask) |
68 | count = REPEAT_INTERVAL; | 70 | { |
71 | post = true; | ||
72 | repeat = true; | ||
73 | count = REPEAT_INTERVAL; | ||
74 | } | ||
69 | /* If the OFF button is pressed long enough, and we are | 75 | /* If the OFF button is pressed long enough, and we are |
70 | still alive, then the unit must be connected to a | 76 | still alive, then the unit must be connected to a |
71 | charger. Therefore we will reboot and let the original | 77 | charger. Therefore we will reboot and let the original |
@@ -145,6 +151,13 @@ void button_init() | |||
145 | tick_add_task(button_tick); | 151 | tick_add_task(button_tick); |
146 | } | 152 | } |
147 | 153 | ||
154 | int button_set_repeat(int newmask) | ||
155 | { | ||
156 | int oldmask = repeat_mask; | ||
157 | repeat_mask = newmask; | ||
158 | return oldmask; | ||
159 | } | ||
160 | |||
148 | /* | 161 | /* |
149 | * Get button pressed from hardware | 162 | * Get button pressed from hardware |
150 | */ | 163 | */ |