* Onda VX747: add browse screen, pitchscreen, context menu, quickscreen, rewind...
[kugel-rb.git] / apps / keymaps / keymap-ondavx747.c
blob6eb2230d49cf952f76eddeee75f0305e9a3f2a45
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Maurus Cuelenaere
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 the Onda VX747 target */
23 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
25 #include <stdio.h>
26 #include <string.h>
27 #include <stdlib.h>
29 #include "config.h"
30 #include "action.h"
31 #include "button.h"
32 #include "settings.h"
35 * The format of the list is as follows
36 * { Action Code, Button code, Prereq button code }
37 * if there's no need to check the previous button's value, use BUTTON_NONE
38 * Insert LAST_ITEM_IN_LIST at the end of each mapping
41 static const struct button_mapping button_context_standard[] = {
42 { ACTION_STD_PREV, BUTTON_VOL_DOWN, BUTTON_NONE },
43 { ACTION_STD_PREVREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
44 { ACTION_STD_NEXT, BUTTON_VOL_UP, BUTTON_NONE },
45 { ACTION_STD_NEXTREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
47 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
48 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
50 { ACTION_STD_QUICKSCREEN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
51 { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
53 LAST_ITEM_IN_LIST
54 }; /* button_context_standard */
57 static const struct button_mapping button_context_wps[] = {
59 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
60 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
62 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
64 { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
66 { ACTION_WPS_MENU, BUTTON_POWER, BUTTON_NONE },
68 LAST_ITEM_IN_LIST
69 }; /* button_context_wps */
71 static const struct button_mapping button_context_list[] = {
72 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
73 }; /* button_context_list */
75 static const struct button_mapping button_context_tree[] = {
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
77 }; /* button_context_tree */
79 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
80 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
83 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
87 static const struct button_mapping button_context_settings[] = {
88 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
89 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
90 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
91 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
92 { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE },
93 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
96 }; /* button_context_settings */
98 static const struct button_mapping button_context_settings_right_is_inc[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
101 }; /* button_context_settingsgraphical */
103 static const struct button_mapping button_context_yesno[] = {
104 { ACTION_YESNO_ACCEPT, BUTTON_MENU, BUTTON_NONE },
105 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
106 }; /* button_context_settings_yesno */
108 static const struct button_mapping button_context_colorchooser[] = {
109 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
110 }; /* button_context_colorchooser */
112 static const struct button_mapping button_context_eq[] = {
113 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
114 }; /* button_context_eq */
116 /** Bookmark Screen **/
117 static const struct button_mapping button_context_bmark[] = {
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
119 }; /* button_context_bmark */
121 static const struct button_mapping button_context_time[] = {
122 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
123 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
124 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
125 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
126 { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
127 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
129 }; /* button_context_time */
131 static const struct button_mapping button_context_quickscreen[] = {
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
134 }; /* button_context_quickscreen */
136 static const struct button_mapping button_context_pitchscreen[] = {
138 { ACTION_PS_INC_SMALL, BUTTON_VOL_UP, BUTTON_NONE },
139 { ACTION_PS_INC_SMALL, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
140 { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN, BUTTON_NONE },
141 { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
142 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144 }; /* button_context_pitchcreen */
146 /** FM Radio Screen **/
147 static const struct button_mapping button_context_radio[] = {
148 { ACTION_STD_PREV, BUTTON_VOL_DOWN, BUTTON_NONE },
149 { ACTION_STD_PREVREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_STD_NEXT, BUTTON_VOL_UP, BUTTON_NONE },
151 { ACTION_STD_NEXTREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_FM_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
153 { ACTION_FM_PRESET, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
154 { ACTION_FM_MODE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
155 { ACTION_FM_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
157 }; /* button_context_radio */
159 static const struct button_mapping button_context_keyboard[] = {
160 { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE },
161 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE },
162 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP, BUTTON_NONE },
164 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
165 { ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
167 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
168 }; /* button_context_keyboard */
170 #ifdef HAVE_USBSTACK
171 static const struct button_mapping button_context_usb_hid[] = {
172 { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
173 { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
174 { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
175 { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
176 { ACTION_USB_HID_MUTE, BUTTON_POWER, BUTTON_NONE },
177 { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
179 LAST_ITEM_IN_LIST
180 }; /* button_context_usb_hid */
181 #endif
183 const struct button_mapping* target_get_context_mapping(int context)
185 switch (context)
187 case CONTEXT_STD:
188 return button_context_standard;
189 case CONTEXT_WPS:
190 return button_context_wps;
192 case CONTEXT_LIST:
193 return button_context_list;
194 case CONTEXT_MAINMENU:
195 case CONTEXT_TREE:
196 if (global_settings.hold_lr_for_scroll_in_list)
197 return button_context_listtree_scroll_without_combo;
198 else
199 return button_context_listtree_scroll_with_combo;
200 case CONTEXT_CUSTOM|CONTEXT_TREE:
201 return button_context_tree;
203 case CONTEXT_SETTINGS:
204 return button_context_settings;
205 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
206 case CONTEXT_SETTINGS_RECTRIGGER:
207 return button_context_settings_right_is_inc;
209 case CONTEXT_SETTINGS_COLOURCHOOSER:
210 return button_context_colorchooser;
211 case CONTEXT_SETTINGS_EQ:
212 return button_context_eq;
214 case CONTEXT_SETTINGS_TIME:
215 return button_context_time;
217 case CONTEXT_YESNOSCREEN:
218 return button_context_yesno;
219 case CONTEXT_FM:
220 return button_context_radio;
221 case CONTEXT_BOOKMARKSCREEN:
222 return button_context_bmark;
223 case CONTEXT_QUICKSCREEN:
224 return button_context_quickscreen;
225 case CONTEXT_PITCHSCREEN:
226 return button_context_pitchscreen;
227 case CONTEXT_KEYBOARD:
228 return button_context_keyboard;
229 #ifdef HAVE_USBSTACK
230 case CONTEXT_USB_HID:
231 return button_context_usb_hid;
232 #endif
234 return button_context_standard;