1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Mark Arigo
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 /* Button Code Definitions for Iaudio[67] target */
28 /* {Action Code, Button code, Prereq button code } */
31 * The format of the list is as follows
32 * { Action Code, Button code, Prereq button code }
33 * if there's no need to check the previous button's value, use BUTTON_NONE
34 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 static const struct button_mapping button_context_standard
[] = {
37 { ACTION_STD_PREV
, BUTTON_RIGHT
, BUTTON_NONE
},
38 { ACTION_STD_PREVREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
40 { ACTION_STD_NEXT
, BUTTON_LEFT
, BUTTON_NONE
},
41 { ACTION_STD_NEXTREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
43 { ACTION_STD_OK
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
44 { ACTION_STD_OK
, BUTTON_PLAY
, BUTTON_NONE
},
45 { ACTION_STD_CANCEL
, BUTTON_STOP
, BUTTON_NONE
},
46 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
48 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
49 { ACTION_STD_CONTEXT
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
50 // { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_PLAY, BUTTON_NONE },
53 }; /* button_context_standard */
56 static const struct button_mapping button_context_wps
[] = {
58 { ACTION_WPS_VOLDOWN
, BUTTON_VOLDOWN
, BUTTON_NONE
},
59 { ACTION_WPS_VOLDOWN
, BUTTON_VOLDOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
60 { ACTION_WPS_VOLUP
, BUTTON_VOLUP
, BUTTON_NONE
},
61 { ACTION_WPS_VOLUP
, BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_NONE
},
62 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
63 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
65 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
66 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
67 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
69 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
70 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
71 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
73 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
74 { ACTION_WPS_STOP
, BUTTON_STOP
, BUTTON_NONE
},
77 }; /* button_context_wps */
79 static const struct button_mapping button_context_settings
[] = {
80 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
81 // { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
83 { ACTION_SETTINGS_INC
, BUTTON_VOLUP
, BUTTON_NONE
},
84 { ACTION_SETTINGS_INCREPEAT
,BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_NONE
},
86 { ACTION_SETTINGS_DEC
, BUTTON_VOLDOWN
, BUTTON_NONE
},
87 { ACTION_SETTINGS_DECREPEAT
,BUTTON_VOLDOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
89 { ACTION_STD_PREV
, BUTTON_RIGHT
, BUTTON_NONE
},
90 { ACTION_STD_PREVREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
92 { ACTION_STD_NEXT
, BUTTON_LEFT
, BUTTON_NONE
},
93 { ACTION_STD_NEXTREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
96 }; /* button_context_settings */
98 static const struct button_mapping button_context_list
[] = {
99 #ifdef HAVE_VOLUME_IN_LIST
100 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
101 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
103 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
104 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
108 }; /* button_context_list */
110 static const struct button_mapping button_context_tree
[] = {
111 // { ACTION_TREE_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC },
112 // { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP },
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
115 }; /* button_context_tree */
117 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
119 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
120 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
121 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
122 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
123 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
125 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
126 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
127 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
128 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
130 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
131 }; /* button_context_listtree_scroll_without_combo */
133 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
134 // { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
136 // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
137 // { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
139 // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
140 // { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
143 }; /* button_context_listtree_scroll_with_combo */
145 static const struct button_mapping button_context_yesno
[] = {
146 // { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
148 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
149 }; /* button_context_settings_yesno */
151 static const struct button_mapping button_context_quickscreen
[] = {
153 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
154 { ACTION_STD_CANCEL
, BUTTON_MENU
|BUTTON_REL
, BUTTON_NONE
},
156 { ACTION_QS_DOWNINV
, BUTTON_VOLUP
|BUTTON_REL
, BUTTON_NONE
},
157 { ACTION_QS_DOWNINV
, BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_NONE
},
159 { ACTION_QS_DOWN
, BUTTON_VOLDOWN
|BUTTON_REL
, BUTTON_NONE
},
160 { ACTION_QS_DOWN
, BUTTON_VOLDOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
162 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
163 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
165 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
166 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
168 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
169 }; /* button_context_quickscreen */
171 static const struct button_mapping button_context_settings_right_is_inc
[] = {
173 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
174 { ACTION_SETTINGS_INCREPEAT
,BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
176 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
177 { ACTION_SETTINGS_DECREPEAT
,BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
179 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
181 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
182 }; /* button_context_settings_right_is_inc */
184 static const struct button_mapping button_context_pitchscreen
[] = {
186 { ACTION_PS_INC_SMALL
, BUTTON_VOLUP
, BUTTON_NONE
},
187 { ACTION_PS_INC_BIG
, BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_NONE
},
189 { ACTION_PS_DEC_SMALL
, BUTTON_VOLDOWN
, BUTTON_NONE
},
190 { ACTION_PS_DEC_BIG
, BUTTON_VOLDOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
192 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
193 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
195 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
196 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
198 { ACTION_PS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
199 { ACTION_PS_EXIT
, BUTTON_MENU
, BUTTON_NONE
},
201 { ACTION_PS_SLOWER
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
202 { ACTION_PS_FASTER
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
205 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
206 }; /* button_context_pitchscreen */
208 /** Recording Screen **/
209 #ifdef HAVE_RECORDING
210 static const struct button_mapping button_context_recscreen
[] = {
211 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
212 { ACTION_REC_PAUSE
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
213 { ACTION_STD_CANCEL
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
214 // { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
216 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
217 { ACTION_SETTINGS_INCREPEAT
,BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
218 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
219 { ACTION_SETTINGS_DECREPEAT
,BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
221 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
222 }; /* button_context_recscreen */
225 /** FM Radio Screen **/
227 static const struct button_mapping button_context_radio
[] = {
228 { ACTION_NONE
, BUTTON_VOLUP
, BUTTON_NONE
},
229 { ACTION_FM_MENU
, BUTTON_VOLDOWN
, BUTTON_NONE
},
230 { ACTION_FM_PRESET
, BUTTON_PLAY
, BUTTON_NONE
},
231 { ACTION_FM_STOP
, BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_VOLUP
},
232 // { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE },
233 { ACTION_FM_EXIT
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
234 { ACTION_FM_PLAY
, BUTTON_VOLUP
|BUTTON_REL
, BUTTON_VOLUP
},
235 { ACTION_SETTINGS_INC
, BUTTON_LEFT
, BUTTON_NONE
},
236 { ACTION_SETTINGS_INCREPEAT
,BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
237 { ACTION_SETTINGS_DEC
, BUTTON_RIGHT
, BUTTON_NONE
},
238 { ACTION_SETTINGS_DECREPEAT
,BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
240 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
241 }; /* button_context_radio */
244 static const struct button_mapping button_context_keyboard
[] = {
245 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
246 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
247 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
248 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
250 // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
251 // { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
252 // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
253 // { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
255 { ACTION_KBD_UP
, BUTTON_VOLUP
, BUTTON_NONE
},
256 { ACTION_KBD_UP
, BUTTON_VOLUP
|BUTTON_REPEAT
, BUTTON_NONE
},
257 { ACTION_KBD_DOWN
, BUTTON_VOLDOWN
, BUTTON_NONE
},
258 { ACTION_KBD_DOWN
, BUTTON_VOLDOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
260 // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
261 // { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
263 // { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_PLAY, BUTTON_REC },
265 { ACTION_KBD_SELECT
, BUTTON_PLAY
, BUTTON_NONE
},
266 { ACTION_KBD_DONE
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
267 { ACTION_KBD_ABORT
, BUTTON_MENU
, BUTTON_NONE
},
270 }; /* button_context_keyboard */
272 static const struct button_mapping button_context_bmark
[] = {
273 // { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
275 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
276 }; /* button_context_bmark */
278 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
279 const struct button_mapping
* get_context_mapping(int context
)
284 return button_context_standard
;
287 return button_context_wps
;
290 return button_context_list
;
292 case CONTEXT_MAINMENU
:
293 if (global_settings
.hold_lr_for_scroll_in_list
)
294 return button_context_listtree_scroll_without_combo
;
296 return button_context_listtree_scroll_with_combo
;
297 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
298 return button_context_tree
;
300 case CONTEXT_SETTINGS
:
301 case CONTEXT_SETTINGS_TIME
:
302 return button_context_settings
;
303 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
304 case CONTEXT_SETTINGS_COLOURCHOOSER
:
305 case CONTEXT_SETTINGS_EQ
:
306 return button_context_settings_right_is_inc
;
308 case CONTEXT_YESNOSCREEN
:
309 return button_context_yesno
;
312 return button_context_radio
;
314 case CONTEXT_BOOKMARKSCREEN
:
315 return button_context_bmark
;
316 case CONTEXT_QUICKSCREEN
:
317 return button_context_quickscreen
;
318 case CONTEXT_PITCHSCREEN
:
319 return button_context_pitchscreen
;
320 #ifdef HAVE_RECORDING
321 case CONTEXT_RECSCREEN
:
322 return button_context_recscreen
;
324 case CONTEXT_KEYBOARD
:
325 return button_context_keyboard
;
328 return button_context_standard
;
330 return button_context_standard
;