1
0
Fork 0
forked from len0rd/rockbox

iRiver: Support for remote control buttons

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5909 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-02-11 13:13:36 +00:00
parent dd52043cac
commit f48ec1f7fc
3 changed files with 45 additions and 5 deletions

View file

@ -171,6 +171,8 @@ unsigned char adc_scan(int channel)
CS_HI;
adcdata[channel] = data;
return data;
}
@ -186,7 +188,7 @@ static void adc_tick(void)
if(++adc_counter == HZ)
{
adc_counter = 0;
adcdata[ADC_BATTERY] = adc_scan(ADC_BATTERY);
adc_scan(ADC_BATTERY);
}
}
@ -201,8 +203,6 @@ void adc_init(void)
GPIO_OUT &= ~0x00400000; /* CLK low */
tick_add_task(adc_tick);
adcdata[3] = adc_scan(3);
}
#elif CONFIG_CPU == TCC730

View file

@ -351,7 +351,7 @@ static int button_read(void)
#if CONFIG_KEYPAD == IRIVER_H100_PAD
data = adc_scan(0);
data = adc_scan(ADC_BUTTONS);
if (data < 0x80)
if (data < 0x30)
@ -377,6 +377,38 @@ static int button_read(void)
if (data < 0xf0)
btn = BUTTON_REC;
data = adc_scan(ADC_REMOTE);
if (data < 0x74)
if (data < 0x40)
if (data < 0x20)
if(data < 0x10)
btn = BUTTON_RC_STOP;
else
btn = BUTTON_RC_VOL_DOWN;
else
btn = BUTTON_RC_VOL;
else
if (data < 0x58)
btn = BUTTON_RC_VOL_UP;
else
btn = BUTTON_RC_BITRATE;
else
if (data < 0xb0)
if (data < 0x88)
btn = BUTTON_RC_REC;
else
btn = BUTTON_RC_SOURCE;
else
if (data < 0xd8)
if(data < 0xc0)
btn = BUTTON_RC_FF;
else
btn = BUTTON_RC_MENU;
else
if (data < 0xf0)
btn = BUTTON_RC_REW;
data = GPIO1_READ;
if ((data & 0x20) == 0)
btn |= BUTTON_ON;

View file

@ -66,7 +66,15 @@ bool button_hold(void);
#define BUTTON_UP 0x0010
#define BUTTON_DOWN 0x0020
#define BUTTON_RC_ON (BUTTON_REMOTE | BUTTON_ON)
#define BUTTON_RC_ON (BUTTON_REMOTE | 0x00010000)
#define BUTTON_RC_STOP (BUTTON_REMOTE | 0x00020000)
#define BUTTON_RC_VOL (BUTTON_REMOTE | 0x00040000)
#define BUTTON_RC_BITRATE (BUTTON_REMOTE | 0x00200000)
#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000)
#define BUTTON_RC_SOURCE (BUTTON_REMOTE | 0x00800000)
#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x01000000)
#define BUTTON_RC_FF (BUTTON_REMOTE | 0x02000000)
#define BUTTON_RC_REW (BUTTON_REMOTE | 0x04000000)
#elif CONFIG_KEYPAD == RECORDER_PAD