diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-03 18:17:11 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-09 12:41:18 -0400 |
commit | aabc8aca47e60cf745a34af28c50679fcb967910 (patch) | |
tree | cfe17f546aae9785fb13482f39527e2da0597ccb /apps/keymaps | |
parent | 4231c2c83f2b5331e3e38b10a308ee3752315f9c (diff) | |
download | rockbox-aabc8aca47e60cf745a34af28c50679fcb967910.tar.gz rockbox-aabc8aca47e60cf745a34af28c50679fcb967910.zip |
New port: FiiO M3K
Most credit goes to: Roman Skylarov
Additional integration and refactoring by myself.
*** COMPLETELY UNTESTED ***
Change-Id: Ia64c36d92e0214c6b15f7a868df286f8113ea27b
Diffstat (limited to 'apps/keymaps')
-rw-r--r-- | apps/keymaps/keymap-fiiom3k.c | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-fiiom3k.c b/apps/keymaps/keymap-fiiom3k.c new file mode 100644 index 0000000000..4fa97e9435 --- /dev/null +++ b/apps/keymaps/keymap-fiiom3k.c | |||
@@ -0,0 +1,224 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2019 by Roman Stolyarov | ||
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 FiiO M3K target */ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "action.h" | ||
26 | #include "button.h" | ||
27 | #include "settings.h" | ||
28 | |||
29 | /* {Action Code, Button code, Prereq button code } */ | ||
30 | |||
31 | /* | ||
32 | * The format of the list is as follows | ||
33 | * { Action Code, Button code, Prereq button code } | ||
34 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
35 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
36 | */ | ||
37 | static const struct button_mapping button_context_standard[] = { | ||
38 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
39 | { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, | ||
40 | { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
41 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
42 | { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, | ||
43 | { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
44 | { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
45 | { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, | ||
46 | { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
47 | { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, | ||
48 | |||
49 | LAST_ITEM_IN_LIST | ||
50 | }; /* button_context_standard */ | ||
51 | |||
52 | static const struct button_mapping button_context_wps[] = { | ||
53 | { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
54 | // { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
55 | { ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, | ||
56 | { ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
57 | { ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT }, | ||
58 | { ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, | ||
59 | { ACTION_WPS_SEEKFWD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
60 | { ACTION_WPS_STOPSEEK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT }, | ||
61 | { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
62 | { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
63 | { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
64 | { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
65 | { ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, | ||
66 | { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
67 | { ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, | ||
68 | { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, | ||
69 | { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, | ||
70 | |||
71 | // XXX BUTTON_UP and BUTTON_DOWN aren't on here. | ||
72 | |||
73 | { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE }, | ||
74 | |||
75 | LAST_ITEM_IN_LIST | ||
76 | }; /* button_context_wps */ | ||
77 | |||
78 | static const struct button_mapping button_context_list[] = { | ||
79 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
80 | { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
81 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
82 | { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
83 | |||
84 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
85 | }; /* button_context_list */ | ||
86 | |||
87 | /** Bookmark Screen **/ | ||
88 | static const struct button_mapping button_context_bmark[] = { | ||
89 | { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
90 | |||
91 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
92 | }; /* button_context_bmark */ | ||
93 | |||
94 | /** Keyboard **/ | ||
95 | static const struct button_mapping button_context_keyboard[] = { | ||
96 | { ACTION_KBD_LEFT, BUTTON_PREV, BUTTON_NONE }, | ||
97 | { ACTION_KBD_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
98 | { ACTION_KBD_RIGHT, BUTTON_NEXT, BUTTON_NONE }, | ||
99 | { ACTION_KBD_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
100 | { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
101 | { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
102 | { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP, BUTTON_NONE }, | ||
103 | { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
104 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
105 | { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
106 | { ACTION_KBD_BACKSPACE, BUTTON_HOME, BUTTON_NONE }, | ||
107 | { ACTION_KBD_BACKSPACE, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE }, | ||
108 | { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
109 | { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
110 | { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, | ||
111 | |||
112 | LAST_ITEM_IN_LIST | ||
113 | }; /* button_context_keyboard */ | ||
114 | |||
115 | /** Pitchscreen **/ | ||
116 | static const struct button_mapping button_context_pitchscreen[] = { | ||
117 | { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, | ||
118 | { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
119 | { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, | ||
120 | { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
121 | { ACTION_PS_NUDGE_LEFT, BUTTON_PREV, BUTTON_NONE }, | ||
122 | { ACTION_PS_NUDGE_LEFTOFF, BUTTON_PREV|BUTTON_REL, BUTTON_NONE }, | ||
123 | { ACTION_PS_NUDGE_RIGHT, BUTTON_NEXT, BUTTON_NONE }, | ||
124 | { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE }, | ||
125 | { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, | ||
126 | { ACTION_PS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, | ||
127 | { ACTION_PS_EXIT, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, | ||
128 | { ACTION_PS_SLOWER, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
129 | { ACTION_PS_FASTER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
130 | |||
131 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
132 | }; /* button_context_pitchscreen */ | ||
133 | |||
134 | /** Quickscreen **/ | ||
135 | static const struct button_mapping button_context_quickscreen[] = { | ||
136 | { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE }, | ||
137 | { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
138 | { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
139 | { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
140 | { ACTION_QS_LEFT, BUTTON_PREV, BUTTON_NONE }, | ||
141 | { ACTION_QS_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
142 | { ACTION_QS_RIGHT, BUTTON_NEXT, BUTTON_NONE }, | ||
143 | { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
144 | { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, | ||
145 | |||
146 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
147 | }; /* button_context_quickscreen */ | ||
148 | |||
149 | /** Settings - General Mappings **/ | ||
150 | static const struct button_mapping button_context_settings[] = { | ||
151 | { ACTION_SETTINGS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, | ||
152 | { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, | ||
153 | { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, | ||
154 | { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, | ||
155 | { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, | ||
156 | { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
157 | { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, | ||
158 | |||
159 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
160 | }; /* button_context_settings */ | ||
161 | |||
162 | static const struct button_mapping button_context_settings_vol_is_inc[] = { | ||
163 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, | ||
164 | { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
165 | { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE }, | ||
166 | { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
167 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, | ||
168 | { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
169 | { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
170 | { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
171 | |||
172 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
173 | }; /* button_context_settings_right_is_inc */ | ||
174 | |||
175 | /** Tree **/ | ||
176 | static const struct button_mapping button_context_tree[] = { | ||
177 | { ACTION_TREE_WPS, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, | ||
178 | { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, | ||
179 | { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, | ||
180 | |||
181 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) | ||
182 | }; /* button_context_tree */ | ||
183 | |||
184 | /** Yes/No Screen **/ | ||
185 | static const struct button_mapping button_context_yesnoscreen[] = { | ||
186 | { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, | ||
187 | |||
188 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | ||
189 | }; /* button_context_settings_yesnoscreen */ | ||
190 | |||
191 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | ||
192 | const struct button_mapping* get_context_mapping(int context) | ||
193 | { | ||
194 | switch (context) | ||
195 | { | ||
196 | case CONTEXT_LIST: | ||
197 | return button_context_list; | ||
198 | case CONTEXT_STD: | ||
199 | return button_context_standard; | ||
200 | case CONTEXT_BOOKMARKSCREEN: | ||
201 | return button_context_bmark; | ||
202 | case CONTEXT_KEYBOARD: | ||
203 | return button_context_keyboard; | ||
204 | case CONTEXT_PITCHSCREEN: | ||
205 | return button_context_pitchscreen; | ||
206 | case CONTEXT_QUICKSCREEN: | ||
207 | return button_context_quickscreen; | ||
208 | case CONTEXT_SETTINGS: | ||
209 | return button_context_settings; | ||
210 | case CONTEXT_SETTINGS_TIME: | ||
211 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
212 | case CONTEXT_SETTINGS_EQ: | ||
213 | case CONTEXT_SETTINGS_RECTRIGGER: | ||
214 | return button_context_settings_vol_is_inc; | ||
215 | case CONTEXT_TREE: | ||
216 | case CONTEXT_MAINMENU: | ||
217 | return button_context_tree; | ||
218 | case CONTEXT_WPS: | ||
219 | return button_context_wps; | ||
220 | case CONTEXT_YESNOSCREEN: | ||
221 | return button_context_yesnoscreen; | ||
222 | } | ||
223 | return button_context_standard; | ||
224 | } | ||