Meizu M3: implement logarithmic brightness curve (curve provided by markun) and incre...
[kugel-rb.git] / apps / keymaps / keymap-yh8xx_yh9xx.c
blob2df862134fd8e4591f755cb1ce941445efe0d8e7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: keymap-h1x0_h3x0.c 17847 2008-06-28 18:10:04Z bagder $
10 * Copyright (C) 2006 Jonathan Gordon
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 ****************************************************************************/
22 /* Button Code Definitions for iriver h100/h300 target */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
30 #include "settings.h"
32 /*
33 * The format of the list is as follows
34 * { Action Code, Button code, Prereq button code }
35 * if there's no need to check the previous button's value, use BUTTON_NONE
36 * Insert LAST_ITEM_IN_LIST at the end of each mapping
39 /* CONTEXT_CUSTOM's used in this file...
41 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
42 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
43 i.e where up/down is inc/dec
44 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
49 static const struct button_mapping button_context_standard[] = {
50 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
51 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
53 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
54 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
56 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_STD_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
59 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
60 { ACTION_STD_QUICKSCREEN, BUTTON_FFWD|BUTTON_RIGHT, BUTTON_FFWD },
62 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
65 }; /* button_context_standard */
67 static const struct button_mapping button_context_wps[] = {
68 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
69 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
71 { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
72 { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
75 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
76 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
77 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
79 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
80 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
81 { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
83 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
85 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
88 { ACTION_WPS_BROWSE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
90 /* these match context_standard */
91 { ACTION_WPS_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
92 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
93 { ACTION_WPS_QUICKSCREEN, BUTTON_FFWD|BUTTON_RIGHT, BUTTON_FFWD },
95 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
97 LAST_ITEM_IN_LIST
98 }; /* button_context_wps */
100 static const struct button_mapping button_context_list[] = {
101 #ifdef SAMSUNG_YH820
102 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
103 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
104 #else
105 { ACTION_LISTTREE_PGUP, BUTTON_FFWD, BUTTON_NONE },
106 { ACTION_LISTTREE_PGDOWN, BUTTON_REW, BUTTON_NONE },
107 #endif
109 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
110 }; /* button_context_list */
112 static const struct button_mapping button_context_tree[] = {
113 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
114 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
116 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
117 }; /* button_context_tree */
119 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
120 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
122 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
123 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
125 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
126 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
131 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
132 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
133 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
134 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
136 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
137 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
139 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
140 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
145 static const struct button_mapping button_context_settings[] = {
146 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
147 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
149 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
150 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
153 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
155 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
156 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
158 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
160 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
161 }; /* button_context_settings */
163 static const struct button_mapping button_context_settings_right_is_inc[] = {
164 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
165 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
167 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
168 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
170 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
171 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
173 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
174 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
176 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
179 }; /* button_context_settingsgraphical */
181 static const struct button_mapping button_context_yesno[] = {
182 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
184 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
185 }; /* button_context_settings_yesno */
187 static const struct button_mapping button_context_colorchooser[] = {
188 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
190 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
191 }; /* button_context_settings_colorchooser */
193 static const struct button_mapping button_context_eq[] = {
194 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
196 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
197 }; /* button_context_settings_context_eq */
199 static const struct button_mapping button_context_bmark[] = {
200 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
202 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
203 }; /* button_context_settings_bmark */
205 static const struct button_mapping button_context_time[] = {
206 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
207 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
209 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
210 }; /* button_context_settings_bmark */
212 static const struct button_mapping button_context_quickscreen[] = {
213 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
214 { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
215 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
217 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
218 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
220 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
221 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
223 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
224 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
226 { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
227 { ACTION_STD_CANCEL, BUTTON_FFWD, BUTTON_NONE },
229 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
230 }; /* button_context_quickscreen */
232 static const struct button_mapping button_context_pitchscreen[] = {
233 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
234 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
236 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
237 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
240 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
242 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
243 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
245 { ACTION_PS_TOGGLE_MODE, BUTTON_FFWD, BUTTON_NONE },
246 { ACTION_PS_RESET, BUTTON_REW, BUTTON_NONE },
247 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
249 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
250 }; /* button_context_pitchcreen */
252 static const struct button_mapping button_context_recscreen[] = {
253 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
254 #ifdef SAMSUNG_YH820
255 /* the yh-820 has a rec button */
256 { ACTION_REC_NEWFILE, BUTTON_REC, BUTTON_NONE },
257 #else
258 /* the yh-920 & yh-925 have a rec switch */
259 { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
260 #endif
262 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
263 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
265 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
266 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
268 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
269 }; /* button_context_recscreen */
271 static const struct button_mapping button_context_keyboard[] = {
272 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
273 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
275 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
276 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
278 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
279 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
281 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
282 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
284 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW, BUTTON_NONE },
285 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
287 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD, BUTTON_NONE },
288 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
290 { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE },
291 { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW|BUTTON_REPEAT,BUTTON_NONE },
293 { ACTION_KBD_SELECT, BUTTON_PLAY, BUTTON_NONE },
294 { ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
296 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
297 { ACTION_KBD_ABORT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
299 { ACTION_KBD_MORSE_INPUT, BUTTON_PLAY|BUTTON_FFWD, BUTTON_NONE },
300 { ACTION_KBD_MORSE_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
302 LAST_ITEM_IN_LIST
303 }; /* button_context_keyboard */
305 const struct button_mapping* get_context_mapping(int context)
307 switch (context)
309 case CONTEXT_STD:
310 return button_context_standard;
311 case CONTEXT_WPS:
312 return button_context_wps;
314 case CONTEXT_LIST:
315 return button_context_list;
316 case CONTEXT_TREE:
317 case CONTEXT_MAINMENU:
318 if (global_settings.hold_lr_for_scroll_in_list)
319 return button_context_listtree_scroll_without_combo;
320 else
321 return button_context_listtree_scroll_with_combo;
322 case CONTEXT_CUSTOM|CONTEXT_TREE:
323 return button_context_tree;
325 case CONTEXT_SETTINGS:
326 return button_context_settings;
327 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
328 case CONTEXT_SETTINGS_RECTRIGGER:
329 return button_context_settings_right_is_inc;
331 case CONTEXT_SETTINGS_COLOURCHOOSER:
332 return button_context_colorchooser;
333 case CONTEXT_SETTINGS_EQ:
334 return button_context_eq;
336 case CONTEXT_SETTINGS_TIME:
337 return button_context_time;
339 case CONTEXT_YESNOSCREEN:
340 return button_context_yesno;
341 case CONTEXT_BOOKMARKSCREEN:
342 return button_context_bmark;
343 case CONTEXT_QUICKSCREEN:
344 return button_context_quickscreen;
345 case CONTEXT_PITCHSCREEN:
346 return button_context_pitchscreen;
347 case CONTEXT_RECSCREEN:
348 return button_context_recscreen;
349 case CONTEXT_KEYBOARD:
350 return button_context_keyboard;
352 return button_context_standard;