summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-24 15:21:08 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-24 15:21:08 +0000
commit51065bbaee2aeb2ea1c233a9ce34877e6e04ca80 (patch)
tree0138cdf732debd28a40eb75a4c2119092f792b30 /firmware/drivers/button.c
parente8e55e2aa33ee1cf828b24ced59be4ce5e42436f (diff)
downloadrockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.tar.gz
rockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.zip
Added key repeat control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1433 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c19
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
38static int repeat_mask = DEFAULT_REPEAT_MASK;
39
38static int button_read(void); 40static int button_read(void);
39 41
40static void button_tick(void) 42static 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
154int 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 */