summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-05-20 11:42:04 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-05-20 11:42:04 +0000
commit0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35 (patch)
tree96e8362a3c5530c35ef406e50a71ec97a33d5a7a
parent4c486ce948d0654028085dcbc467f4f04ce18db1 (diff)
downloadrockbox-0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35.tar.gz
rockbox-0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35.tar.bz2
rockbox-0037a1b648cb06c4ba5fc23b2b9850bb7d9b8d35.zip
add separate button defines for the Gigabeat remote control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13442 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/keymaps/keymap-gigabeat.c53
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c18
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/button-target.h13
3 files changed, 73 insertions, 11 deletions
diff --git a/apps/keymaps/keymap-gigabeat.c b/apps/keymaps/keymap-gigabeat.c
index 7e7eb1ec65..c2e6a537b0 100644
--- a/apps/keymaps/keymap-gigabeat.c
+++ b/apps/keymaps/keymap-gigabeat.c
@@ -269,8 +269,61 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
+/*****************************************************************************
+ * Remote control mappings
+ *****************************************************************************/
+
+static const struct button_mapping remote_button_context_standard[] = {
+ { 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_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+
+static const struct button_mapping remote_button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
+
+ { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
+ { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
+
+ { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
+
+ { ACTION_WPS_STOP, BUTTON_RC_DSP, BUTTON_NONE },
+
+ { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
+};
+
+static const struct button_mapping* get_context_mapping_remote( int context )
+{
+ context ^= CONTEXT_REMOTE;
+
+ switch (context)
+ {
+ case CONTEXT_WPS:
+ return remote_button_context_wps;
+
+ default:
+ return remote_button_context_standard;
+ }
+}
+
const struct button_mapping* get_context_mapping(int context)
{
+ if (context&CONTEXT_REMOTE)
+ return get_context_mapping_remote(context);
+
switch (context)
{
case CONTEXT_STD:
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
index 25a69d7630..5655d92ef8 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-meg-fx.c
@@ -32,15 +32,15 @@ static bool hold_button = false;
static int const remote_buttons[] =
{
- BUTTON_NONE, /* Headphones connected - remote disconnected */
- BUTTON_SELECT,
- BUTTON_MENU, /* could be changed to BUTTON_A */
- BUTTON_LEFT,
- BUTTON_RIGHT,
- BUTTON_UP, /* could be changed to BUTTON_VOL_UP */
- BUTTON_DOWN, /* could be changed to BUTTON_VOL_DOWN */
- BUTTON_NONE, /* Remote control attached - no buttons pressed */
- BUTTON_NONE, /* Nothing in the headphone socket */
+ BUTTON_NONE, /* Headphones connected - remote disconnected */
+ BUTTON_RC_PLAY,
+ BUTTON_RC_DSP,
+ BUTTON_RC_REW,
+ BUTTON_RC_FF,
+ BUTTON_RC_VOL_UP,
+ BUTTON_RC_VOL_DOWN,
+ BUTTON_NONE, /* Remote control attached - no buttons pressed */
+ BUTTON_NONE, /* Nothing in the headphone socket */
};
void button_init_device(void)
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
index ab68e8050f..7a39212de9 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/button-target.h
@@ -44,6 +44,15 @@ int button_read_device(void);
#define BUTTON_SELECT 0x00000100
#define BUTTON_A 0x00000200
+/* Remote control buttons */
+
+#define BUTTON_RC_VOL_UP 0x00000400
+#define BUTTON_RC_VOL_DOWN 0x00000800
+#define BUTTON_RC_FF 0x00001000
+#define BUTTON_RC_REW 0x00002000
+
+#define BUTTON_RC_PLAY 0x00004000
+#define BUTTON_RC_DSP 0x00008000
/* Toshiba Gigabeat specific remote button ADC values */
/* The remote control uses ADC 1 to emulate button pushes
@@ -80,8 +89,8 @@ int button_read_device(void);
|BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
|BUTTON_SELECT|BUTTON_A)
-
-#define BUTTON_REMOTE 0
+#define BUTTON_REMOTE (BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN|BUTTON_RC_FF\
+ |BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_RC_DSP)
#define POWEROFF_BUTTON BUTTON_POWER
#define POWEROFF_COUNT 10