iAudio M3: Fix standard remote context. * Process button adc values in the button driver. Those buttons won't work without the not-yet-committable ADC driver though.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16676 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6ee34cb53b
commit
30f8326a8c
2 changed files with 49 additions and 20 deletions
|
@ -55,17 +55,17 @@ static const struct button_mapping button_context_standard[] = {
|
||||||
}; /* button_context_standard */
|
}; /* button_context_standard */
|
||||||
|
|
||||||
static const struct button_mapping remote_button_context_standard[] = {
|
static const struct button_mapping remote_button_context_standard[] = {
|
||||||
{ ACTION_STD_PREV, BUTTON_VOL_UP, BUTTON_NONE },
|
{ ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
|
||||||
{ ACTION_STD_PREVREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
{ ACTION_STD_NEXT, BUTTON_VOL_DOWN, BUTTON_NONE },
|
{ ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
|
||||||
{ ACTION_STD_NEXTREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
{ ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
|
{ ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
|
||||||
{ ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
|
{ ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
|
||||||
{ ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
|
{ ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
|
||||||
{ ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
|
{ ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
|
||||||
{ ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
|
{ ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
|
||||||
{ ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
|
{ ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
|
||||||
|
|
||||||
LAST_ITEM_IN_LIST
|
LAST_ITEM_IN_LIST
|
||||||
}; /* remote_button_context_standard */
|
}; /* remote_button_context_standard */
|
||||||
|
|
|
@ -48,7 +48,7 @@ int button_read_device(void)
|
||||||
int btn = BUTTON_NONE;
|
int btn = BUTTON_NONE;
|
||||||
bool hold_button_old;
|
bool hold_button_old;
|
||||||
bool remote_hold_button_old;
|
bool remote_hold_button_old;
|
||||||
int data = 0xff; /* FIXME */
|
int data;
|
||||||
|
|
||||||
/* normal buttons */
|
/* normal buttons */
|
||||||
hold_button_old = hold_button;
|
hold_button_old = hold_button;
|
||||||
|
@ -56,24 +56,36 @@ int button_read_device(void)
|
||||||
|
|
||||||
if (!hold_button)
|
if (!hold_button)
|
||||||
{
|
{
|
||||||
#if 0 /* TODO: implement ADC */
|
|
||||||
data = adc_scan(ADC_BUTTONS);
|
data = adc_scan(ADC_BUTTONS);
|
||||||
|
|
||||||
if (data < 0xf0)
|
if (data < 0xc0)
|
||||||
{
|
{
|
||||||
|
if (data < 0x67)
|
||||||
|
if (data < 0x37)
|
||||||
|
btn = BUTTON_VOL_DOWN;
|
||||||
|
else
|
||||||
|
if (data < 0x51)
|
||||||
|
btn = BUTTON_MODE;
|
||||||
|
else
|
||||||
|
btn = BUTTON_VOL_UP;
|
||||||
|
else
|
||||||
|
if (data < 0x7f)
|
||||||
|
btn = BUTTON_REC;
|
||||||
|
else
|
||||||
|
if (data < 0x98)
|
||||||
|
btn = BUTTON_LEFT;
|
||||||
|
else
|
||||||
|
btn = BUTTON_RIGHT;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!(GPIO1_READ & 0x00000002))
|
if (!(GPIO1_READ & 0x00000002))
|
||||||
btn |= BUTTON_PLAY;
|
btn |= BUTTON_PLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remote buttons */
|
/* remote buttons */
|
||||||
#if 0 /* TODO: implement ADC */
|
|
||||||
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
|
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
|
||||||
#endif
|
|
||||||
|
|
||||||
remote_hold_button_old = remote_hold_button;
|
remote_hold_button_old = remote_hold_button;
|
||||||
remote_hold_button = data < 0x17;
|
remote_hold_button = data < 0x14;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
if (remote_hold_button != remote_hold_button_old)
|
if (remote_hold_button != remote_hold_button_old)
|
||||||
|
@ -82,11 +94,28 @@ int button_read_device(void)
|
||||||
|
|
||||||
if (!remote_hold_button)
|
if (!remote_hold_button)
|
||||||
{
|
{
|
||||||
#if 0 /* TODO: implement ADC */
|
if (data < 0xd0)
|
||||||
if (data < 0xee)
|
|
||||||
{
|
{
|
||||||
|
if (data < 0x67)
|
||||||
|
if (data < 0x37)
|
||||||
|
btn |= BUTTON_RC_FF;
|
||||||
|
else
|
||||||
|
if (data < 0x51)
|
||||||
|
btn |= BUTTON_RC_REW;
|
||||||
|
else
|
||||||
|
btn |= BUTTON_RC_MODE;
|
||||||
|
else
|
||||||
|
if (data < 0x98)
|
||||||
|
if (data < 0x7f)
|
||||||
|
btn |= BUTTON_RC_REC;
|
||||||
|
else
|
||||||
|
btn |= BUTTON_RC_MENU;
|
||||||
|
else
|
||||||
|
if (data < 0xb0)
|
||||||
|
btn |= BUTTON_RC_VOL_UP;
|
||||||
|
else
|
||||||
|
btn |= BUTTON_RC_VOL_DOWN;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if ((GPIO_READ & 0x80000000) == 0)
|
if ((GPIO_READ & 0x80000000) == 0)
|
||||||
btn |= BUTTON_RC_PLAY;
|
btn |= BUTTON_RC_PLAY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue