summaryrefslogtreecommitdiff
path: root/apps/keymaps
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-05-02 19:12:09 +0000
committerDave Chapman <dave@dchapman.com>2008-05-02 19:12:09 +0000
commitf2042983f08cd49404be0b6916fc73d778fe8dba (patch)
tree33a84414ca4d94770f900e92074c18ecadf23ed7 /apps/keymaps
parent4cf4b5c2aef075b719e834f30d17c0986fadb658 (diff)
downloadrockbox-f2042983f08cd49404be0b6916fc73d778fe8dba.tar.gz
rockbox-f2042983f08cd49404be0b6916fc73d778fe8dba.zip
Add the Sansa M200 (v1) as a target - it's extremely similar to the Logik DAX (the LCD driver worked unchanged). Plus various tcc77x work, including a working tick interrupt (enabled in the bootloader). Rockbox itself builds for the M200 (there are no keymaps yet for the DAX), but doesn't progress very far due to the lack of an ATA (NAND flash) driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17306 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/keymaps')
-rw-r--r--apps/keymaps/keymap-m200.c323
1 files changed, 323 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-m200.c b/apps/keymaps/keymap-m200.c
new file mode 100644
index 0000000000..141905129a
--- /dev/null
+++ b/apps/keymaps/keymap-m200.c
@@ -0,0 +1,323 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Mark Arigo
11 *
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.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19/* Button Code Definitions for Sandisk c200 target */
20
21#include "config.h"
22#include "action.h"
23#include "button.h"
24#include "settings.h"
25
26/* {Action Code, Button code, Prereq button code } */
27
28/*
29 * The format of the list is as follows
30 * { Action Code, Button code, Prereq button code }
31 * if there's no need to check the previous button's value, use BUTTON_NONE
32 * Insert LAST_ITEM_IN_LIST at the end of each mapping
33 */
34static const struct button_mapping button_context_standard[] = {
35 { ACTION_STD_PREV, BUTTON_VOLUP, BUTTON_NONE },
36 { ACTION_STD_PREVREPEAT, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
37
38 { ACTION_STD_NEXT, BUTTON_VOLDOWN, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
40
41 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
42 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
43 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
44
45 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
46 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
47// { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_NONE },
48
49 LAST_ITEM_IN_LIST
50}; /* button_context_standard */
51
52
53static const struct button_mapping button_context_wps[] = {
54 { ACTION_WPS_PLAY, BUTTON_VOLUP|BUTTON_REL, BUTTON_VOLUP },
55 { ACTION_WPS_STOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_VOLUP },
56
57 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
58 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
60
61 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
62 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
64
65 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_MENU|BUTTON_RIGHT, BUTTON_MENU },
66 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_MENU|BUTTON_LEFT, BUTTON_MENU },
67 { ACTION_WPS_ABRESET, BUTTON_MENU|BUTTON_VOLUP, BUTTON_MENU },
68
69 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
70 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
71 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_VOLUP, BUTTON_SELECT },
72 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_VOLDOWN, BUTTON_SELECT },
73 { ACTION_WPS_CONTEXT, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_VOLDOWN },
74 { ACTION_WPS_QUICKSCREEN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_VOLDOWN },
75
76 LAST_ITEM_IN_LIST
77}; /* button_context_wps */
78
79static const struct button_mapping button_context_settings[] = {
80 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
81 { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
82
83 { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE },
84 { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
85
86 { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
87 { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
88
89 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
90 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
91
92 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
93 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
94
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
96}; /* button_context_settings */
97
98static const struct button_mapping button_context_list[] = {
99#ifdef HAVE_VOLUME_IN_LIST
100 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
101 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
102
103 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
104 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
105#endif
106
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
108}; /* button_context_list */
109
110static const struct button_mapping button_context_tree[] = {
111 // { ACTION_TREE_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC },
112 // { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP },
113
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
115}; /* button_context_tree */
116
117static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
118 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
119 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
120 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
121 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
122 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
123
124 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
125 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
126 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
128
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
130}; /* button_context_listtree_scroll_without_combo */
131
132static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
133 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
134
135// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
136// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
137
138// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
139// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
140
141 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
142}; /* button_context_listtree_scroll_with_combo */
143
144static const struct button_mapping button_context_yesno[] = {
145 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
146
147 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
148}; /* button_context_settings_yesno */
149
150static const struct button_mapping button_context_quickscreen[] = {
151 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
152 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
153
154 { ACTION_QS_DOWNINV, BUTTON_VOLUP|BUTTON_REL, BUTTON_NONE },
155 { ACTION_QS_DOWNINV, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
156
157 { ACTION_QS_DOWN, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_NONE },
158 { ACTION_QS_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
159
160 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
161 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
162
163 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
164 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
165
166 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
167}; /* button_context_quickscreen */
168
169static const struct button_mapping button_context_settings_right_is_inc[] = {
170 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
171 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
172
173 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
174 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
175
176 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
177
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
179}; /* button_context_settings_right_is_inc */
180
181static const struct button_mapping button_context_pitchscreen[] = {
182 { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE },
183 { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
184
185 { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE },
186 { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
187
188 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
189 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
190
191 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
192 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
193
194 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
195 { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE },
196
197 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
198}; /* button_context_pitchscreen */
199
200/** Recording Screen **/
201#ifdef HAVE_RECORDING
202static const struct button_mapping button_context_recscreen[] = {
203 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
204 { ACTION_REC_PAUSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
205 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
206 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
207
208 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
209 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
211 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
212
213 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
214}; /* button_context_recscreen */
215#endif
216
217/** FM Radio Screen **/
218#if CONFIG_TUNER
219static const struct button_mapping button_context_radio[] = {
220 { ACTION_NONE, BUTTON_VOLUP, BUTTON_NONE },
221 { ACTION_FM_MENU, BUTTON_VOLDOWN, BUTTON_NONE },
222 { ACTION_FM_PRESET, BUTTON_SELECT, BUTTON_NONE },
223 { ACTION_FM_STOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_VOLUP },
224 { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE },
225 { ACTION_FM_EXIT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
226 { ACTION_FM_PLAY, BUTTON_VOLUP|BUTTON_REL, BUTTON_VOLUP },
227 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
228 { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
230 { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
231
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
233}; /* button_context_radio */
234#endif
235
236static const struct button_mapping button_context_keyboard[] = {
237 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
238 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
240 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
241
242// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
243// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
244// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
245// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
246
247 { ACTION_KBD_UP, BUTTON_VOLUP, BUTTON_NONE },
248 { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_KBD_DOWN, BUTTON_VOLDOWN, BUTTON_NONE },
250 { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
251
252// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
253// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
254
255// { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
256
257 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
258 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
259 { ACTION_KBD_ABORT, BUTTON_MENU, BUTTON_NONE },
260
261 LAST_ITEM_IN_LIST
262}; /* button_context_keyboard */
263
264static const struct button_mapping button_context_bmark[] = {
265// { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
266
267 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
268}; /* button_context_bmark */
269
270/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
271const struct button_mapping* get_context_mapping(int context)
272{
273 switch (context)
274 {
275 case CONTEXT_STD:
276 return button_context_standard;
277
278 case CONTEXT_WPS:
279 return button_context_wps;
280
281 case CONTEXT_LIST:
282 return button_context_list;
283 case CONTEXT_TREE:
284 case CONTEXT_MAINMENU:
285 if (global_settings.hold_lr_for_scroll_in_list)
286 return button_context_listtree_scroll_without_combo;
287 else
288 return button_context_listtree_scroll_with_combo;
289 case CONTEXT_CUSTOM|CONTEXT_TREE:
290 return button_context_tree;
291
292 case CONTEXT_SETTINGS:
293 case CONTEXT_SETTINGS_TIME:
294 return button_context_settings;
295 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
296 case CONTEXT_SETTINGS_COLOURCHOOSER:
297 case CONTEXT_SETTINGS_EQ:
298 return button_context_settings_right_is_inc;
299
300 case CONTEXT_YESNOSCREEN:
301 return button_context_yesno;
302#if CONFIG_TUNER
303 case CONTEXT_FM:
304 return button_context_radio;
305#endif
306 case CONTEXT_BOOKMARKSCREEN:
307 return button_context_bmark;
308 case CONTEXT_QUICKSCREEN:
309 return button_context_quickscreen;
310 case CONTEXT_PITCHSCREEN:
311 return button_context_pitchscreen;
312#ifdef HAVE_RECORDING
313 case CONTEXT_RECSCREEN:
314 return button_context_recscreen;
315#endif
316 case CONTEXT_KEYBOARD:
317 return button_context_keyboard;
318
319 default:
320 return button_context_standard;
321 }
322 return button_context_standard;
323}