1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2009 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 Onda VX747 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_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
44 }; /* button_context_standard */
47 static const struct button_mapping button_context_wps
[] = {
48 { ACTION_STD_KEYLOCK
, BUTTON_POWER
, BUTTON_NONE
},
50 }; /* button_context_wps */
52 static const struct button_mapping button_context_list
[] = {
53 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
54 }; /* button_context_list */
56 static const struct button_mapping button_context_tree
[] = {
57 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
58 }; /* button_context_tree */
60 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
61 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
64 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
65 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
68 static const struct button_mapping button_context_settings
[] = {
69 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
}, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
70 }; /* button_context_settings */
72 static const struct button_mapping button_context_settings_right_is_inc
[] = {
74 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
75 }; /* button_context_settingsgraphical */
77 static const struct button_mapping button_context_yesno
[] = {
78 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
79 }; /* button_context_settings_yesno */
81 static const struct button_mapping button_context_colorchooser
[] = {
82 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
83 }; /* button_context_colorchooser */
85 static const struct button_mapping button_context_eq
[] = {
86 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
87 }; /* button_context_eq */
89 /** Bookmark Screen **/
90 static const struct button_mapping button_context_bmark
[] = {
91 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
92 }; /* button_context_bmark */
94 static const struct button_mapping button_context_time
[] = {
95 { ACTION_STD_CANCEL
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
}, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
96 }; /* button_context_time */
98 static const struct button_mapping button_context_quickscreen
[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
101 }; /* button_context_quickscreen */
103 static const struct button_mapping button_context_pitchscreen
[] = {
104 { ACTION_PS_EXIT
, BUTTON_POWER
, BUTTON_NONE
},
105 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
106 }; /* button_context_pitchcreen */
108 /** FM Radio Screen **/
109 static const struct button_mapping button_context_radio
[] = {
110 { ACTION_FM_MODE
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
111 { ACTION_FM_EXIT
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
113 }; /* button_context_radio */
115 static const struct button_mapping button_context_keyboard
[] = {
116 { ACTION_KBD_ABORT
, BUTTON_POWER
, BUTTON_NONE
},
117 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
118 }; /* button_context_keyboard */
120 #ifdef USB_ENABLE_HID
121 static const struct button_mapping button_context_usb_hid
[] = {
122 { ACTION_USB_HID_MODE_SWITCH_NEXT
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
123 { ACTION_USB_HID_MODE_SWITCH_PREV
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_POWER
},
125 }; /* button_context_usb_hid */
128 const struct button_mapping
* target_get_context_mapping(int context
)
133 return button_context_standard
;
135 return button_context_wps
;
138 return button_context_list
;
139 case CONTEXT_MAINMENU
:
141 if (global_settings
.hold_lr_for_scroll_in_list
)
142 return button_context_listtree_scroll_without_combo
;
144 return button_context_listtree_scroll_with_combo
;
145 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
146 return button_context_tree
;
148 case CONTEXT_SETTINGS
:
149 return button_context_settings
;
150 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
151 case CONTEXT_SETTINGS_RECTRIGGER
:
152 return button_context_settings_right_is_inc
;
154 case CONTEXT_SETTINGS_COLOURCHOOSER
:
155 return button_context_colorchooser
;
156 case CONTEXT_SETTINGS_EQ
:
157 return button_context_eq
;
159 case CONTEXT_SETTINGS_TIME
:
160 return button_context_time
;
162 case CONTEXT_YESNOSCREEN
:
163 return button_context_yesno
;
165 return button_context_radio
;
166 case CONTEXT_BOOKMARKSCREEN
:
167 return button_context_bmark
;
168 case CONTEXT_QUICKSCREEN
:
169 return button_context_quickscreen
;
170 case CONTEXT_PITCHSCREEN
:
171 return button_context_pitchscreen
;
172 case CONTEXT_KEYBOARD
:
173 return button_context_keyboard
;
174 #ifdef USB_ENABLE_HID
175 case CONTEXT_USB_HID
:
176 return button_context_usb_hid
;
179 return button_context_standard
;