1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
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 toshiba gigabeat target */
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
38 #define BUTTON_UP BUTTON_RC_PLAY
39 #define BUTTON_DOWN BUTTON_RC_DOWN
40 //#define BUTTON_LEFT BUTTON_RC_REW
41 //#define BUTTON_RIGHT BUTTON_RC_FF
43 #define BUTTON_SELECT BUTTON_RC_HEART
44 #define BUTTON_MENU BUTTON_RC_MODE
45 #define BUTTON_VOL_DOWN BUTTON_RC_VOL_DOWN
46 #define BUTTON_VOL_UP BUTTON_RC_VOL_UP
48 static const struct button_mapping button_context_standard
[] = {
49 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
50 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
51 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
52 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
54 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
55 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
56 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_RIGHT
},
58 { ACTION_STD_MENU
, BUTTON_MENU
, BUTTON_NONE
},
59 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
60 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
61 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
62 { ACTION_STD_CANCEL
, BUTTON_LEFT
, BUTTON_NONE
},
63 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
65 }; /* button_context_standard */
68 static const struct button_mapping button_context_wps
[] = {
70 }; /* button_context_wps */
72 static const struct button_mapping button_context_list
[] = {
73 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
74 }; /* button_context_list */
76 static const struct button_mapping button_context_tree
[] = {
77 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
78 }; /* button_context_tree */
80 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
81 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
84 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
85 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
88 static const struct button_mapping button_context_settings
[] = {
89 { ACTION_SETTINGS_INC
, BUTTON_RC_VOL_UP
, BUTTON_NONE
},
90 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RC_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
91 { ACTION_SETTINGS_DEC
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
92 { ACTION_SETTINGS_DECREPEAT
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
93 { ACTION_STD_OK
, BUTTON_RC_HEART
, BUTTON_NONE
},
94 { ACTION_STD_CANCEL
, BUTTON_RC_MODE
, BUTTON_NONE
},
96 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
97 }; /* button_context_settings */
99 static const struct button_mapping button_context_settings_right_is_inc
[] = {
101 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
102 }; /* button_context_settingsgraphical */
104 static const struct button_mapping button_context_yesno
[] = {
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 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
123 }; /* button_context_time */
125 static const struct button_mapping button_context_quickscreen
[] = {
127 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
128 }; /* button_context_quickscreen */
130 static const struct button_mapping button_context_pitchscreen
[] = {
132 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
133 }; /* button_context_pitchcreen */
135 static const struct button_mapping button_context_keyboard
[] = {
138 }; /* button_context_keyboard */
140 extern int current_tick
;
141 const struct button_mapping
* get_context_mapping(int context
)
143 switch (context
&(~CONTEXT_REMOTE
))
146 return button_context_standard
;
148 return button_context_wps
;
151 return button_context_list
;
152 case CONTEXT_MAINMENU
:
154 if (global_settings
.hold_lr_for_scroll_in_list
)
155 return button_context_listtree_scroll_without_combo
;
157 return button_context_listtree_scroll_with_combo
;
158 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
159 return button_context_tree
;
161 case CONTEXT_SETTINGS
:
162 return button_context_settings
;
163 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
164 return button_context_settings_right_is_inc
;
166 case CONTEXT_SETTINGS_COLOURCHOOSER
:
167 return button_context_colorchooser
;
168 case CONTEXT_SETTINGS_EQ
:
169 return button_context_eq
;
171 case CONTEXT_SETTINGS_TIME
:
172 return button_context_time
;
174 case CONTEXT_YESNOSCREEN
:
175 return button_context_yesno
;
176 case CONTEXT_BOOKMARKSCREEN
:
177 return button_context_bmark
;
178 case CONTEXT_QUICKSCREEN
:
179 return button_context_quickscreen
;
180 case CONTEXT_PITCHSCREEN
:
181 return button_context_pitchscreen
;
182 case CONTEXT_KEYBOARD
:
183 return button_context_keyboard
;
185 return button_context_standard
;