diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/button.c | 25 |
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 | ||
192 | void button_init(void) | 195 | void button_init(void) |
@@ -200,18 +203,18 @@ void button_init(void) | |||
200 | static int button_read(void) | 203 | static 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) ) |