summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-10-09 09:29:04 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-10-09 09:29:04 +0000
commit902c43a9689ec2c49dedc579b3d7d9fa45293652 (patch)
tree8a1037a431be5fced557e6ed38c1fa2450d354f4 /firmware/drivers
parent26e7ec47870f6287d7efbecd0499034b9073381e (diff)
Filters out AN5 keys if UP is pressed. Solves bug #619028.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2545 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/button.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 30b7622f53..4657e1d84b 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -271,16 +271,22 @@ static int button_read(void)
else if (data >= LEVEL1)
btn |= BUTTON_F1;
- /* Check DOWN, PLAY, LEFT, RIGHT */
- data = adc_read(ADC_BUTTON_ROW2);
- if (data >= LEVEL4)
- btn |= BUTTON_DOWN;
- else if (data >= LEVEL3)
- btn |= BUTTON_PLAY;
- else if (data >= LEVEL2)
- btn |= BUTTON_LEFT;
- else if (data >= LEVEL1)
- btn |= BUTTON_RIGHT;
+ /* Some units have mushy keypads, so pressing UP also activates
+ the Left/Right buttons. Let's combat that by skipping the AN5
+ checks when UP is pressed. */
+ if(!(btn & BUTTON_UP))
+ {
+ /* Check DOWN, PLAY, LEFT, RIGHT */
+ data = adc_read(ADC_BUTTON_ROW2);
+ if (data >= LEVEL4)
+ btn |= BUTTON_DOWN;
+ else if (data >= LEVEL3)
+ btn |= BUTTON_PLAY;
+ else if (data >= LEVEL2)
+ btn |= BUTTON_LEFT;
+ else if (data >= LEVEL1)
+ btn |= BUTTON_RIGHT;
+ }
return btn;
}