From b62b0b6699cfe96d1c21e01c23e71d3095d1bd46 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 5 Jul 2002 07:11:20 +0000 Subject: [PATCH] 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 --- firmware/drivers/button.c | 25 ++++++++++++++----------- 1 file 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) #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) )