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-c200.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-c200.c')
-rw-r--r-- | apps/keymaps/keymap-c200.c | 88 |
1 files changed, 66 insertions, 22 deletions
diff --git a/apps/keymaps/keymap-c200.c b/apps/keymaps/keymap-c200.c index 7acbe85420..af7c990340 100644 --- a/apps/keymaps/keymap-c200.c +++ b/apps/keymaps/keymap-c200.c @@ -266,30 +266,68 @@ static const struct button_mapping button_context_bmark[] = { #ifdef USB_ENABLE_HID static const struct button_mapping button_context_usb_hid[] = { - { 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_VOL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_START, BUTTON_UP|BUTTON_REL, BUTTON_UP }, - { ACTION_USB_HID_START_LONG, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, - { ACTION_USB_HID_QUIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, - { ACTION_USB_HID_QUIT_LONG, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, - { 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_SELECT|BUTTON_REL, BUTTON_SELECT }, - { ACTION_USB_HID_SELECT_LONG, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, - { ACTION_USB_HID_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, - { ACTION_USB_HID_MENU_LONG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, - { ACTION_USB_HID_MODE, BUTTON_REC|BUTTON_REL, BUTTON_REC }, - { ACTION_USB_HID_MODE_LONG, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC }, + { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_REC|BUTTON_REL, BUTTON_REC }, + { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC }, 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_UP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { 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_UP|BUTTON_REL, BUTTON_UP }, + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { 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_DOWN|BUTTON_REL, BUTTON_DOWN }, + { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + 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_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { 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_POWER|BUTTON_REPEAT, BUTTON_POWER }, + { 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_SELECT|BUTTON_REL, BUTTON_SELECT }, + + 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 }, @@ -324,7 +362,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 @@ -377,9 +415,15 @@ const struct button_mapping* get_context_mapping(int context) #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 default: |