diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-16 13:17:26 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-16 13:17:26 +0000 |
commit | e45c069d6993137af80fac30ac1b701b3f669d91 (patch) | |
tree | 71020ac50afb866754d9f0e9d7dfbf0a2e35afd0 /firmware/drivers | |
parent | 7ec35e782803708cc69871fd9495ea80c846ff68 (diff) |
Removed all traces of the repeat and release masks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2684 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/button.c | 59 | ||||
-rw-r--r-- | firmware/drivers/button.h | 9 |
2 files changed, 13 insertions, 55 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index e70246314d..ea3ffadffd 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -47,9 +47,6 @@ long last_keypress; /* speed repeat finishes at */ #define REPEAT_INTERVAL_FINISH 2 -static int repeat_mask = DEFAULT_REPEAT_MASK; -static int release_mask = DEFAULT_RELEASE_MASK; - static int button_read(void); static void button_tick(void) @@ -79,10 +76,9 @@ static void button_tick(void) /* Find out if a key has been released */ diff = btn ^ lastbtn; - if((btn & diff) == 0) + if(diff && (btn & diff) == 0) { - if(diff & release_mask) - queue_post(&button_queue, BUTTON_REL | diff, NULL); + queue_post(&button_queue, BUTTON_REL | diff, NULL); } if ( btn ) @@ -111,36 +107,21 @@ static void button_tick(void) } else { - if(btn & repeat_mask || -#ifdef HAVE_RECORDER_KEYPAD - btn == BUTTON_OFF) -#else - btn == BUTTON_STOP) -#endif + if (count++ > REPEAT_START) { - if (count++ > REPEAT_START) - { - /* Only repeat if a repeatable key is pressed */ - if(btn & repeat_mask) - { - post = true; - repeat = true; - /* initial repeat */ - count = REPEAT_INTERVAL_START; - } - /* Reboot if the OFF button is pressed long enough - and we are connected to a charger. */ + post = true; + repeat = true; + /* initial repeat */ + count = REPEAT_INTERVAL_START; + + /* Reboot if the OFF button is pressed long enough + and we are connected to a charger. */ #ifdef HAVE_RECORDER_KEYPAD - if(btn == BUTTON_OFF && charger_inserted()) + if(btn == BUTTON_OFF && charger_inserted()) #elif HAVE_PLAYER_KEYPAD - if(btn == BUTTON_STOP && charger_inserted()) + if(btn == BUTTON_STOP && charger_inserted()) #endif - system_reboot(); - } - } - else - { - count = 0; + system_reboot(); } } } @@ -197,20 +178,6 @@ int button_get_w_tmo(int ticks) return BUTTON_NONE; } -int button_set_repeat(int newmask) -{ - int oldmask = repeat_mask; - repeat_mask = newmask; - return oldmask; -} - -int button_set_release(int newmask) -{ - int oldmask = release_mask; - release_mask = newmask; - return oldmask; -} - #ifdef HAVE_RECORDER_KEYPAD /* AJBR buttons are connected to the CPU as follows: diff --git a/firmware/drivers/button.h b/firmware/drivers/button.h index 4e37057138..d961e775d0 100644 --- a/firmware/drivers/button.h +++ b/firmware/drivers/button.h @@ -28,8 +28,6 @@ extern long last_keypress; void button_init (void); int button_get (bool block); int button_get_w_tmo(int ticks); -int button_set_repeat(int newmask); -int button_set_release(int newmask); /* Shared button codes */ #define BUTTON_NONE 0x0000 @@ -59,9 +57,6 @@ int button_set_release(int newmask); #define BUTTON_F2 0x0200 #define BUTTON_F3 0x0400 -#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT | \ - BUTTON_UP | BUTTON_DOWN) - #define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \ BUTTON_RIGHT | BUTTON_OFF | BUTTON_PLAY | BUTTON_F1 | \ BUTTON_F2 | BUTTON_F3) @@ -73,15 +68,11 @@ int button_set_release(int newmask); #define BUTTON_PLAY BUTTON_UP #define BUTTON_STOP BUTTON_DOWN -#define DEFAULT_REPEAT_MASK (BUTTON_LEFT | BUTTON_RIGHT) - #define ALL_BUTTONS (BUTTON_ON | BUTTON_UP | BUTTON_DOWN | BUTTON_LEFT | \ BUTTON_RIGHT | BUTTON_MENU) #endif /* HAVE_PLAYER_KEYPAD */ -#define DEFAULT_RELEASE_MASK ALL_BUTTONS - #endif /* ----------------------------------------------------------------- |