diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-24 15:21:08 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-24 15:21:08 +0000 |
| commit | 51065bbaee2aeb2ea1c233a9ce34877e6e04ca80 (patch) | |
| tree | 0138cdf732debd28a40eb75a4c2119092f792b30 /firmware/drivers | |
| parent | e8e55e2aa33ee1cf828b24ced59be4ce5e42436f (diff) | |
| download | rockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.zip rockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.tar.gz rockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.tar.bz2 rockbox-51065bbaee2aeb2ea1c233a9ce34877e6e04ca80.tar.xz | |
Added key repeat control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1433 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
| -rw-r--r-- | firmware/drivers/button.c | 19 | ||||
| -rw-r--r-- | firmware/drivers/button.h | 7 |
2 files changed, 22 insertions, 4 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 8dec769..b1bfdd8 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -35,6 +35,8 @@ struct event_queue button_queue; #define REPEAT_START 6 #define REPEAT_INTERVAL 4 +static int repeat_mask = DEFAULT_REPEAT_MASK; + static int button_read(void); static void button_tick(void) @@ -63,9 +65,13 @@ static void button_tick(void) } } else if (count++ > REPEAT_START) { - post = true; - repeat = true; - count = REPEAT_INTERVAL; + /* Only repeat if a repeatable key is pressed */ + if(btn & repeat_mask) + { + post = true; + repeat = true; + count = REPEAT_INTERVAL; + } /* If the OFF button is pressed long enough, and we are still alive, then the unit must be connected to a charger. Therefore we will reboot and let the original @@ -145,6 +151,13 @@ void button_init() tick_add_task(button_tick); } +int button_set_repeat(int newmask) +{ + int oldmask = repeat_mask; + repeat_mask = newmask; + return oldmask; +} + /* * Get button pressed from hardware */ diff --git a/firmware/drivers/button.h b/firmware/drivers/button.h index 8eacab2..0ff6b58 100644 --- a/firmware/drivers/button.h +++ b/firmware/drivers/button.h @@ -26,6 +26,7 @@ extern struct event_queue button_queue; void button_init (void); int button_get (bool block); +int button_set_repeat(int newmask); /* Shared button codes */ #define BUTTON_NONE 0x0000 @@ -39,7 +40,6 @@ int button_get (bool block); #define BUTTON_HELD 0x4000 #define BUTTON_REL 0x8000 - #ifdef HAVE_RECORDER_KEYPAD /* Recorder specific button codes */ @@ -49,6 +49,9 @@ int button_get (bool block); #define BUTTON_F2 0x0200 #define BUTTON_F3 0x0400 +#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT | \ + BUTTON_UP | BUTTON_DOWN) + #elif HAVE_PLAYER_KEYPAD /* Jukebox 6000 and Studio specific button codes */ @@ -56,6 +59,8 @@ int button_get (bool block); #define BUTTON_PLAY BUTTON_UP #define BUTTON_STOP BUTTON_DOWN +#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT) + #endif #endif |