diff options
author | Rob Purchase <shotofadds@rockbox.org> | 2008-01-14 22:04:48 +0000 |
---|---|---|
committer | Rob Purchase <shotofadds@rockbox.org> | 2008-01-14 22:04:48 +0000 |
commit | 47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07 (patch) | |
tree | 0a48ce653e22ec9a2673474f718217d9659e0c6b /apps/keymaps | |
parent | b30ca8ca5ab6c8ea27b8fe1f5fb38ebad09b7e62 (diff) | |
download | rockbox-47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07.tar.gz rockbox-47ea030e2e68a51f91a2c2302b7ea4d3ee1a2a07.zip |
Initial Cowon D2 commit:
* bootloader test program (basic LCD & button drivers, reads touchscreen)
* work-in-progress stubs for main build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16090 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/keymaps')
-rw-r--r-- | apps/keymaps/keymap-cowond2.c | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c new file mode 100644 index 0000000000..ab4216e9cf --- /dev/null +++ b/apps/keymaps/keymap-cowond2.c | |||
@@ -0,0 +1,177 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id | ||
9 | * | ||
10 | * Copyright (C) 2008 Rob Purchase | ||
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 | |||
20 | /* Button Code Definitions for the Cowon D2 target */ | ||
21 | /* Some of these mappings are rather 'creative', given it only has 3 buttons! */ | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <string.h> | ||
25 | #include <stdlib.h> | ||
26 | |||
27 | #include "config.h" | ||
28 | #include "action.h" | ||
29 | #include "button.h" | ||
30 | #include "settings.h" | ||
31 | |||
32 | /* | ||
33 | * The format of the list is as follows | ||
34 | * { Action Code, Button code, Prereq button code } | ||
35 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
36 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
37 | */ | ||
38 | |||
39 | static const struct button_mapping button_context_standard[] = { | ||
40 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, | ||
41 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
42 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, | ||
43 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
44 | |||
45 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | ||
46 | //{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, | ||
47 | //{ ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, | ||
48 | |||
49 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
50 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
51 | { ACTION_STD_CONTEXT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
52 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
53 | // { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
54 | // { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
55 | LAST_ITEM_IN_LIST | ||
56 | }; /* button_context_standard */ | ||
57 | |||
58 | |||
59 | static const struct button_mapping button_context_wps[] = { | ||
60 | LAST_ITEM_IN_LIST | ||
61 | }; /* button_context_wps */ | ||
62 | |||
63 | static const struct button_mapping button_context_list[] = { | ||
64 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
65 | }; /* button_context_list */ | ||
66 | |||
67 | static const struct button_mapping button_context_tree[] = { | ||
68 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
69 | }; /* button_context_tree */ | ||
70 | |||
71 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
72 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
73 | }; | ||
74 | |||
75 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
76 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
77 | }; | ||
78 | |||
79 | static const struct button_mapping button_context_settings[] = { | ||
80 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, | ||
81 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
82 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, | ||
83 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | ||
84 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, | ||
85 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
86 | |||
87 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
88 | }; /* button_context_settings */ | ||
89 | |||
90 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
91 | |||
92 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
93 | }; /* button_context_settingsgraphical */ | ||
94 | |||
95 | static const struct button_mapping button_context_yesno[] = { | ||
96 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
97 | }; /* button_context_settings_yesno */ | ||
98 | |||
99 | static const struct button_mapping button_context_colorchooser[] = { | ||
100 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
101 | }; /* button_context_colorchooser */ | ||
102 | |||
103 | static const struct button_mapping button_context_eq[] = { | ||
104 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
105 | }; /* button_context_eq */ | ||
106 | |||
107 | /** Bookmark Screen **/ | ||
108 | static const struct button_mapping button_context_bmark[] = { | ||
109 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
110 | }; /* button_context_bmark */ | ||
111 | |||
112 | static const struct button_mapping button_context_time[] = { | ||
113 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
114 | }; /* button_context_time */ | ||
115 | |||
116 | static const struct button_mapping button_context_quickscreen[] = { | ||
117 | |||
118 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
119 | }; /* button_context_quickscreen */ | ||
120 | |||
121 | static const struct button_mapping button_context_pitchscreen[] = { | ||
122 | |||
123 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
124 | }; /* button_context_pitchcreen */ | ||
125 | |||
126 | static const struct button_mapping button_context_keyboard[] = { | ||
127 | |||
128 | LAST_ITEM_IN_LIST | ||
129 | }; /* button_context_keyboard */ | ||
130 | |||
131 | extern int current_tick; | ||
132 | const struct button_mapping* get_context_mapping(int context) | ||
133 | { | ||
134 | switch (context&(~CONTEXT_REMOTE)) | ||
135 | { | ||
136 | case CONTEXT_STD: | ||
137 | return button_context_standard; | ||
138 | case CONTEXT_WPS: | ||
139 | return button_context_wps; | ||
140 | |||
141 | case CONTEXT_LIST: | ||
142 | return button_context_list; | ||
143 | case CONTEXT_MAINMENU: | ||
144 | case CONTEXT_TREE: | ||
145 | if (global_settings.hold_lr_for_scroll_in_list) | ||
146 | return button_context_listtree_scroll_without_combo; | ||
147 | else | ||
148 | return button_context_listtree_scroll_with_combo; | ||
149 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
150 | return button_context_tree; | ||
151 | |||
152 | case CONTEXT_SETTINGS: | ||
153 | return button_context_settings; | ||
154 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
155 | return button_context_settings_right_is_inc; | ||
156 | |||
157 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
158 | return button_context_colorchooser; | ||
159 | case CONTEXT_SETTINGS_EQ: | ||
160 | return button_context_eq; | ||
161 | |||
162 | case CONTEXT_SETTINGS_TIME: | ||
163 | return button_context_time; | ||
164 | |||
165 | case CONTEXT_YESNOSCREEN: | ||
166 | return button_context_yesno; | ||
167 | case CONTEXT_BOOKMARKSCREEN: | ||
168 | return button_context_bmark; | ||
169 | case CONTEXT_QUICKSCREEN: | ||
170 | return button_context_quickscreen; | ||
171 | case CONTEXT_PITCHSCREEN: | ||
172 | return button_context_pitchscreen; | ||
173 | case CONTEXT_KEYBOARD: | ||
174 | return button_context_keyboard; | ||
175 | } | ||
176 | return button_context_standard; | ||
177 | } | ||