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)
downloadrockbox-30f8326a8c38b7136d8bb7a95f92bdb35aa0a73d.tar.gz
rockbox-30f8326a8c38b7136d8bb7a95f92bdb35aa0a73d.zip
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[] = {
55}; /* button_context_standard */ 55}; /* button_context_standard */
56 56
57static const struct button_mapping remote_button_context_standard[] = { 57static const struct button_mapping remote_button_context_standard[] = {
58 { ACTION_STD_PREV, BUTTON_VOL_UP, BUTTON_NONE }, 58 { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
59 { ACTION_STD_PREVREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, 59 { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
60 { ACTION_STD_NEXT, BUTTON_VOL_DOWN, BUTTON_NONE }, 60 { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
61 { ACTION_STD_NEXTREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 61 { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
62 62
63 { ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE }, 63 { ACTION_STD_CONTEXT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
64 { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE }, 64 { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
65 { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE }, 65 { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
66 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE }, 66 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
67 { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU }, 67 { ACTION_STD_MENU, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
68 { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU }, 68 { ACTION_STD_QUICKSCREEN, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
69 69
70 LAST_ITEM_IN_LIST 70 LAST_ITEM_IN_LIST
71}; /* remote_button_context_standard */ 71}; /* 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)
48 int btn = BUTTON_NONE; 48 int btn = BUTTON_NONE;
49 bool hold_button_old; 49 bool hold_button_old;
50 bool remote_hold_button_old; 50 bool remote_hold_button_old;
51 int data = 0xff; /* FIXME */ 51 int data;
52 52
53 /* normal buttons */ 53 /* normal buttons */
54 hold_button_old = hold_button; 54 hold_button_old = hold_button;
@@ -56,24 +56,36 @@ int button_read_device(void)
56 56
57 if (!hold_button) 57 if (!hold_button)
58 { 58 {
59#if 0 /* TODO: implement ADC */
60 data = adc_scan(ADC_BUTTONS); 59 data = adc_scan(ADC_BUTTONS);
61 60
62 if (data < 0xf0) 61 if (data < 0xc0)
63 { 62 {
63 if (data < 0x67)
64 if (data < 0x37)
65 btn = BUTTON_VOL_DOWN;
66 else
67 if (data < 0x51)
68 btn = BUTTON_MODE;
69 else
70 btn = BUTTON_VOL_UP;
71 else
72 if (data < 0x7f)
73 btn = BUTTON_REC;
74 else
75 if (data < 0x98)
76 btn = BUTTON_LEFT;
77 else
78 btn = BUTTON_RIGHT;
64 } 79 }
65#endif
66 if (!(GPIO1_READ & 0x00000002)) 80 if (!(GPIO1_READ & 0x00000002))
67 btn |= BUTTON_PLAY; 81 btn |= BUTTON_PLAY;
68 } 82 }
69 83
70 /* remote buttons */ 84 /* remote buttons */
71#if 0 /* TODO: implement ADC */
72 data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff; 85 data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
73#endif
74 86
75 remote_hold_button_old = remote_hold_button; 87 remote_hold_button_old = remote_hold_button;
76 remote_hold_button = data < 0x17; 88 remote_hold_button = data < 0x14;
77 89
78#ifndef BOOTLOADER 90#ifndef BOOTLOADER
79 if (remote_hold_button != remote_hold_button_old) 91 if (remote_hold_button != remote_hold_button_old)
@@ -82,11 +94,28 @@ int button_read_device(void)
82 94
83 if (!remote_hold_button) 95 if (!remote_hold_button)
84 { 96 {
85#if 0 /* TODO: implement ADC */ 97 if (data < 0xd0)
86 if (data < 0xee)
87 { 98 {
99 if (data < 0x67)
100 if (data < 0x37)
101 btn |= BUTTON_RC_FF;
102 else
103 if (data < 0x51)
104 btn |= BUTTON_RC_REW;
105 else
106 btn |= BUTTON_RC_MODE;
107 else
108 if (data < 0x98)
109 if (data < 0x7f)
110 btn |= BUTTON_RC_REC;
111 else
112 btn |= BUTTON_RC_MENU;
113 else
114 if (data < 0xb0)
115 btn |= BUTTON_RC_VOL_UP;
116 else
117 btn |= BUTTON_RC_VOL_DOWN;
88 } 118 }
89#endif
90 if ((GPIO_READ & 0x80000000) == 0) 119 if ((GPIO_READ & 0x80000000) == 0)
91 btn |= BUTTON_RC_PLAY; 120 btn |= BUTTON_RC_PLAY;
92 } 121 }