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.zip
rockbox-c11a68aee2f0993777d72212241f91ecc99911af.tar.gz
rockbox-c11a68aee2f0993777d72212241f91ecc99911af.tar.bz2
rockbox-c11a68aee2f0993777d72212241f91ecc99911af.tar.xz
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 573d57f..08cc23c 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -582,9 +582,9 @@ void button_init(void)
GPIO1_ENABLE &= ~0x00100060;
GPIO1_FUNCTION |= 0x00100062;
#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
- /* Hold switch */
- GPIO_FUNCTION |= 0x08000000;
- GPIO_ENABLE &= ~0x08000000;
+ /* Power, Remote Play & Hold switch */
+ GPIO_FUNCTION |= 0x0e000000;
+ GPIO_ENABLE &= ~0x0e000000;
#elif CONFIG_KEYPAD == RECORDER_PAD
/* Set PB4 and PB8 as input pins */
@@ -1167,6 +1167,43 @@ static int button_read(void)
if(data < 0xf0)
btn = BUTTON_UP;
}
+
+ /* remote buttons */
+ data = adc_scan(ADC_REMOTE);
+ if(data < 0x17)
+ remote_hold_button = true;
+
+ if(!remote_hold_button)
+ {
+ if(data < 0x7a)
+ if(data < 0x41)
+ btn = BUTTON_RC_REW;
+ else
+ if(data < 0x61)
+ btn = BUTTON_RC_FF;
+ else
+ btn = BUTTON_RC_MODE;
+ else
+ if(data < 0xb4)
+ if(data < 0x96)
+ btn = BUTTON_RC_REC;
+ else
+ btn = BUTTON_RC_MENU;
+ else
+ if(data < 0xd1)
+ btn = BUTTON_RC_VOL_UP;
+ else
+ if(data < 0xee)
+ btn = BUTTON_RC_VOL_DOWN;
+ }
+
+ data = GPIO_READ;
+ if (!(data & 0x04000000))
+ btn |= BUTTON_POWER;
+
+ if (!(data & 0x02000000))
+ btn |= BUTTON_RC_PLAY;
+
#endif /* CONFIG_KEYPAD */
diff --git a/firmware/export/button.h b/firmware/export/button.h
index 12eab9f..a1590ec 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -196,7 +196,12 @@ bool button_hold(void);
#define BUTTON_DOWN 0x0010
#define BUTTON_SELECT 0x0020
-#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000)
+#define BUTTON_RC_PLAY (BUTTON_REMOTE | 0x00010000)
+#define BUTTON_RC_REW (BUTTON_REMOTE | 0x00020000)
+#define BUTTON_RC_FF (BUTTON_REMOTE | 0x00040000)
+#define BUTTON_RC_MODE (BUTTON_REMOTE | 0x00080000)
+#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00100000)
+#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x00200000)
#elif CONFIG_KEYPAD == GIGABEAT_PAD