1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Maurus Cuelenaere
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 the Creative Zen Vision target */
21 /* Copied from ZVM target for now... */
32 * The format of the list is as follows
33 * { Action Code, Button code, Prereq button code }
34 * if there's no need to check the previous button's value, use BUTTON_NONE
35 * Insert LAST_ITEM_IN_LIST at the end of each mapping
38 /* CONTEXT_CUSTOM's used in this file...
40 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
41 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
42 i.e where up/down is inc/dec
43 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
47 static const struct button_mapping button_context_standard
[] = {
48 { ACTION_STD_PREV
, BUTTON_UP
|BUTTON_REL
, BUTTON_NONE
},
49 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
50 { ACTION_STD_NEXT
, BUTTON_DOWN
|BUTTON_REL
, BUTTON_NONE
},
51 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
53 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
54 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
56 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
58 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
59 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
61 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
62 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
65 }; /* button_context_standard */
68 static const struct button_mapping button_context_wps
[] = {
69 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
70 { ACTION_WPS_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
72 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
73 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
75 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
76 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
78 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
80 //{ ACTION_WPS_ABSETB_NEXTDIR,BUTTON_RIGHT, BUTTON_CUSTOM },
81 //{ ACTION_WPS_ABSETA_PREVDIR,BUTTON_LEFT, BUTTON_CUSTOM },
82 //{ ACTION_WPS_ABRESET, BUTTON_CUSTOM|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
85 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
86 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
87 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
89 { ACTION_WPS_PITCHSCREEN
, BUTTON_BACK
|BUTTON_REPEAT
, BUTTON_BACK
},
91 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
92 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
93 { ACTION_WPS_MENU
, BUTTON_POWER
, BUTTON_NONE
},
94 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
96 { ACTION_WPS_ID3SCREEN
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
97 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_BACK
},
99 }; /* button_context_wps */
101 static const struct button_mapping button_context_list
[] = {
102 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
103 }; /* button_context_list */
105 static const struct button_mapping button_context_tree
[] = {
106 { ACTION_TREE_WPS
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
107 { ACTION_TREE_STOP
, BUTTON_POWER
, BUTTON_NONE
},
108 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
109 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
111 }; /* button_context_tree */
113 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
114 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
115 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
116 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
117 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
118 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
119 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
120 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
121 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
122 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
126 static const struct button_mapping button_context_settings
[] = {
127 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
128 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_UP
},
129 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
130 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_DOWN
},
131 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
132 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
133 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
134 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_RIGHT
},
135 { ACTION_SETTINGS_RESET
, BUTTON_PLAY
, BUTTON_NONE
},
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
137 }; /* button_context_settings */
139 static const struct button_mapping button_context_settings_right_is_inc
[] = {
140 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
141 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
142 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
143 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
144 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
145 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
146 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
147 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
148 { ACTION_SETTINGS_RESET
, BUTTON_BACK
, BUTTON_NONE
},
149 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
150 }; /* button_context_settingsgraphical */
152 static const struct button_mapping button_context_yesno
[] = {
153 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
154 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
155 }; /* button_context_settings_yesno */
157 static const struct button_mapping button_context_colorchooser
[] = {
158 { ACTION_STD_OK
, BUTTON_BACK
|BUTTON_REL
, BUTTON_NONE
},
159 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
160 }; /* button_context_colorchooser */
162 static const struct button_mapping button_context_eq
[] = {
163 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
164 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
165 }; /* button_context_eq */
167 /** Bookmark Screen **/
168 static const struct button_mapping button_context_bmark
[] = {
169 { ACTION_BMS_DELETE
, BUTTON_BACK
, BUTTON_NONE
},
170 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
171 }; /* button_context_bmark */
173 static const struct button_mapping button_context_time
[] = {
174 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
175 }; /* button_context_time */
177 static const struct button_mapping button_context_quickscreen
[] = {
178 { ACTION_QS_DOWNINV
, BUTTON_UP
, BUTTON_NONE
},
179 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
180 { ACTION_QS_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
181 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
182 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
183 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
184 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
185 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
186 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
187 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
188 }; /* button_context_quickscreen */
190 static const struct button_mapping button_context_pitchscreen
[] = {
192 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
193 }; /* button_context_pitchcreen */
195 static const struct button_mapping button_context_keyboard
[] = {
196 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
197 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
198 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
199 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
200 { ACTION_KBD_CURSOR_LEFT
, BUTTON_CUSTOM
, BUTTON_NONE
},
201 { ACTION_KBD_CURSOR_LEFT
, BUTTON_CUSTOM
|BUTTON_REPEAT
, BUTTON_NONE
},
202 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
, BUTTON_NONE
},
203 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
204 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
205 { ACTION_KBD_PAGE_FLIP
, BUTTON_BACK
|BUTTON_MENU
, BUTTON_NONE
},
206 { ACTION_KBD_DONE
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
207 { ACTION_KBD_ABORT
, BUTTON_BACK
|BUTTON_REL
, BUTTON_BACK
},
208 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
, BUTTON_NONE
},
209 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
210 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
211 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
212 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
213 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
215 }; /* button_context_keyboard */
217 const struct button_mapping
* get_context_mapping(int context
)
219 switch (context
&~CONTEXT_REMOTE
)
222 return button_context_standard
;
224 return button_context_wps
;
226 return button_context_list
;
227 case CONTEXT_MAINMENU
:
229 return button_context_listtree_scroll_without_combo
;
230 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
231 return button_context_tree
;
232 case CONTEXT_SETTINGS
:
233 return button_context_settings
;
234 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
235 return button_context_settings_right_is_inc
;
236 case CONTEXT_SETTINGS_COLOURCHOOSER
:
237 return button_context_colorchooser
;
238 case CONTEXT_SETTINGS_EQ
:
239 return button_context_eq
;
240 case CONTEXT_SETTINGS_TIME
:
241 return button_context_time
;
242 case CONTEXT_YESNOSCREEN
:
243 return button_context_yesno
;
244 case CONTEXT_BOOKMARKSCREEN
:
245 return button_context_bmark
;
246 case CONTEXT_QUICKSCREEN
:
247 return button_context_quickscreen
;
248 case CONTEXT_PITCHSCREEN
:
249 return button_context_pitchscreen
;
250 case CONTEXT_KEYBOARD
:
251 return button_context_keyboard
;
253 return button_context_standard
;