diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/keymaps/keymap-creativezvm.c | 185 |
2 files changed, 187 insertions, 0 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 40aa022842..4d47328108 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -178,4 +178,6 @@ keymaps/keymap-mr500.c | |||
178 | keymaps/keymap-mr100.c | 178 | keymaps/keymap-mr100.c |
179 | #elif CONFIG_KEYPAD == COWOND2_PAD | 179 | #elif CONFIG_KEYPAD == COWOND2_PAD |
180 | keymaps/keymap-cowond2.c | 180 | keymaps/keymap-cowond2.c |
181 | #elif CONFIG_KEYPAD == CREATIVEZVM_PAD | ||
182 | keymaps/keymap-creativezvm.c | ||
181 | #endif | 183 | #endif |
diff --git a/apps/keymaps/keymap-creativezvm.c b/apps/keymaps/keymap-creativezvm.c new file mode 100644 index 0000000000..221830e15e --- /dev/null +++ b/apps/keymaps/keymap-creativezvm.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
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 Creative Zen Vision:M target */ | ||
21 | #include <stdio.h> | ||
22 | #include <string.h> | ||
23 | #include <stdlib.h> | ||
24 | |||
25 | #include "config.h" | ||
26 | #include "action.h" | ||
27 | #include "button.h" | ||
28 | #include "settings.h" | ||
29 | |||
30 | /* | ||
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 | ||
35 | */ | ||
36 | |||
37 | /* CONTEXT_CUSTOM's used in this file... | ||
38 | |||
39 | CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions) | ||
40 | CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens | ||
41 | i.e where up/down is inc/dec | ||
42 | CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec | ||
43 | |||
44 | */ | ||
45 | |||
46 | #define BUTTON_VOL_UP BUTTON_NONE | ||
47 | #define BUTTON_VOL_DOWN BUTTON_NONE | ||
48 | |||
49 | static const struct button_mapping button_context_standard[] = { | ||
50 | { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, | ||
51 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
52 | { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, | ||
53 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
54 | |||
55 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
56 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
57 | |||
58 | { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT }, | ||
59 | |||
60 | { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, | ||
61 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
62 | |||
63 | { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
64 | { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, | ||
65 | |||
66 | LAST_ITEM_IN_LIST | ||
67 | }; /* button_context_standard */ | ||
68 | |||
69 | |||
70 | static const struct button_mapping button_context_wps[] = { | ||
71 | LAST_ITEM_IN_LIST | ||
72 | }; /* button_context_wps */ | ||
73 | |||
74 | static const struct button_mapping button_context_list[] = { | ||
75 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
76 | }; /* button_context_list */ | ||
77 | |||
78 | static const struct button_mapping button_context_tree[] = { | ||
79 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
80 | }; /* button_context_tree */ | ||
81 | |||
82 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
83 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
84 | }; | ||
85 | |||
86 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
87 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
88 | }; | ||
89 | |||
90 | static const struct button_mapping button_context_settings[] = { | ||
91 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, | ||
92 | { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, | ||
93 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, | ||
94 | { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, | ||
95 | { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, | ||
96 | { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, | ||
97 | { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
98 | { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, | ||
99 | { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE }, | ||
100 | |||
101 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
102 | }; /* button_context_settings */ | ||
103 | |||
104 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
105 | |||
106 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
107 | }; /* button_context_settingsgraphical */ | ||
108 | |||
109 | static const struct button_mapping button_context_yesno[] = { | ||
110 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
111 | }; /* button_context_settings_yesno */ | ||
112 | |||
113 | static const struct button_mapping button_context_colorchooser[] = { | ||
114 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
115 | }; /* button_context_colorchooser */ | ||
116 | |||
117 | static const struct button_mapping button_context_eq[] = { | ||
118 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
119 | }; /* button_context_eq */ | ||
120 | |||
121 | /** Bookmark Screen **/ | ||
122 | static const struct button_mapping button_context_bmark[] = { | ||
123 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
124 | }; /* button_context_bmark */ | ||
125 | |||
126 | static const struct button_mapping button_context_time[] = { | ||
127 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
128 | }; /* button_context_time */ | ||
129 | |||
130 | static const struct button_mapping button_context_quickscreen[] = { | ||
131 | |||
132 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
133 | }; /* button_context_quickscreen */ | ||
134 | |||
135 | static const struct button_mapping button_context_pitchscreen[] = { | ||
136 | |||
137 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
138 | }; /* button_context_pitchcreen */ | ||
139 | |||
140 | static const struct button_mapping button_context_keyboard[] = { | ||
141 | |||
142 | LAST_ITEM_IN_LIST | ||
143 | }; /* button_context_keyboard */ | ||
144 | |||
145 | const struct button_mapping* get_context_mapping(int context) | ||
146 | { | ||
147 | switch (context&~CONTEXT_REMOTE) | ||
148 | { | ||
149 | case CONTEXT_STD: | ||
150 | return button_context_standard; | ||
151 | case CONTEXT_WPS: | ||
152 | return button_context_wps; | ||
153 | case CONTEXT_LIST: | ||
154 | return button_context_list; | ||
155 | case CONTEXT_MAINMENU: | ||
156 | case CONTEXT_TREE: | ||
157 | if (global_settings.hold_lr_for_scroll_in_list) | ||
158 | return button_context_listtree_scroll_without_combo; | ||
159 | else | ||
160 | return button_context_listtree_scroll_with_combo; | ||
161 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
162 | return button_context_tree; | ||
163 | case CONTEXT_SETTINGS: | ||
164 | return button_context_settings; | ||
165 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
166 | return button_context_settings_right_is_inc; | ||
167 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
168 | return button_context_colorchooser; | ||
169 | case CONTEXT_SETTINGS_EQ: | ||
170 | return button_context_eq; | ||
171 | case CONTEXT_SETTINGS_TIME: | ||
172 | return button_context_time; | ||
173 | case CONTEXT_YESNOSCREEN: | ||
174 | return button_context_yesno; | ||
175 | case CONTEXT_BOOKMARKSCREEN: | ||
176 | return button_context_bmark; | ||
177 | case CONTEXT_QUICKSCREEN: | ||
178 | return button_context_quickscreen; | ||
179 | case CONTEXT_PITCHSCREEN: | ||
180 | return button_context_pitchscreen; | ||
181 | case CONTEXT_KEYBOARD: | ||
182 | return button_context_keyboard; | ||
183 | } | ||
184 | return button_context_standard; | ||
185 | } | ||