summaryrefslogtreecommitdiff
path: root/firmware/export/button.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/button.h')
-rw-r--r--firmware/export/button.h389
1 files changed, 254 insertions, 135 deletions
diff --git a/firmware/export/button.h b/firmware/export/button.h
index be1efa7001..90edd05d51 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -28,7 +28,8 @@
28#define HAS_BUTTON_HOLD 28#define HAS_BUTTON_HOLD
29#define HAS_REMOTE_BUTTON_HOLD 29#define HAS_REMOTE_BUTTON_HOLD
30#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ 30#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
31 (CONFIG_KEYPAD == IPOD_3G_PAD) 31 (CONFIG_KEYPAD == IPOD_3G_PAD) || \
32 (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
32#define HAS_BUTTON_HOLD 33#define HAS_BUTTON_HOLD
33#endif 34#endif
34extern struct event_queue button_queue; 35extern struct event_queue button_queue;
@@ -49,174 +50,292 @@ bool button_hold(void);
49bool remote_button_hold(void); 50bool remote_button_hold(void);
50#endif 51#endif
51 52
52#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
53bool button_hold(void);
54#endif
55 53
56#define BUTTON_NONE 0x0000 54#define BUTTON_NONE 0x00000000
57 55
58/* Shared button codes */ 56 /* Button modifiers */
59#define BUTTON_LEFT 0x0040 57#define BUTTON_REL 0x02000000
60#define BUTTON_RIGHT 0x0080 58#define BUTTON_REPEAT 0x04000000
61 59
62/* Button modifiers */ 60
63#define BUTTON_REMOTE 0x2000 61 /* Target specific button codes */
64#define BUTTON_REPEAT 0x4000 62
65#define BUTTON_REL 0x8000 63#if (CONFIG_KEYPAD == IRIVER_H100_PAD)\
66 64 || (CONFIG_KEYPAD == IRIVER_H300_PAD)
67/* remote control buttons */ 65
68#define BUTTON_RC_VOL_UP (0x0008 | BUTTON_REMOTE) 66/* iRiver H100/H300 specific button codes */
69#define BUTTON_RC_VOL_DOWN (0x0800 | BUTTON_REMOTE) 67
70#define BUTTON_RC_LEFT (BUTTON_LEFT | BUTTON_REMOTE) 68 /* Main unit's buttons */
71#define BUTTON_RC_RIGHT (BUTTON_RIGHT| BUTTON_REMOTE) 69#define BUTTON_ON 0x00000001
72 70#define BUTTON_OFF 0x00000002
73#if CONFIG_KEYPAD == IRIVER_H100_PAD 71
74 72#define BUTTON_LEFT 0x00000004
75/* iRiver H100 specific button codes */ 73#define BUTTON_RIGHT 0x00000008
76#define BUTTON_SELECT 0x0100 74#define BUTTON_UP 0x00000010
77#define BUTTON_MODE 0x0200 75#define BUTTON_DOWN 0x00000020
78#define BUTTON_REC 0x0400 76
79#define BUTTON_ON 0x0001 77#define BUTTON_REC 0x00000040
80#define BUTTON_OFF 0x0002 78#define BUTTON_MODE 0x00000080
81#define BUTTON_UP 0x0010 79
82#define BUTTON_DOWN 0x0020 80#define BUTTON_SELECT 0x00000100
83 81
84#define BUTTON_RC_ON (BUTTON_REMOTE | 0x00010000) 82#define BUTTON_MAIN (BUTTON_ON|BUTTON_OFF|BUTTON_LEFT|BUTTON_RIGHT|\
85#define BUTTON_RC_STOP (BUTTON_REMOTE | 0x00020000) 83 BUTTON_UP|BUTTON_DOWN|BUTTON_REC|BUTTON_MODE|BUTTON_SELECT)
86#define BUTTON_RC_MODE (BUTTON_REMOTE | 0x00040000) 84
87#define BUTTON_RC_BITRATE (BUTTON_REMOTE | 0x00200000) 85 /* Remote control's buttons */
88#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000) 86#define BUTTON_RC_ON 0x00100000
89#define BUTTON_RC_SOURCE (BUTTON_REMOTE | 0x00800000) 87#define BUTTON_RC_STOP 0x00080000
90#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x01000000) 88
91#define BUTTON_RC_FF (BUTTON_REMOTE | 0x02000000) 89#define BUTTON_RC_REW 0x00040000
92#define BUTTON_RC_REW (BUTTON_REMOTE | 0x04000000) 90#define BUTTON_RC_FF 0x00020000
93 91#define BUTTON_RC_VOL_UP 0x00010000
94#elif CONFIG_KEYPAD == IRIVER_H300_PAD 92#define BUTTON_RC_VOL_DOWN 0x00008000
95 93
96/* iRiver H300 specific button codes */ 94#define BUTTON_RC_REC 0x00004000
97#define BUTTON_SELECT 0x0100 95#define BUTTON_RC_MODE 0x00002000
98#define BUTTON_MODE 0x0200 96
99#define BUTTON_REC 0x0400 97#define BUTTON_RC_MENU 0x00001000
100#define BUTTON_ON 0x0001 98
101#define BUTTON_OFF 0x0002 99#define BUTTON_RC_BITRATE 0x00000800
102#define BUTTON_UP 0x0010 100#define BUTTON_RC_SOURCE 0x00000400
103#define BUTTON_DOWN 0x0020 101
104 102#define BUTTON_REMOTE (BUTTON_RC_ON|BUTTON_RC_STOP|BUTTON_RC_REW|BUTTON_RC_FF\
105#define BUTTON_RC_ON (BUTTON_REMOTE | 0x00010000) 103 |BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN|BUTTON_RC_REC\
106#define BUTTON_RC_STOP (BUTTON_REMOTE | 0x00020000) 104 |BUTTON_RC_MODE|BUTTON_RC_MENU|BUTTON_RC_BITRATE\
107#define BUTTON_RC_MODE (BUTTON_REMOTE | 0x00040000) 105 |BUTTON_RC_SOURCE)
108#define BUTTON_RC_BITRATE (BUTTON_REMOTE | 0x00200000)
109#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00400000)
110#define BUTTON_RC_SOURCE (BUTTON_REMOTE | 0x00800000)
111#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x01000000)
112#define BUTTON_RC_FF (BUTTON_REMOTE | 0x02000000)
113#define BUTTON_RC_REW (BUTTON_REMOTE | 0x04000000)
114 106
115#elif CONFIG_KEYPAD == RECORDER_PAD 107#elif CONFIG_KEYPAD == RECORDER_PAD
116 108
117/* Recorder specific button codes */ 109 /* Recorder specific button codes */
118#define BUTTON_ON 0x0001 110
119#define BUTTON_OFF 0x0002 111 /* Main unit's buttons */
120#define BUTTON_PLAY 0x0004 112#define BUTTON_ON 0x00000001
121#define BUTTON_UP 0x0010 113#define BUTTON_OFF 0x00000002
122#define BUTTON_DOWN 0x0020 114
123#define BUTTON_F1 0x0100 115#define BUTTON_LEFT 0x00000004
124#define BUTTON_F2 0x0200 116#define BUTTON_RIGHT 0x00000008
125#define BUTTON_F3 0x0400 117#define BUTTON_UP 0x00000010
118#define BUTTON_DOWN 0x00000020
119
120#define BUTTON_PLAY 0x00000040
121
122#define BUTTON_F1 0x00000080
123#define BUTTON_F2 0x00000100
124#define BUTTON_F3 0x00000200
126 125
127#define BUTTON_RC_PLAY (BUTTON_PLAY | BUTTON_REMOTE) 126#define BUTTON_MAIN (BUTTON_ON|BUTTON_OFF|BUTTON_LEFT|BUTTON_RIGHT\
128#define BUTTON_RC_STOP (BUTTON_OFF | BUTTON_REMOTE) 127 |BUTTON_UP|BUTTON_DOWN|BUTTON_PLAY\
128 |BUTTON_F1|BUTTON_F2|BUTTON_F3)
129
130 /* Remote control's buttons */
131#define BUTTON_RC_PLAY 0x00100000
132#define BUTTON_RC_STOP 0x00080000
133
134#define BUTTON_RC_LEFT 0x00040000
135#define BUTTON_RC_RIGHT 0x00020000
136#define BUTTON_RC_VOL_UP 0x00010000
137#define BUTTON_RC_VOL_DOWN 0x00008000
138
139#define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_STOP\
140 |BUTTON_RC_LEFT|BUTTON_RC_RIGHT\
141 |BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN)
129 142
130#elif CONFIG_KEYPAD == PLAYER_PAD 143#elif CONFIG_KEYPAD == PLAYER_PAD
131 144
132/* Jukebox 6000 and Studio specific button codes */ 145/* Jukebox 6000 and Studio specific button codes */
133#define BUTTON_ON 0x0001
134#define BUTTON_MENU 0x0002
135#define BUTTON_PLAY 0x0010
136#define BUTTON_STOP 0x0020
137 146
138#define BUTTON_RC_PLAY (BUTTON_PLAY | BUTTON_REMOTE) 147 /* Main unit's buttons */
139#define BUTTON_RC_STOP (BUTTON_STOP | BUTTON_REMOTE) 148#define BUTTON_ON 0x00000001
149#define BUTTON_STOP 0x00000002
150
151#define BUTTON_LEFT 0x00000004
152#define BUTTON_RIGHT 0x00000008
153#define BUTTON_PLAY 0x00000010
154#define BUTTON_MENU 0x00000020
155
156#define BUTTON_MAIN (BUTTON_ON|BUTTON_STOP|BUTTON_LEFT|BUTTON_RIGHT\
157 |BUTTON_PLAY|BUTTON_MENU)
158
159 /* Remote control's buttons */
160#define BUTTON_RC_PLAY 0x00100000
161#define BUTTON_RC_STOP 0x00080000
162
163#define BUTTON_RC_LEFT 0x00040000
164#define BUTTON_RC_RIGHT 0x00020000
165#define BUTTON_RC_VOL_UP 0x00010000
166#define BUTTON_RC_VOL_DOWN 0x00008000
167
168#define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_STOP\
169 |BUTTON_RC_LEFT|BUTTON_RC_RIGHT\
170 |BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN)
171
140 172
141#elif CONFIG_KEYPAD == ONDIO_PAD 173#elif CONFIG_KEYPAD == ONDIO_PAD
142 174
143/* Ondio specific button codes */ 175 /* Ondio specific button codes */
144#define BUTTON_OFF 0x0002 176
145#define BUTTON_UP 0x0010 177#define BUTTON_OFF 0x00000001
146#define BUTTON_DOWN 0x0020 178#define BUTTON_MENU 0x00000002
147#define BUTTON_MENU 0x0100 179
180#define BUTTON_LEFT 0x00000004
181#define BUTTON_RIGHT 0x00000008
182#define BUTTON_UP 0x00000010
183#define BUTTON_DOWN 0x00000020
184
185#define BUTTON_MAIN (BUTTON_OFF|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
186 |BUTTON_UP|BUTTON_DOWN)
187
188#define BUTTON_REMOTE 0
148 189
149#elif CONFIG_KEYPAD == GMINI100_PAD 190#elif CONFIG_KEYPAD == GMINI100_PAD
150 191
151#define BUTTON_ON 0x0001 192 /* Gmini specific button codes */
152#define BUTTON_OFF 0x0002
153#define BUTTON_PLAY 0x0004
154#define BUTTON_UP 0x0010
155#define BUTTON_DOWN 0x0020
156#define BUTTON_MENU 0x0100
157 193
158#elif (CONFIG_KEYPAD == IPOD_4G_PAD) 194#define BUTTON_ON 0x00000001
195#define BUTTON_OFF 0x00000002
159 196
160/* TODO: These codes should relate to the hardware */ 197#define BUTTON_LEFT 0x00000004
198#define BUTTON_RIGHT 0x00000008
199#define BUTTON_UP 0x00000010
200#define BUTTON_DOWN 0x00000020
161 201
162#define BUTTON_MENU 0x0002 202#define BUTTON_PLAY 0x00000040
163#define BUTTON_PLAY 0x0004 203#define BUTTON_MENU 0x00000080
164#define BUTTON_SELECT 0x0008 204
165#define BUTTON_SCROLL_FWD 0x0010 205#define BUTTON_MAIN (BUTTON_ON|BUTTON_OFF|BUTTON_LEFT|BUTTON_RIGHT\
166#define BUTTON_SCROLL_BACK 0x0020 206 |BUTTON_UP|BUTTON_DOWN|BUTTON_PLAY|BUTTON_MENU)
167/* This is for later 207
168#define BUTTON_SCROLL_TOUCH 0x0100*/ 208#define BUTTON_REMOTE 0
209
210#elif ((CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD))
211
212 /* iPod specific button codes */
169 213
170#elif CONFIG_KEYPAD == IPOD_3G_PAD 214#define BUTTON_SELECT 0x00000001
215#define BUTTON_MENU 0x00000002
171 216
172/* TODO: These codes should relate to the hardware */ 217#define BUTTON_LEFT 0x00000004
218#define BUTTON_RIGHT 0x00000008
219#define BUTTON_SCROLL_FWD 0x00000010
220#define BUTTON_SCROLL_BACK 0x00000020
173 221
174#define BUTTON_MENU 0x0002 222#define BUTTON_PLAY 0x00000040
175#define BUTTON_PLAY 0x0004 223
176#define BUTTON_SELECT 0x0008 224#if CONFIG_KEYPAD == IPOD_3G_PAD
177#define BUTTON_SCROLL_FWD 0x0010 225#define BUTTON_HOLD 0x00000100
178#define BUTTON_SCROLL_BACK 0x0020 226/* TODO Does the BUTTON_HOLD need to be here? */
179#define BUTTON_HOLD 0x0100 227#define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\
228 |BUTTON_LEFT|BUTTON_RIGHT\
229 |BUTTON_SCROLL_FWD|BUTTON_SCROLL_BACK\
230 |BUTTON_PLAY|BUTTON_HOLD)
231#else
232#define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\
233 |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_SCROLL_FWD\
234 |BUTTON_SCROLL_BACK|BUTTON_PLAY)
235#endif
236
237#define BUTTON_REMOTE 0
238
239/* This is for later
240#define BUTTON_SCROLL_TOUCH 0x00000200
241*/
180 242
181#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD 243#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
182 244
183#define BUTTON_PLAY 0x0001 245/* iriver IFP7XX specific button codes */
184#define BUTTON_EQ 0x0002 246
185#define BUTTON_MODE 0x0004 247#define BUTTON_PLAY 0x00000001
186#define BUTTON_UP 0x0010 248#define BUTTON_SELECT 0x00000002
187#define BUTTON_DOWN 0x0020 249
188#define BUTTON_SELECT 0x0100 250#define BUTTON_LEFT 0x00000004
251#define BUTTON_RIGHT 0x00000008
252#define BUTTON_UP 0x00000010
253#define BUTTON_DOWN 0x00000020
254
255#define BUTTON_MODE 0x00000040
256#define BUTTON_EQ 0x00000080
257
258#define BUTTON_MAIN (BUTTON_PLAY|BUTTON_SELECT\
259 |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN\
260 |BUTTON_MODE|BUTTON_EQ)
261
262#define BUTTON_REMOTE 0
189 263
190#elif CONFIG_KEYPAD == IAUDIO_X5_PAD 264#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
191 265
192/* TODO: These codes should relate to the hardware */ 266/* iaudio X5 specific button codes */
267
268 /* Main unit's buttons */
269#define BUTTON_POWER 0x00000001
270#define BUTTON_PLAY 0x00000002
271
272#define BUTTON_LEFT 0x00000004
273#define BUTTON_RIGHT 0x00000008
274#define BUTTON_UP 0x00000010
275#define BUTTON_DOWN 0x00000020
276
277#define BUTTON_REC 0x00000040
278#define BUTTON_SELECT 0x00000080
279
280#define BUTTON_MAIN (BUTTON_POWER|BUTTON_PLAY|BUTTON_LEFT|BUTTON_RIGHT\
281 |BUTTON_UP|BUTTON_DOWN|BUTTON_REC|BUTTON_SELECT)
282
283 /* Remote control's buttons */
284#define BUTTON_RC_PLAY 0x00100000
285
286#define BUTTON_RC_REW 0x00080000
287#define BUTTON_RC_FF 0x00040000
288#define BUTTON_RC_VOL_UP 0x00020000
289#define BUTTON_RC_VOL_DOWN 0x00010000
290
291#define BUTTON_RC_REC 0x00008000
292#define BUTTON_RC_MENU 0x00004000
293
294#define BUTTON_RC_MODE 0x00002000
295
296#define BUTTON_REMOTE (BUTTON_RC_PLAY|BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN\
297 |BUTTON_RC_REW|BUTTON_RC_FF\
298 |BUTTON_RC_REC|BUTTON_RC_MENU|BUTTON_RC_MODE)
193 299
194#define BUTTON_PLAY 0x0001
195#define BUTTON_REC 0x0002
196#define BUTTON_POWER 0x0004
197#define BUTTON_UP 0x0008
198#define BUTTON_DOWN 0x0010
199#define BUTTON_SELECT 0x0020
200 300
201#define BUTTON_RC_PLAY (BUTTON_REMOTE | 0x00010000)
202#define BUTTON_RC_REW (BUTTON_REMOTE | 0x00020000)
203#define BUTTON_RC_FF (BUTTON_REMOTE | 0x00040000)
204#define BUTTON_RC_MODE (BUTTON_REMOTE | 0x00080000)
205#define BUTTON_RC_REC (BUTTON_REMOTE | 0x00100000)
206#define BUTTON_RC_MENU (BUTTON_REMOTE | 0x00200000)
207 301
208#elif CONFIG_KEYPAD == GIGABEAT_PAD 302#elif CONFIG_KEYPAD == GIGABEAT_PAD
303/* Toshiba Gigabeat specific button codes */
304
305#define BUTTON_POWER 0x00000001
306#define BUTTON_MENU 0x00000002
307
308#define BUTTON_LEFT 0x00000004
309#define BUTTON_RIGHT 0x00000008
310#define BUTTON_UP 0x00000010
311#define BUTTON_DOWN 0x00000020
312
313#define BUTTON_VOL_UP 0x00000040
314#define BUTTON_VOL_DOWN 0x00000080
315
316#define BUTTON_SELECT 0x00000100
317#define BUTTON_A 0x00000200
318
319
320#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
321 |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
322 |BUTTON_SELECT|BUTTON_A)
323
324
325#define BUTTON_REMOTE 0
326
327#elif 0
209 328
210/* TODO: These codes should relate to the hardware */ 329/*
330 * Please, add the next Rockbox target's button defines here,
331 * using:
332 * - bits 0 and up: for main unit's buttons
333 * - bits 20 (0x00100000) and downwards for the remote buttons (if applicable)
334 * Don't forget to add BUTTON_MAIN and BUTTON_REMOTE masks
335 * Currently, main buttons on all targets are up to bit 9 (0x00000200),
336 * and remote buttons are down to bit 10 (0x00000400)
337 */
211 338
212#define BUTTON_POWER 0x0001
213#define BUTTON_MENU 0x0002
214#define BUTTON_VOL_UP 0x0008
215#define BUTTON_VOL_DOWN 0x0010
216#define BUTTON_A 0x0020
217#define BUTTON_UP 0x0100
218#define BUTTON_DOWN 0x0200
219#define BUTTON_SELECT 0x0400
220 339
221 340
222#endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */ 341#endif /* RECORDER/PLAYER/ONDIO/GMINI KEYPAD */