1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 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 Creative Zen Vision target */
23 /* Copied from ZVM target for now... */
34 * The format of the list is as follows
35 * { Action Code, Button code, Prereq button code }
36 * if there's no need to check the previous button's value, use BUTTON_NONE
37 * Insert LAST_ITEM_IN_LIST at the end of each mapping
40 /* CONTEXT_CUSTOM's used in this file...
42 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
43 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
44 i.e where up/down is inc/dec
45 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
49 static const struct button_mapping button_context_standard
[] = {
50 { ACTION_STD_PREV
, BUTTON_UP
|BUTTON_REL
, BUTTON_NONE
},
51 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
52 { ACTION_STD_NEXT
, BUTTON_DOWN
|BUTTON_REL
, BUTTON_NONE
},
53 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
55 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
56 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
58 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
60 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
61 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
63 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
64 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
67 }; /* button_context_standard */
70 static const struct button_mapping button_context_wps
[] = {
71 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
72 { ACTION_WPS_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
74 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
75 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
77 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
78 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
79 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
80 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
82 //{ ACTION_WPS_ABSETB_NEXTDIR,BUTTON_RIGHT, BUTTON_CUSTOM },
83 //{ ACTION_WPS_ABSETA_PREVDIR,BUTTON_LEFT, BUTTON_CUSTOM },
84 //{ ACTION_WPS_ABRESET, BUTTON_CUSTOM|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
87 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
88 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
89 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
91 { ACTION_WPS_PITCHSCREEN
, BUTTON_BACK
|BUTTON_REPEAT
, BUTTON_BACK
},
93 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
94 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
95 { ACTION_WPS_VIEW_PLAYLIST
, BUTTON_POWER
, BUTTON_NONE
},
96 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
98 { ACTION_WPS_HOTKEY
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
99 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_BACK
},
101 }; /* button_context_wps */
103 static const struct button_mapping button_context_list
[] = {
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
105 }; /* button_context_list */
107 static const struct button_mapping button_context_tree
[] = {
108 { ACTION_TREE_WPS
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
109 { ACTION_TREE_STOP
, BUTTON_POWER
, BUTTON_NONE
},
110 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
111 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
112 { ACTION_TREE_HOTKEY
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
115 }; /* button_context_tree */
117 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
118 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
119 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
120 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
121 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
122 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
123 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
124 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
128 static const struct button_mapping button_context_settings
[] = {
129 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
130 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_UP
},
131 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
132 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_DOWN
},
133 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
134 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
135 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
136 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_RIGHT
},
137 { ACTION_SETTINGS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
138 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
139 }; /* button_context_settings */
141 static const struct button_mapping button_context_settings_right_is_inc
[] = {
142 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
143 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
144 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
145 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
146 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
147 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
148 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
149 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
150 { ACTION_SETTINGS_RESET
, BUTTON_BACK
, BUTTON_NONE
},
151 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
152 }; /* button_context_settingsgraphical */
154 static const struct button_mapping button_context_yesno
[] = {
155 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
157 }; /* button_context_settings_yesno */
159 static const struct button_mapping button_context_colorchooser
[] = {
160 { ACTION_STD_OK
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
162 }; /* button_context_colorchooser */
164 static const struct button_mapping button_context_eq
[] = {
165 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
166 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
167 }; /* button_context_eq */
169 /** Bookmark Screen **/
170 static const struct button_mapping button_context_bmark
[] = {
171 { ACTION_BMS_DELETE
, BUTTON_BACK
, BUTTON_NONE
},
172 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
173 }; /* button_context_bmark */
175 static const struct button_mapping button_context_time
[] = {
176 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
177 }; /* button_context_time */
179 static const struct button_mapping button_context_quickscreen
[] = {
180 { ACTION_QS_TOP
, BUTTON_UP
, BUTTON_NONE
},
181 { ACTION_QS_TOP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
182 { ACTION_QS_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
183 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
184 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
185 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
186 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
187 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
188 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
189 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
190 }; /* button_context_quickscreen */
192 static const struct button_mapping button_context_pitchscreen
[] = {
194 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
195 }; /* button_context_pitchcreen */
197 static const struct button_mapping button_context_keyboard
[] = {
198 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
199 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
200 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
201 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
202 { ACTION_KBD_CURSOR_LEFT
, BUTTON_CUSTOM
, BUTTON_NONE
},
203 { ACTION_KBD_CURSOR_LEFT
, BUTTON_CUSTOM
|BUTTON_REPEAT
, BUTTON_NONE
},
204 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
, BUTTON_NONE
},
205 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
206 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
207 { ACTION_KBD_PAGE_FLIP
, BUTTON_BACK
|BUTTON_MENU
, BUTTON_NONE
},
208 { ACTION_KBD_DONE
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
209 { ACTION_KBD_ABORT
, BUTTON_BACK
|BUTTON_REL
, BUTTON_BACK
},
210 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
, BUTTON_NONE
},
211 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
212 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
213 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
214 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
215 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
216 { ACTION_KBD_MORSE_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
218 }; /* button_context_keyboard */
220 const struct button_mapping
* get_context_mapping(int context
)
222 switch (context
&~CONTEXT_REMOTE
)
225 return button_context_standard
;
227 return button_context_wps
;
229 return button_context_list
;
230 case CONTEXT_MAINMENU
:
232 return button_context_listtree_scroll_without_combo
;
233 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
234 return button_context_tree
;
235 case CONTEXT_SETTINGS
:
236 return button_context_settings
;
237 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
238 return button_context_settings_right_is_inc
;
239 case CONTEXT_SETTINGS_COLOURCHOOSER
:
240 return button_context_colorchooser
;
241 case CONTEXT_SETTINGS_EQ
:
242 return button_context_eq
;
243 case CONTEXT_SETTINGS_TIME
:
244 return button_context_time
;
245 case CONTEXT_YESNOSCREEN
:
246 return button_context_yesno
;
247 case CONTEXT_BOOKMARKSCREEN
:
248 return button_context_bmark
;
249 case CONTEXT_QUICKSCREEN
:
250 return button_context_quickscreen
;
251 case CONTEXT_PITCHSCREEN
:
252 return button_context_pitchscreen
;
253 case CONTEXT_KEYBOARD
:
254 case CONTEXT_MORSE_INPUT
:
255 return button_context_keyboard
;
257 return button_context_standard
;