diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-17 05:39:54 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-17 05:39:54 +0000 |
commit | 4f3d7b5bcb0b025332e128c3856aa9d4cce91898 (patch) | |
tree | ac2f783e9585c476fbaa9dfaf3a7a34e826f7ccc /apps/keymaps/keymap-sa9200.c | |
parent | 6d4d44caf69e06ea51937da9c74e78af0ac99a62 (diff) |
USB HID: Use different context for each mode; Use constant for each action;
Rework keymaps
This commit makes the code neater and more readable. It makes it easier to
modify keymap assignments and new keypad modes.
Some platforms had their keypad mappings reworked.
The manual is updated to reflect all these changes.
H10 remote control mapping dropped.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23219 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/keymaps/keymap-sa9200.c')
-rw-r--r-- | apps/keymaps/keymap-sa9200.c | 97 |
1 files changed, 70 insertions, 27 deletions
diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c index 1d14a67147..6df9d6c1ed 100644 --- a/apps/keymaps/keymap-sa9200.c +++ b/apps/keymaps/keymap-sa9200.c @@ -278,34 +278,72 @@ static const struct button_mapping button_context_keyboard[] = { #ifdef USB_ENABLE_HID static const struct button_mapping button_context_usb_hid[] = { - { ACTION_USB_HID_INC, BUTTON_UP, BUTTON_NONE }, - { ACTION_USB_HID_INC, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_INC, BUTTON_VOL_UP, BUTTON_NONE }, - { ACTION_USB_HID_INC, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, - { ACTION_USB_HID_START_LONG, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, - { ACTION_USB_HID_QUIT, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, - { ACTION_USB_HID_QUIT_LONG, BUTTON_PREV|BUTTON_REPEAT, BUTTON_PREV }, - { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, - { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, - { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, - { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, - { ACTION_USB_HID_SELECT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, - { ACTION_USB_HID_SELECT_LONG, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT }, - { ACTION_USB_HID_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, - { ACTION_USB_HID_MENU_LONG, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, - { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, - { ACTION_USB_HID_MODE_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, + { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, LAST_ITEM_IN_LIST }; /* button_context_usb_hid */ +static const struct button_mapping button_context_usb_hid_mode_multimedia[] = { + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_multimedia */ + +static const struct button_mapping button_context_usb_hid_mode_presentation[] = { + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, + { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, + { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, + { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_presentation */ + +static const struct button_mapping button_context_usb_hid_mode_browser[] = { + { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REL, BUTTON_UP }, + { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, + { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, + { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, + { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT }, + { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN }, + { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_LEFT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_LEFT|BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_browser */ + #ifdef HAVE_USB_HID_MOUSE -static const struct button_mapping button_context_usb_hid_mouse[] = { +static const struct button_mapping button_context_usb_hid_mode_mouse[] = { { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE }, { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE }, @@ -340,7 +378,7 @@ static const struct button_mapping button_context_usb_hid_mouse[] = { { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) -}; /* button_context_usb_hid_mouse */ +}; /* button_context_usb_hid_mode_mouse */ #endif #endif @@ -390,13 +428,18 @@ const struct button_mapping* get_context_mapping(int context) case CONTEXT_KEYBOARD: return button_context_keyboard; - #ifdef USB_ENABLE_HID case CONTEXT_USB_HID: return button_context_usb_hid; + case CONTEXT_USB_HID_MODE_MULTIMEDIA: + return button_context_usb_hid_mode_multimedia; + case CONTEXT_USB_HID_MODE_PRESENTATION: + return button_context_usb_hid_mode_presentation; + case CONTEXT_USB_HID_MODE_BROWSER: + return button_context_usb_hid_mode_browser; #ifdef HAVE_USB_HID_MOUSE - case CONTEXT_USB_HID_MOUSE: - return button_context_usb_hid_mouse; + case CONTEXT_USB_HID_MODE_MOUSE: + return button_context_usb_hid_mode_mouse; #endif #endif } |