Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * |
| 9 | * Copyright (C) 2006 Jonathan Gordon |
| 10 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version 2 |
| 14 | * of the License, or (at your option) any later version. |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 15 | * |
| 16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 17 | * KIND, either express or implied. |
| 18 | * |
| 19 | ****************************************************************************/ |
| 20 | |
| 21 | /* * |
| 22 | * Button Code Definitions for archos player targets |
| 23 | * |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | #include "config.h" |
| 27 | #include "action.h" |
| 28 | #include "button.h" |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 29 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 30 | static const struct button_mapping button_context_standard[] = { |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 31 | { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 32 | { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 33 | { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 34 | { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 35 | |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 36 | { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, |
| 37 | { ACTION_STD_CANCEL, BUTTON_STOP, BUTTON_NONE }, |
Jens Arnold | 2cf9868 | 2007-03-18 14:19:18 +0000 | [diff] [blame] | 38 | { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 39 | { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, |
| 40 | { ACTION_STD_MENU, BUTTON_MENU, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 41 | |
| 42 | LAST_ITEM_IN_LIST |
| 43 | }; |
| 44 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 45 | static const struct button_mapping button_context_wps[] = { |
Jens Arnold | 80876fd | 2006-10-08 18:47:32 +0000 | [diff] [blame] | 46 | { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 47 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, |
| 48 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, |
| 49 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, |
| 50 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, |
Linus Nielsen Feltzing | 1526fd7 | 2006-08-15 21:27:53 +0000 | [diff] [blame] | 51 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, |
| 52 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, |
| 53 | { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 54 | |
Jens Arnold | 2cf9868 | 2007-03-18 14:19:18 +0000 | [diff] [blame] | 55 | { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 56 | { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, |
Jens Arnold | 2cf9868 | 2007-03-18 14:19:18 +0000 | [diff] [blame] | 57 | { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE }, |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 58 | { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 59 | |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 60 | { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON }, |
| 61 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, |
| 62 | { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, |
| 63 | { ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE }, |
Jens Arnold | 80876fd | 2006-10-08 18:47:32 +0000 | [diff] [blame] | 64 | { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, BUTTON_NONE }, |
Jens Arnold | 2cf9868 | 2007-03-18 14:19:18 +0000 | [diff] [blame] | 65 | |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 66 | LAST_ITEM_IN_LIST |
| 67 | }; |
| 68 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 69 | static const struct button_mapping button_context_settings[] = { |
Jonathan Gordon | 814683e | 2006-10-12 07:25:35 +0000 | [diff] [blame] | 70 | { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, |
| 71 | { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, |
| 72 | { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, |
| 73 | { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 74 | |
Jonathan Gordon | 56a16d7 | 2006-08-21 11:28:29 +0000 | [diff] [blame] | 75 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 78 | static const struct button_mapping button_context_tree[] = { |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 79 | { ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE }, |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 80 | |
Jonathan Gordon | 56a16d7 | 2006-08-21 11:28:29 +0000 | [diff] [blame] | 81 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 82 | }; /* button_context_listtree */ |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 83 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 84 | static const struct button_mapping button_context_yesno[] = { |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 85 | { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 86 | |
Jonathan Gordon | 56a16d7 | 2006-08-21 11:28:29 +0000 | [diff] [blame] | 87 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 88 | }; /* button_context_settings_yesno */ |
| 89 | |
Jens Arnold | a0f3113 | 2006-12-12 07:55:17 +0000 | [diff] [blame] | 90 | static const struct button_mapping button_context_bmark[] = { |
Jonathan Gordon | 2e3cfaf | 2006-08-23 08:53:38 +0000 | [diff] [blame] | 91 | { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_PLAY }, |
| 92 | { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_ON }, |
Jonathan Gordon | 2e3cfaf | 2006-08-23 08:53:38 +0000 | [diff] [blame] | 93 | |
Magnus Holmgren | e676b81 | 2007-05-26 10:44:38 +0000 | [diff] [blame] | 94 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), |
Jonathan Gordon | 2e3cfaf | 2006-08-23 08:53:38 +0000 | [diff] [blame] | 95 | }; /* button_context_settings_bmark */ |
| 96 | |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 97 | /***************************************************************************** |
| 98 | * Remote control mappings |
| 99 | *****************************************************************************/ |
| 100 | |
| 101 | static const struct button_mapping remote_button_context_standard[] = { |
| 102 | { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE }, |
| 103 | { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE }, |
| 104 | { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE }, |
| 105 | { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE }, |
| 106 | |
Jonathan Gordon | fe5e56c | 2006-08-22 09:00:27 +0000 | [diff] [blame] | 107 | LAST_ITEM_IN_LIST |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | static const struct button_mapping remote_button_context_wps[] = { |
| 111 | { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, |
| 112 | { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE }, |
| 113 | { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE }, |
| 114 | { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE }, |
| 115 | |
| 116 | { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, |
| 117 | { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE }, |
| 118 | |
Jonathan Gordon | 56a16d7 | 2006-08-21 11:28:29 +0000 | [diff] [blame] | 119 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | |
| 123 | static const struct button_mapping* get_context_mapping_remote( int context ) |
| 124 | { |
| 125 | context ^= CONTEXT_REMOTE; |
| 126 | |
| 127 | switch (context) |
| 128 | { |
| 129 | case CONTEXT_WPS: |
| 130 | return remote_button_context_wps; |
| 131 | |
| 132 | default: |
| 133 | return remote_button_context_standard; |
| 134 | } |
| 135 | } |
| 136 | |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 137 | const struct button_mapping* get_context_mapping( int context ) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 138 | { |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 139 | if (context&CONTEXT_REMOTE) |
| 140 | return get_context_mapping_remote(context); |
| 141 | |
| 142 | switch (context) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 143 | { |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 144 | case CONTEXT_WPS: |
| 145 | return button_context_wps; |
| 146 | |
| 147 | case CONTEXT_SETTINGS: |
| 148 | return button_context_settings; |
| 149 | |
| 150 | case CONTEXT_YESNOSCREEN: |
| 151 | return button_context_yesno; |
| 152 | |
| 153 | case CONTEXT_TREE: |
Jonathan Gordon | a053e58 | 2007-04-08 01:33:01 +0000 | [diff] [blame] | 154 | case CONTEXT_MAINMENU: |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 155 | return button_context_tree; |
Jonathan Gordon | 2e3cfaf | 2006-08-23 08:53:38 +0000 | [diff] [blame] | 156 | case CONTEXT_BOOKMARKSCREEN: |
| 157 | return button_context_bmark; |
Jens Arnold | f39add3 | 2006-08-16 20:12:27 +0000 | [diff] [blame] | 158 | case CONTEXT_STD: |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 159 | case CONTEXT_LIST: |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 160 | default: |
| 161 | return button_context_standard; |
| 162 | } |
| 163 | } |