Improve usb descriptor handling. This should fix any cache and/or alignment related...
[Rockbox.git] / apps / keymaps / keymap-h10.c
blob2ea934bd9aed58ad47947b5636177770eee3ecf5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) Barry Wardell 2006
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 /* Button Code Definitions for iriver H10 target */
22 #include "config.h"
23 #include "action.h"
24 #include "button.h"
25 #include "settings.h"
27 /* {Action Code, Button code, Prereq button code } */
29 /*
30 * The format of the list is as follows
31 * { Action Code, Button code, Prereq button code }
32 * if there's no need to check the previous button's value, use BUTTON_NONE
33 * Insert LAST_ITEM_IN_LIST at the end of each mapping
35 static const struct button_mapping button_context_standard[] = {
36 { ACTION_STD_PREV, BUTTON_SCROLL_UP, BUTTON_NONE },
37 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
38 { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
41 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
42 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
43 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
44 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
45 { ACTION_STD_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
47 /* TODO: this is a bit of a hack so that we can exit some debug screens
48 * (audio, tagcache, dircache, hwinfo, stack, ports). They don't like it
49 * when ACTION_STD_CANCEL has anything other than BUTTON_NONE for prereq.
51 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
53 LAST_ITEM_IN_LIST
54 }; /* button_context_standard */
56 static const struct button_mapping remote_button_context_standard[] = {
57 { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
58 { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
60 { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
62 LAST_ITEM_IN_LIST
63 }; /* remote_button_context_standard */
65 static const struct button_mapping button_context_wps[] = {
66 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
67 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT,BUTTON_PLAY },
68 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW},
69 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
70 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
71 { ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
72 { ACTION_WPS_SEEKFWD, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_REPEAT },
75 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_FF, BUTTON_POWER },
76 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_REW, BUTTON_POWER },
77 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_PLAY, BUTTON_POWER },
79 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
80 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
81 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE },
82 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_BROWSE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
85 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
86 { ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
87 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
88 { ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
89 { ACTION_WPS_ID3SCREEN, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
91 LAST_ITEM_IN_LIST
92 }; /* button_context_wps */
94 static const struct button_mapping remote_button_context_wps[] = {
95 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
96 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT,BUTTON_RC_PLAY },
97 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW},
98 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
99 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
100 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
101 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
102 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
104 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
105 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
106 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
107 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_WPS_PITCHSCREEN, BUTTON_RC_PLAY|BUTTON_LEFT, BUTTON_RC_PLAY },
110 { ACTION_WPS_ID3SCREEN, BUTTON_RC_PLAY|BUTTON_RIGHT, BUTTON_RC_PLAY },
112 LAST_ITEM_IN_LIST
113 }; /* remote_button_context_wps */
115 static const struct button_mapping button_context_settings[] = {
116 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
117 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
118 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
119 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
120 { ACTION_STD_PREV, BUTTON_FF, BUTTON_NONE },
121 { ACTION_STD_PREVREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
122 { ACTION_STD_NEXT, BUTTON_REW, BUTTON_NONE },
123 { ACTION_STD_NEXTREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
124 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
126 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
127 }; /* button_context_settings */
129 static const struct button_mapping button_context_list[] = {
130 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REL, BUTTON_REW },
131 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF },
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
134 }; /* button_context_list */
136 static const struct button_mapping remote_button_context_list[] = {
137 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
138 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
140 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
141 }; /* button_context_list */
143 static const struct button_mapping button_context_tree[] = {
144 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
145 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
148 }; /* button_context_tree */
150 static const struct button_mapping remote_button_context_tree[] = {
151 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
152 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
154 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
155 }; /* button_context_tree */
157 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
158 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
159 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
160 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
162 }; /* button_context_listtree_scroll_without_combo */
164 static const struct button_mapping remote_button_context_listtree_scroll_without_combo[] = {
165 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
166 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
168 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
169 }; /* button_context_listtree_scroll_without_combo */
171 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
172 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
173 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
174 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_PLAY },
175 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_PLAY },
176 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_REW|BUTTON_REL },
177 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_REW|BUTTON_PLAY },
178 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
179 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_PLAY },
180 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_PLAY },
181 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_FF|BUTTON_REL },
182 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
183 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
184 }; /* button_context_listtree_scroll_with_combo */
186 static const struct button_mapping remote_button_context_listtree_scroll_with_combo[] = {
187 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
188 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
189 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
190 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_RC_PLAY },
191 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_REW|BUTTON_REL },
192 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_REW|BUTTON_RC_PLAY },
193 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
194 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
195 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_RC_PLAY },
196 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_FF|BUTTON_REL },
197 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
199 }; /* button_context_listtree_scroll_with_combo */
201 static const struct button_mapping button_context_yesno[] = {
202 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
203 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
204 }; /* button_context_settings_yesno */
206 static const struct button_mapping button_context_quickscreen[] = {
207 { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP, BUTTON_NONE },
208 { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
209 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
210 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
211 { ACTION_QS_LEFT, BUTTON_REW, BUTTON_NONE },
212 { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
213 { ACTION_QS_RIGHT, BUTTON_FF, BUTTON_NONE },
214 { ACTION_QS_RIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
216 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
217 }; /* button_context_quickscreen */
219 static const struct button_mapping remote_button_context_quickscreen[] = {
220 { ACTION_QS_DOWNINV, BUTTON_RC_VOL_UP, BUTTON_NONE },
221 { ACTION_QS_DOWNINV, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
222 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
223 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
225 { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
226 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
227 { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
229 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
230 }; /* button_context_quickscreen */
232 static const struct button_mapping button_context_settings_right_is_inc[] = {
233 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
234 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
235 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
236 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
237 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
238 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
240 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
241 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
242 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
243 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
244 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
246 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
247 }; /* button_context_settings_right_is_inc */
249 static const struct button_mapping button_context_pitchscreen[] = {
250 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_UP, BUTTON_NONE },
251 { ACTION_PS_INC_BIG, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
252 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_DOWN, BUTTON_NONE },
253 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_PS_NUDGE_LEFT, BUTTON_REW, BUTTON_NONE },
255 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
256 { ACTION_PS_NUDGE_RIGHT, BUTTON_FF, BUTTON_NONE },
257 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FF|BUTTON_REL, BUTTON_NONE },
258 { ACTION_PS_TOGGLE_MODE, BUTTON_POWER, BUTTON_NONE },
259 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
260 { ACTION_PS_EXIT, BUTTON_LEFT, BUTTON_NONE },
262 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
263 }; /* button_context_pitchscreen */
265 static const struct button_mapping remote_button_context_pitchscreen[] = {
266 { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE },
267 { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
268 { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
269 { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
270 { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE },
271 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE },
272 { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
273 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE },
274 { ACTION_PS_RESET, BUTTON_RC_PLAY, BUTTON_NONE },
276 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
277 }; /* button_context_pitchscreen */
279 static const struct button_mapping button_context_keyboard[] = {
280 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
281 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
282 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
283 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
284 { ACTION_KBD_SELECT, BUTTON_REW, BUTTON_NONE },
285 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
286 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
287 { ACTION_KBD_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
288 { ACTION_KBD_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
290 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_KBD_MORSE_INPUT, BUTTON_REW|BUTTON_PLAY, BUTTON_NONE },
292 { ACTION_KBD_MORSE_SELECT, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
294 LAST_ITEM_IN_LIST
295 }; /* button_context_keyboard */
297 static const struct button_mapping button_context_bmark[] = {
298 { ACTION_BMS_DELETE, BUTTON_REW, BUTTON_NONE },
299 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
300 }; /* button_context_bmark */
302 const struct button_mapping button_context_recscreen[] = {
303 { ACTION_REC_PAUSE, BUTTON_PLAY, BUTTON_NONE },
305 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
306 }; /* button_context_recscreen */
308 static const struct button_mapping button_context_radio[] = {
309 { ACTION_FM_PRESET, BUTTON_RIGHT | BUTTON_REL, BUTTON_RIGHT },
310 { ACTION_FM_MENU, BUTTON_RIGHT | BUTTON_REPEAT, BUTTON_NONE },
311 { ACTION_FM_MODE, BUTTON_LEFT, BUTTON_NONE },
312 { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
313 { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE },
314 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
315 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
316 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
317 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
318 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
319 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
320 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
321 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
322 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
324 LAST_ITEM_IN_LIST
328 static const struct button_mapping* get_context_mapping_remote( int context )
330 context ^= CONTEXT_REMOTE;
332 switch (context)
334 case CONTEXT_STD:
335 case CONTEXT_MAINMENU:
336 return remote_button_context_standard;
338 case CONTEXT_WPS:
339 return remote_button_context_wps;
341 case CONTEXT_LIST:
342 return remote_button_context_list;
343 case CONTEXT_TREE:
344 if (global_settings.hold_lr_for_scroll_in_list)
345 return remote_button_context_listtree_scroll_without_combo;
346 else
347 return remote_button_context_listtree_scroll_with_combo;
348 case CONTEXT_CUSTOM|CONTEXT_TREE:
349 return remote_button_context_tree;
351 case CONTEXT_QUICKSCREEN:
352 return remote_button_context_quickscreen;
353 case CONTEXT_PITCHSCREEN:
354 return remote_button_context_pitchscreen;
355 case CONTEXT_RECSCREEN:
356 return button_context_recscreen;
358 default:
359 return remote_button_context_standard;
363 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
364 const struct button_mapping* get_context_mapping(int context)
366 if (context&CONTEXT_REMOTE)
367 return get_context_mapping_remote(context);
369 switch (context)
371 case CONTEXT_STD:
372 return button_context_standard;
374 case CONTEXT_WPS:
375 return button_context_wps;
377 case CONTEXT_LIST:
378 return button_context_list;
379 case CONTEXT_TREE:
380 case CONTEXT_MAINMENU:
381 if (global_settings.hold_lr_for_scroll_in_list)
382 return button_context_listtree_scroll_without_combo;
383 else
384 return button_context_listtree_scroll_with_combo;
385 case CONTEXT_CUSTOM|CONTEXT_TREE:
386 return button_context_tree;
388 case CONTEXT_SETTINGS:
389 return button_context_settings;
390 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
391 case CONTEXT_SETTINGS_COLOURCHOOSER:
392 case CONTEXT_SETTINGS_EQ:
393 case CONTEXT_SETTINGS_TIME:
394 return button_context_settings_right_is_inc;
396 case CONTEXT_YESNOSCREEN:
397 return button_context_yesno;
398 case CONTEXT_BOOKMARKSCREEN:
399 return button_context_bmark;
400 case CONTEXT_QUICKSCREEN:
401 return button_context_quickscreen;
402 case CONTEXT_PITCHSCREEN:
403 return button_context_pitchscreen;
404 case CONTEXT_KEYBOARD:
405 return button_context_keyboard;
406 case CONTEXT_RECSCREEN:
407 return button_context_recscreen;
408 case CONTEXT_FM:
409 return button_context_radio;
410 default:
411 return button_context_standard;
413 return button_context_standard;