summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-15 12:20:59 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-15 12:20:59 +0000
commit30f8326a8c38b7136d8bb7a95f92bdb35aa0a73d (patch)
tree69a46e25d49a62e8fc495b515873812c6bdf65d7
parent6ee34cb53b487da8167821e01975a77be3a42f9e (diff)
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
-rw-r--r--apps/keymaps/keymap-m3.c22
-rw-r--r--firmware/target/coldfire/iaudio/m3/button-m3.c49
2 files changed, 50 insertions, 21 deletions
diff --git a/apps/keymaps/keymap-m3.c b/apps/keymaps/keymap-m3.c
index 734d34f097..23d78e47b2 100644
--- a/apps/keymaps/keymap-m3.c
+++ b/apps/keymaps/keymap-m3.c
@@ -55,17 +55,17 @@ static const struct button_mapping button_context_standard[] = {
}; /* button_context_standard */
static const struct button_mapping remote_button_context_standard[] = {
- { ACTION_STD_PREV, BUTTON_VOL_UP, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_NEXT, BUTTON_VOL_DOWN, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
- { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
- { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
- { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
+ { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, 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_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
+ { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
+ { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
LAST_ITEM_IN_LIST
}; /* remote_button_context_standard */
diff --git a/firmware/target/coldfire/iaudio/m3/button-m3.c b/firmware/target/coldfire/iaudio/m3/button-m3.c
index b5b09807c0..c7c5b2e90f 100644
--- a/firmware/target/coldfire/iaudio/m3/button-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/button-m3.c
@@ -48,7 +48,7 @@ int button_read_device(void)
int btn = BUTTON_NONE;
bool hold_button_old;
bool remote_hold_button_old;
- int data = 0xff; /* FIXME */
+ int data;
/* normal buttons */
hold_button_old = hold_button;
@@ -56,24 +56,36 @@ int button_read_device(void)
if (!hold_button)
{
-#if 0 /* TODO: implement ADC */
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))
btn |= BUTTON_PLAY;
}
/* remote buttons */
-#if 0 /* TODO: implement ADC */
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
-#endif
remote_hold_button_old = remote_hold_button;
- remote_hold_button = data < 0x17;
+ remote_hold_button = data < 0x14;
#ifndef BOOTLOADER
if (remote_hold_button != remote_hold_button_old)
@@ -82,11 +94,28 @@ int button_read_device(void)
if (!remote_hold_button)
{
-#if 0 /* TODO: implement ADC */
- if (data < 0xee)
+ if (data < 0xd0)
{
+ 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)
btn |= BUTTON_RC_PLAY;
}