summaryrefslogtreecommitdiff
path: root/firmware
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
parent4edf8aebf561d960e590752ae69eeb6cdc27c188 (diff)
downloadrockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.tar.gz
rockbox-b62b0b6699cfe96d1c21e01c23e71d3095d1bd46.zip
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')
-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 178c8c4e99..8ed445c0c3 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -179,14 +179,17 @@ static int button_read(void)
179 179
180#elif HAVE_PLAYER_KEYPAD 180#elif HAVE_PLAYER_KEYPAD
181 181
182/* The player has all buttons on port pins: 182/* The player has two buttons on port pins:
183 183
184 LEFT: PC0
185 RIGHT: PC2
186 PLAY: PC3
187 STOP: PA11 184 STOP: PA11
188 ON: PA5 185 ON: PA5
189 MENU: PC1 186
187 The rest are on analog inputs:
188
189 LEFT: AN0
190 MENU: AN1
191 RIGHT: AN2
192 PLAY: AN3
190*/ 193*/
191 194
192void button_init(void) 195void button_init(void)
@@ -200,18 +203,18 @@ void button_init(void)
200static int button_read(void) 203static int button_read(void)
201{ 204{
202 int porta = PADR; 205 int porta = PADR;
203 int portc = PCDR;
204 int btn = 0; 206 int btn = 0;
205 207
206 /* buttons are active low */ 208 /* buttons are active low */
207 if ( !(portc & 1) ) 209 if(adc_read(0) < 0x180)
208 btn |= BUTTON_LEFT; 210 btn |= BUTTON_LEFT;
209 if ( !(portc & 2) ) 211 if(adc_read(1) < 0x180)
210 btn |= BUTTON_MENU; 212 btn |= BUTTON_MENU;
211 if ( !(portc & 4) ) 213 if(adc_read(2) < 0x180)
212 btn |= BUTTON_RIGHT; 214 btn |= BUTTON_RIGHT;
213 if ( !(portc & 8) ) 215 if(adc_read(3) < 0x180)
214 btn |= BUTTON_PLAY | BUTTON_UP; 216 btn |= BUTTON_PLAY | BUTTON_UP;
217
215 if ( !(porta & 0x20) ) 218 if ( !(porta & 0x20) )
216 btn |= BUTTON_ON; 219 btn |= BUTTON_ON;
217 if ( !(porta & 0x800) ) 220 if ( !(porta & 0x800) )