1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Mark Arigo
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 ****************************************************************************/
21 /* Button Code Definitions for Sandisk c200 target */
28 /* {Action Code, Button code, Prereq button code } */
31 * The format of the list is as follows
32 * { Action Code, Button code, Prereq button code }
33 * if there's no need to check the previous button's value, use BUTTON_NONE
34 * Insert LAST_ITEM_IN_LIST at the end of each mapping
36 static const struct button_mapping button_context_standard
[] = {
37 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
38 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
40 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
41 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
43 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
44 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
45 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
47 { ACTION_STD_MENU
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
48 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
49 { ACTION_STD_REC
, BUTTON_REC
|BUTTON_REPEAT
, BUTTON_REC
},
50 { ACTION_STD_QUICKSCREEN
, BUTTON_REC
|BUTTON_SELECT
, BUTTON_REC
},
53 }; /* button_context_standard */
56 static const struct button_mapping button_context_wps
[] = {
57 { ACTION_WPS_PLAY
, BUTTON_UP
|BUTTON_REL
, BUTTON_UP
},
58 { ACTION_WPS_STOP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_UP
},
60 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
61 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
62 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
64 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
65 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
66 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
68 { ACTION_WPS_ABSETB_NEXTDIR
,BUTTON_POWER
|BUTTON_RIGHT
, BUTTON_POWER
},
69 { ACTION_WPS_ABSETA_PREVDIR
,BUTTON_POWER
|BUTTON_LEFT
, BUTTON_POWER
},
70 { ACTION_WPS_ABRESET
, BUTTON_POWER
|BUTTON_UP
, BUTTON_POWER
},
72 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
73 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
74 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
75 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_WPS_MENU
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
78 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
79 { ACTION_WPS_PITCHSCREEN
, BUTTON_SELECT
|BUTTON_UP
, BUTTON_SELECT
},
80 { ACTION_WPS_ID3SCREEN
, BUTTON_SELECT
|BUTTON_DOWN
, BUTTON_SELECT
},
81 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
82 { ACTION_WPS_QUICKSCREEN
, BUTTON_DOWN
, BUTTON_NONE
},
83 { ACTION_WPS_REC
, BUTTON_REC
|BUTTON_REPEAT
, BUTTON_NONE
},
86 }; /* button_context_wps */
88 static const struct button_mapping button_context_settings
[] = {
89 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
90 { ACTION_SETTINGS_RESET
, BUTTON_SELECT
, BUTTON_NONE
},
92 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
93 { ACTION_SETTINGS_INCREPEAT
,BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
95 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
96 { ACTION_SETTINGS_DECREPEAT
,BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
98 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
99 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
101 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
102 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
104 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
105 }; /* button_context_settings */
107 static const struct button_mapping button_context_list
[] = {
108 { ACTION_LISTTREE_PGUP
, BUTTON_REC
|BUTTON_UP
, BUTTON_REC
},
109 { ACTION_LISTTREE_PGDOWN
, BUTTON_REC
|BUTTON_DOWN
, BUTTON_REC
},
111 #ifdef HAVE_VOLUME_IN_LIST
112 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
113 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
114 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
115 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
119 }; /* button_context_list */
121 static const struct button_mapping button_context_tree
[] = {
122 { ACTION_TREE_WPS
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_RIGHT
},
124 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
125 }; /* button_context_tree */
127 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
128 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
130 { ACTION_TREE_PGLEFT
, BUTTON_REC
|BUTTON_LEFT
, BUTTON_REC
},
131 { ACTION_TREE_PGLEFT
, BUTTON_REC
|BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
133 { ACTION_TREE_PGRIGHT
, BUTTON_REC
|BUTTON_RIGHT
, BUTTON_REC
},
134 { ACTION_TREE_PGRIGHT
, BUTTON_REC
|BUTTON_RIGHT
|BUTTON_REPEAT
,BUTTON_NONE
},
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
137 }; /* button_context_listtree_scroll_with_combo */
139 static const struct button_mapping button_context_yesno
[] = {
140 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
142 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
143 }; /* button_context_settings_yesno */
145 static const struct button_mapping button_context_quickscreen
[] = {
146 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
147 { ACTION_STD_CANCEL
, BUTTON_POWER
|BUTTON_REL
, BUTTON_NONE
},
149 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REL
, BUTTON_NONE
},
150 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
152 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REL
, BUTTON_NONE
},
153 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
155 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
156 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
158 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
159 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
162 }; /* button_context_quickscreen */
164 static const struct button_mapping button_context_settings_right_is_inc
[] = {
165 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
166 { ACTION_SETTINGS_INCREPEAT
,BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
168 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
169 { ACTION_SETTINGS_DECREPEAT
,BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
171 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
173 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
174 }; /* button_context_settings_right_is_inc */
176 static const struct button_mapping button_context_pitchscreen
[] = {
177 { ACTION_PS_INC_SMALL
, BUTTON_UP
, BUTTON_NONE
},
178 { ACTION_PS_INC_BIG
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
179 { ACTION_PS_DEC_SMALL
, BUTTON_DOWN
, BUTTON_NONE
},
180 { ACTION_PS_DEC_BIG
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
181 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
182 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
183 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
184 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
185 { ACTION_PS_TOGGLE_MODE
, BUTTON_REC
, BUTTON_NONE
},
186 { ACTION_PS_RESET
, BUTTON_SELECT
, BUTTON_NONE
},
187 { ACTION_PS_EXIT
, BUTTON_POWER
, BUTTON_NONE
},
188 { ACTION_PS_SLOWER
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
189 { ACTION_PS_FASTER
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
190 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
),
191 }; /* button_context_pitchscreen */
193 /** Recording Screen **/
194 #ifdef HAVE_RECORDING
195 static const struct button_mapping button_context_recscreen
[] = {
196 { ACTION_STD_MENU
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
197 { ACTION_REC_PAUSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
198 { ACTION_STD_CANCEL
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
199 { ACTION_REC_NEWFILE
, BUTTON_REC
|BUTTON_REL
, BUTTON_REC
},
201 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
202 { ACTION_SETTINGS_INCREPEAT
,BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
203 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
204 { ACTION_SETTINGS_DECREPEAT
,BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
206 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
207 }; /* button_context_recscreen */
210 /** FM Radio Screen **/
212 static const struct button_mapping button_context_radio
[] = {
213 { ACTION_NONE
, BUTTON_UP
, BUTTON_NONE
},
214 { ACTION_FM_MENU
, BUTTON_DOWN
, BUTTON_NONE
},
215 { ACTION_FM_PRESET
, BUTTON_SELECT
, BUTTON_NONE
},
216 { ACTION_FM_STOP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_UP
},
217 { ACTION_FM_MODE
, BUTTON_REC
, BUTTON_NONE
},
218 { ACTION_FM_EXIT
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
219 { ACTION_FM_PLAY
, BUTTON_UP
|BUTTON_REL
, BUTTON_UP
},
220 { ACTION_SETTINGS_INC
, BUTTON_VOL_UP
, BUTTON_NONE
},
221 { ACTION_SETTINGS_INCREPEAT
,BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
222 { ACTION_SETTINGS_DEC
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
223 { ACTION_SETTINGS_DECREPEAT
,BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
225 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
226 }; /* button_context_radio */
229 static const struct button_mapping button_context_keyboard
[] = {
230 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
231 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
232 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
233 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
234 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
235 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
236 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
237 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
239 { ACTION_KBD_CURSOR_LEFT
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
240 { ACTION_KBD_CURSOR_LEFT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
241 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_VOL_UP
, BUTTON_NONE
},
242 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
243 { ACTION_KBD_BACKSPACE
, BUTTON_REC
, BUTTON_NONE
},
244 { ACTION_KBD_BACKSPACE
, BUTTON_REC
|BUTTON_REPEAT
, BUTTON_NONE
},
246 { ACTION_KBD_PAGE_FLIP
, BUTTON_SELECT
|BUTTON_RIGHT
, BUTTON_SELECT
},
247 { ACTION_KBD_PAGE_FLIP
, BUTTON_SELECT
|BUTTON_LEFT
, BUTTON_SELECT
},
249 { ACTION_KBD_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
250 { ACTION_KBD_DONE
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
251 { ACTION_KBD_ABORT
, BUTTON_POWER
, BUTTON_NONE
},
254 }; /* button_context_keyboard */
256 static const struct button_mapping button_context_bmark
[] = {
257 { ACTION_BMS_DELETE
, BUTTON_REC
, BUTTON_NONE
},
259 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
260 }; /* button_context_bmark */
263 static const struct button_mapping button_context_usb_hid
[] = {
264 { ACTION_USB_HID_PLAY
, BUTTON_UP
|BUTTON_REL
, BUTTON_UP
},
265 { ACTION_USB_HID_STOP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_UP
},
266 { ACTION_USB_HID_SKIPPREV
, BUTTON_LEFT
, BUTTON_NONE
},
267 { ACTION_USB_HID_SKIPNEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
268 { ACTION_USB_HID_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
269 { ACTION_USB_HID_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
270 { ACTION_USB_HID_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
271 { ACTION_USB_HID_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
272 { ACTION_USB_HID_MUTE
, BUTTON_DOWN
, BUTTON_NONE
},
273 { ACTION_USB_HID_MENU
, BUTTON_POWER
, BUTTON_NONE
},
276 }; /* button_context_usb_hid */
279 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
280 const struct button_mapping
* get_context_mapping(int context
)
285 return button_context_standard
;
288 return button_context_wps
;
291 return button_context_list
;
293 case CONTEXT_MAINMENU
:
294 return button_context_listtree_scroll_with_combo
;
295 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
296 return button_context_tree
;
298 case CONTEXT_SETTINGS
:
299 case CONTEXT_SETTINGS_TIME
:
300 return button_context_settings
;
301 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
302 case CONTEXT_SETTINGS_COLOURCHOOSER
:
303 case CONTEXT_SETTINGS_EQ
:
304 case CONTEXT_SETTINGS_RECTRIGGER
:
305 return button_context_settings_right_is_inc
;
307 case CONTEXT_YESNOSCREEN
:
308 return button_context_yesno
;
311 return button_context_radio
;
313 case CONTEXT_BOOKMARKSCREEN
:
314 return button_context_bmark
;
315 case CONTEXT_QUICKSCREEN
:
316 return button_context_quickscreen
;
317 case CONTEXT_PITCHSCREEN
:
318 return button_context_pitchscreen
;
319 #ifdef HAVE_RECORDING
320 case CONTEXT_RECSCREEN
:
321 return button_context_recscreen
;
323 case CONTEXT_KEYBOARD
:
324 return button_context_keyboard
;
326 case CONTEXT_USB_HID
:
327 return button_context_usb_hid
;
330 return button_context_standard
;
332 return button_context_standard
;