diff options
Diffstat (limited to 'apps/keymaps/keymap-zenxfi2.c')
-rw-r--r-- | apps/keymaps/keymap-zenxfi2.c | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-zenxfi2.c b/apps/keymaps/keymap-zenxfi2.c new file mode 100644 index 0000000000..7bffa10a33 --- /dev/null +++ b/apps/keymaps/keymap-zenxfi2.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 Amaury Pouly | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* Button Code Definitions for the Creative ZEN X-Fi2 target */ | ||
23 | /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */ | ||
24 | |||
25 | #include <stdio.h> | ||
26 | #include <string.h> | ||
27 | #include <stdlib.h> | ||
28 | |||
29 | #include "config.h" | ||
30 | #include "action.h" | ||
31 | #include "button.h" | ||
32 | #include "settings.h" | ||
33 | |||
34 | /* | ||
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 | ||
39 | */ | ||
40 | |||
41 | static const struct button_mapping button_context_standard[] = { | ||
42 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
43 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
44 | |||
45 | { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, | ||
46 | |||
47 | LAST_ITEM_IN_LIST | ||
48 | }; /* button_context_standard */ | ||
49 | |||
50 | |||
51 | static const struct button_mapping button_context_wps[] = { | ||
52 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | ||
53 | { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, | ||
54 | |||
55 | LAST_ITEM_IN_LIST | ||
56 | }; /* button_context_wps */ | ||
57 | |||
58 | static const struct button_mapping button_context_list[] = { | ||
59 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
60 | }; /* button_context_list */ | ||
61 | |||
62 | static const struct button_mapping button_context_tree[] = { | ||
63 | |||
64 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
65 | }; /* button_context_tree */ | ||
66 | |||
67 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
68 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
69 | }; | ||
70 | |||
71 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
72 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), | ||
73 | }; | ||
74 | |||
75 | static const struct button_mapping button_context_settings[] = { | ||
76 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, | ||
77 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | ||
78 | |||
79 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
80 | }; /* button_context_settings */ | ||
81 | |||
82 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
83 | |||
84 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
85 | }; /* button_context_settingsgraphical */ | ||
86 | |||
87 | static const struct button_mapping button_context_yesno[] = { | ||
88 | { ACTION_YESNO_ACCEPT, BUTTON_MENU, BUTTON_NONE }, | ||
89 | |||
90 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
91 | }; /* button_context_settings_yesno */ | ||
92 | |||
93 | static const struct button_mapping button_context_colorchooser[] = { | ||
94 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
95 | }; /* button_context_colorchooser */ | ||
96 | |||
97 | static const struct button_mapping button_context_eq[] = { | ||
98 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), | ||
99 | }; /* button_context_eq */ | ||
100 | |||
101 | /** Bookmark Screen **/ | ||
102 | static const struct button_mapping button_context_bmark[] = { | ||
103 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | ||
104 | }; /* button_context_bmark */ | ||
105 | |||
106 | static const struct button_mapping button_context_time[] = { | ||
107 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), | ||
108 | }; /* button_context_time */ | ||
109 | |||
110 | static const struct button_mapping button_context_quickscreen[] = { | ||
111 | { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE }, | ||
112 | { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | ||
113 | |||
114 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
115 | }; /* button_context_quickscreen */ | ||
116 | |||
117 | static const struct button_mapping button_context_pitchscreen[] = { | ||
118 | { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, | ||
119 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
120 | }; /* button_context_pitchcreen */ | ||
121 | |||
122 | static const struct button_mapping button_context_keyboard[] = { | ||
123 | { ACTION_KBD_PAGE_FLIP, BUTTON_MENU, BUTTON_NONE }, | ||
124 | |||
125 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
126 | }; /* button_context_keyboard */ | ||
127 | |||
128 | static const struct button_mapping button_context_radio[] = { | ||
129 | { ACTION_FM_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | ||
130 | { ACTION_FM_PRESET, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | ||
131 | { ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
132 | |||
133 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) | ||
134 | }; /* button_context_radio */ | ||
135 | |||
136 | const struct button_mapping* target_get_context_mapping(int context) | ||
137 | { | ||
138 | switch (context) | ||
139 | { | ||
140 | case CONTEXT_STD: | ||
141 | return button_context_standard; | ||
142 | case CONTEXT_WPS: | ||
143 | return button_context_wps; | ||
144 | |||
145 | case CONTEXT_LIST: | ||
146 | return button_context_list; | ||
147 | case CONTEXT_MAINMENU: | ||
148 | case CONTEXT_TREE: | ||
149 | if (global_settings.hold_lr_for_scroll_in_list) | ||
150 | return button_context_listtree_scroll_without_combo; | ||
151 | else | ||
152 | return button_context_listtree_scroll_with_combo; | ||
153 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
154 | return button_context_tree; | ||
155 | |||
156 | case CONTEXT_SETTINGS: | ||
157 | return button_context_settings; | ||
158 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
159 | case CONTEXT_SETTINGS_RECTRIGGER: | ||
160 | return button_context_settings_right_is_inc; | ||
161 | |||
162 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
163 | return button_context_colorchooser; | ||
164 | case CONTEXT_SETTINGS_EQ: | ||
165 | return button_context_eq; | ||
166 | |||
167 | case CONTEXT_SETTINGS_TIME: | ||
168 | return button_context_time; | ||
169 | |||
170 | case CONTEXT_YESNOSCREEN: | ||
171 | return button_context_yesno; | ||
172 | case CONTEXT_FM: | ||
173 | return button_context_radio; | ||
174 | case CONTEXT_BOOKMARKSCREEN: | ||
175 | return button_context_bmark; | ||
176 | case CONTEXT_QUICKSCREEN: | ||
177 | return button_context_quickscreen; | ||
178 | case CONTEXT_PITCHSCREEN: | ||
179 | return button_context_pitchscreen; | ||
180 | case CONTEXT_KEYBOARD: | ||
181 | return button_context_keyboard; | ||
182 | } | ||
183 | return button_context_standard; | ||
184 | } | ||