summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-05 07:11:20 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-05 07:11:20 +0000
commitb62b0b6699cfe96d1c21e01c23e71d3095d1bd46 (patch)
tree39044e7fc1683086c7ecb65ffb673a355c1133d5 /firmware/drivers/button.c
parent4edf8aebf561d960e590752ae69eeb6cdc27c188 (diff)
downloadrockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.zip
rockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.tar.gz
rockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.tar.bz2
rockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.tar.xz
The Player button_read used Port C. It now uses ANx instead
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1338 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 178c8c4..8ed445c 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -179,14 +179,17 @@ static int button_read(void)
#elif HAVE_PLAYER_KEYPAD
-/* The player has all buttons on port pins:
+/* The player has two buttons on port pins:
- LEFT: PC0
- RIGHT: PC2
- PLAY: PC3
STOP: PA11
ON: PA5
- MENU: PC1
+
+ The rest are on analog inputs:
+
+ LEFT: AN0
+ MENU: AN1
+ RIGHT: AN2
+ PLAY: AN3
*/
void button_init(void)
@@ -200,18 +203,18 @@ void button_init(void)
static int button_read(void)
{
int porta = PADR;
- int portc = PCDR;
int btn = 0;
-
+
/* buttons are active low */
- if ( !(portc & 1) )
+ if(adc_read(0) < 0x180)
btn |= BUTTON_LEFT;
- if ( !(portc & 2) )
+ if(adc_read(1) < 0x180)
btn |= BUTTON_MENU;
- if ( !(portc & 4) )
+ if(adc_read(2) < 0x180)
btn |= BUTTON_RIGHT;
- if ( !(portc & 8) )
+ if(adc_read(3) < 0x180)
btn |= BUTTON_PLAY | BUTTON_UP;
+
if ( !(porta & 0x20) )
btn |= BUTTON_ON;
if ( !(porta & 0x800) )