diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-24 16:30:34 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-24 16:30:34 +0000 |
| commit | 9d4c0e398e2aa77adb0d45e150824f04cdf5e24c (patch) | |
| tree | 0d3fed487a3b81ea9887646a117cf4d13a201d5e | |
| parent | 51065bbaee2aeb2ea1c233a9ce34877e6e04ca80 (diff) | |
| download | rockbox-9d4c0e398e2aa77adb0d45e150824f04cdf5e24c.zip rockbox-9d4c0e398e2aa77adb0d45e150824f04cdf5e24c.tar.gz rockbox-9d4c0e398e2aa77adb0d45e150824f04cdf5e24c.tar.bz2 rockbox-9d4c0e398e2aa77adb0d45e150824f04cdf5e24c.tar.xz | |
Added multi-button read for recorder
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1434 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/button.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index b1bfdd8..636376b 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -163,36 +163,38 @@ int button_set_repeat(int newmask) */ static int button_read(void) { + int btn = BUTTON_NONE; + /* Check port B pins for ON and OFF */ int data = PBDR; if ((data & PBDR_BTN_ON) == 0) - return BUTTON_ON; + btn |= BUTTON_ON; else if ((data & PBDR_BTN_OFF) == 0) - return BUTTON_OFF; + btn |= BUTTON_OFF; /* Check F1-3 and UP */ data = adc_read(ADC_BUTTON_ROW1); if (data >= LEVEL4) - return BUTTON_F3; + btn |= BUTTON_F3; else if (data >= LEVEL3) - return BUTTON_UP; + btn |= BUTTON_UP; else if (data >= LEVEL2) - return BUTTON_F2; + btn |= BUTTON_F2; else if (data >= LEVEL1) - return BUTTON_F1; + btn |= BUTTON_F1; /* Check DOWN, PLAY, LEFT, RIGHT */ data = adc_read(ADC_BUTTON_ROW2); if (data >= LEVEL4) - return BUTTON_DOWN; + btn |= BUTTON_DOWN; else if (data >= LEVEL3) - return BUTTON_PLAY; + btn |= BUTTON_PLAY; else if (data >= LEVEL2) - return BUTTON_LEFT; + btn |= BUTTON_LEFT; else if (data >= LEVEL1) - return BUTTON_RIGHT; + btn |= BUTTON_RIGHT; - return BUTTON_NONE; + return btn; } #elif HAVE_PLAYER_KEYPAD @@ -221,7 +223,7 @@ void button_init(void) static int button_read(void) { int porta = PADR; - int btn = 0; + int btn = BUTTON_NONE; /* buttons are active low */ if(adc_read(0) < 0x180) |