1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2012 Amaury Pouly
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 X-Fi2 target */
23 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
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_OK
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
43 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
45 { ACTION_STD_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
48 }; /* button_context_standard */
51 static const struct button_mapping button_context_wps
[] = {
52 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
53 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
56 }; /* button_context_wps */
58 static const struct button_mapping button_context_list
[] = {
59 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
60 }; /* button_context_list */
62 static const struct button_mapping button_context_tree
[] = {
64 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
65 }; /* button_context_tree */
67 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
68 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
71 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
72 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
75 static const struct button_mapping button_context_settings
[] = {
76 { ACTION_STD_OK
, BUTTON_MENU
, BUTTON_NONE
},
77 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
79 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
80 }; /* button_context_settings */
82 static const struct button_mapping button_context_settings_right_is_inc
[] = {
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
85 }; /* button_context_settingsgraphical */
87 static const struct button_mapping button_context_yesno
[] = {
88 { ACTION_YESNO_ACCEPT
, BUTTON_MENU
, BUTTON_NONE
},
90 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
91 }; /* button_context_settings_yesno */
93 static const struct button_mapping button_context_colorchooser
[] = {
94 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
95 }; /* button_context_colorchooser */
97 static const struct button_mapping button_context_eq
[] = {
98 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
99 }; /* button_context_eq */
101 /** Bookmark Screen **/
102 static const struct button_mapping button_context_bmark
[] = {
103 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
104 }; /* button_context_bmark */
106 static const struct button_mapping button_context_time
[] = {
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
108 }; /* button_context_time */
110 static const struct button_mapping button_context_quickscreen
[] = {
111 { ACTION_STD_CANCEL
, BUTTON_POWER
|BUTTON_REL
, BUTTON_NONE
},
112 { ACTION_STD_CANCEL
, BUTTON_MENU
|BUTTON_REL
, BUTTON_NONE
},
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
115 }; /* button_context_quickscreen */
117 static const struct button_mapping button_context_pitchscreen
[] = {
118 { ACTION_PS_EXIT
, BUTTON_POWER
, BUTTON_NONE
},
119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
120 }; /* button_context_pitchcreen */
122 static const struct button_mapping button_context_keyboard
[] = {
123 { ACTION_KBD_PAGE_FLIP
, BUTTON_MENU
, BUTTON_NONE
},
125 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
126 }; /* button_context_keyboard */
128 static const struct button_mapping button_context_radio
[] = {
129 { ACTION_FM_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_NONE
},
130 { ACTION_FM_PRESET
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
131 { ACTION_FM_STOP
, BUTTON_POWER
, BUTTON_NONE
},
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
134 }; /* button_context_radio */
136 const struct button_mapping
* target_get_context_mapping(int context
)
141 return button_context_standard
;
143 return button_context_wps
;
146 return button_context_list
;
147 case CONTEXT_MAINMENU
:
149 if (global_settings
.hold_lr_for_scroll_in_list
)
150 return button_context_listtree_scroll_without_combo
;
152 return button_context_listtree_scroll_with_combo
;
153 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
154 return button_context_tree
;
156 case CONTEXT_SETTINGS
:
157 return button_context_settings
;
158 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
159 case CONTEXT_SETTINGS_RECTRIGGER
:
160 return button_context_settings_right_is_inc
;
162 case CONTEXT_SETTINGS_COLOURCHOOSER
:
163 return button_context_colorchooser
;
164 case CONTEXT_SETTINGS_EQ
:
165 return button_context_eq
;
167 case CONTEXT_SETTINGS_TIME
:
168 return button_context_time
;
170 case CONTEXT_YESNOSCREEN
:
171 return button_context_yesno
;
173 return button_context_radio
;
174 case CONTEXT_BOOKMARKSCREEN
:
175 return button_context_bmark
;
176 case CONTEXT_QUICKSCREEN
:
177 return button_context_quickscreen
;
178 case CONTEXT_PITCHSCREEN
:
179 return button_context_pitchscreen
;
180 case CONTEXT_KEYBOARD
:
181 return button_context_keyboard
;
183 return button_context_standard
;