summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-03-09 07:23:07 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-03-09 07:23:07 +0000
commitc11a68aee2f0993777d72212241f91ecc99911af (patch)
treee9a72775fd7cfb072f180a3c9a1c7fb58b7daa8c
parent9c2b203025976fceb3840c2785c96f1baa261982 (diff)
downloadrockbox-c11a68aee2f0993777d72212241f91ecc99911af.tar.gz
rockbox-c11a68aee2f0993777d72212241f91ecc99911af.zip
iAudio X5: Remote control buttons
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8968 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/button.c43
-rw-r--r--firmware/export/button.h7
2 files changed, 46 insertions, 4 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 573d57fd0a..08cc23ce3b 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -582,9 +582,9 @@ void button_init(void)
582 GPIO1_ENABLE &= ~0x00100060; 582 GPIO1_ENABLE &= ~0x00100060;
583 GPIO1_FUNCTION |= 0x00100062; 583 GPIO1_FUNCTION |= 0x00100062;
584#elif CONFIG_KEYPAD == IAUDIO_X5_PAD 584#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
585 /* Hold switch */ 585 /* Power, Remote Play & Hold switch */
586 GPIO_FUNCTION |= 0x08000000; 586 GPIO_FUNCTION |= 0x0e000000;
587 GPIO_ENABLE &= ~0x08000000; 587 GPIO_ENABLE &= ~0x0e000000;
588 588
589#elif CONFIG_KEYPAD == RECORDER_PAD 589#elif CONFIG_KEYPAD == RECORDER_PAD
590 /* Set PB4 and PB8 as input pins */ 590 /* Set PB4 and PB8 as input pins */
@@ -1167,6 +1167,43 @@ static int button_read(void)
1167 if(data < 0xf0) 1167 if(data < 0xf0)
1168 btn = BUTTON_UP; 1168 btn = BUTTON_UP;
1169 } 1169 }
1170
1171 /* remote buttons */
1172 data = adc_scan(ADC_REMOTE);
1173 if(data < 0x17)
1174 remote_hold_button = true;
1175
1176 if(!remote_hold_button)
1177 {
1178 if(data < 0x7a)
1179 if(data < 0x41)
1180 btn = BUTTON_RC_REW;
1181 else
1182 if(data < 0x61)
1183 btn = BUTTON_RC_FF;
1184 else
1185 btn = BUTTON_RC_MODE;
1186 else
1187 if(data < 0xb4)
1188 if(data < 0x96)
1189 btn = BUTTON_RC_REC;
1190 else
1191 btn = BUTTON_RC_MENU;
1192 else
1193 if(data < 0xd1)
1194 btn = BUTTON_RC_VOL_UP;
1195 else
1196 if(data < 0xee)
1197 btn = BUTTON_RC_VOL_DOWN;
1198 }
1199
1200 data = GPIO_READ;
1201 if (!(data & 0x04000000))
1202 btn |= BUTTON_POWER;
1203
1204 if (!(data & 0x02000000))
1205 btn |= BUTTON_RC_PLAY;
1206
1170#endif /* CONFIG_KEYPAD */ 1207#endif /* CONFIG_KEYPAD */
1171 1208
1172 1209
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 12eab9ff80..a1590ec353 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -196,7 +196,12 @@ bool button_hold(void);
196#define BUTTON_DOWN 0x0010 196#define BUTTON_DOWN 0x0010
197#define BUTTON_SELECT 0x0020 197#define BUTTON_SELECT 0x0020
198 198
199#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000) 199#define BUTTON_RC_PLAY (BUTTON_REMOTE | 0x00010000)
200#define BUTTON_RC_REW (BUTTON_REMOTE | 0x00020000)
201#define BUTTON_RC_FF (BUTTON_REMOTE | 0x00040000)
202#define BUTTON_RC_MODE (BUTTON_REMOTE | 0x00080000)
203#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00100000)
204#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x00200000)
200 205
201#elif CONFIG_KEYPAD == GIGABEAT_PAD 206#elif CONFIG_KEYPAD == GIGABEAT_PAD
202 207