diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-09 07:23:07 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-09 07:23:07 +0000 |
commit | c11a68aee2f0993777d72212241f91ecc99911af (patch) | |
tree | e9a72775fd7cfb072f180a3c9a1c7fb58b7daa8c /firmware/drivers | |
parent | 9c2b203025976fceb3840c2785c96f1baa261982 (diff) | |
download | rockbox-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
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/button.c | 43 |
1 files changed, 40 insertions, 3 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 | ||