diff options
Diffstat (limited to 'apps/plugins/test_scanrate.c')
-rw-r--r-- | apps/plugins/test_scanrate.c | 98 |
1 files changed, 30 insertions, 68 deletions
diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c index ba9f5330a7..b558e765c3 100644 --- a/apps/plugins/test_scanrate.c +++ b/apps/plugins/test_scanrate.c | |||
@@ -20,68 +20,28 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | #include "lib/pluginlib_actions.h" | |
24 | #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) \ | 24 | |
25 | || (CONFIG_KEYPAD == IRIVER_H100_PAD) | 25 | /* this set the context to use with PLA */ |
26 | #define SCANRATE_DONE BUTTON_OFF | 26 | static const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; |
27 | #define SCANRATE_FASTINC BUTTON_UP | 27 | #define SCANRATE_QUIT PLA_EXIT |
28 | #define SCANRATE_FASTDEC BUTTON_DOWN | 28 | #define SCANRATE_QUIT2 PLA_CANCEL |
29 | #define SCANRATE_INC BUTTON_RIGHT | 29 | #define SCANRATE_FASTINC PLA_UP |
30 | #define SCANRATE_DEC BUTTON_LEFT | 30 | #define SCANRATE_FASTINC_REPEAT PLA_UP_REPEAT |
31 | 31 | #define SCANRATE_FASTDEC PLA_DOWN | |
32 | #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ | 32 | #define SCANRATE_FASTDEC_REPEAT PLA_DOWN_REPEAT |
33 | || (CONFIG_KEYPAD == MROBE100_PAD) \ | 33 | |
34 | || (CONFIG_KEYPAD == SANSA_CLIP_PAD) | 34 | #ifdef HAVE_SCROLLWHEEL |
35 | #define SCANRATE_DONE BUTTON_POWER | 35 | #define SCANRATE_INC PLA_SCROLL_FWD |
36 | #define SCANRATE_FASTINC BUTTON_UP | 36 | #define SCANRATE_INC_REPEAT PLA_SCROLL_FWD_REPEAT |
37 | #define SCANRATE_FASTDEC BUTTON_DOWN | 37 | #define SCANRATE_DEC PLA_SCROLL_BACK |
38 | #define SCANRATE_INC BUTTON_RIGHT | 38 | #define SCANRATE_DEC_REPEAT PLA_SCROLL_BACK_REPEAT |
39 | #define SCANRATE_DEC BUTTON_LEFT | 39 | #else |
40 | 40 | #define SCANRATE_INC PLA_RIGHT | |
41 | #elif CONFIG_KEYPAD == SANSA_FUZE_PAD | 41 | #define SCANRATE_INC_REPEAT PLA_RIGHT_REPEAT |
42 | #define SCANRATE_DONE (BUTTON_HOME|BUTTON_REPEAT) | 42 | #define SCANRATE_DEC PLA_LEFT |
43 | #define SCANRATE_FASTINC BUTTON_UP | 43 | #define SCANRATE_DEC_REPEAT PLA_LEFT_REPEAT |
44 | #define SCANRATE_FASTDEC BUTTON_DOWN | 44 | #endif /*HAVE_SCROLLWHEEL*/ |
45 | #define SCANRATE_INC BUTTON_RIGHT | ||
46 | #define SCANRATE_DEC BUTTON_LEFT | ||
47 | |||
48 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD | ||
49 | #define SCANRATE_DONE BUTTON_RC_REC | ||
50 | #define SCANRATE_FASTINC BUTTON_RC_VOL_UP | ||
51 | #define SCANRATE_FASTDEC BUTTON_RC_VOL_DOWN | ||
52 | #define SCANRATE_INC BUTTON_RC_FF | ||
53 | #define SCANRATE_DEC BUTTON_RC_REW | ||
54 | |||
55 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ | ||
56 | || (CONFIG_KEYPAD == IPOD_1G2G_PAD) | ||
57 | #define SCANRATE_DONE BUTTON_MENU | ||
58 | #define SCANRATE_FASTINC BUTTON_SCROLL_FWD | ||
59 | #define SCANRATE_FASTDEC BUTTON_SCROLL_BACK | ||
60 | #define SCANRATE_INC BUTTON_RIGHT | ||
61 | #define SCANRATE_DEC BUTTON_LEFT | ||
62 | |||
63 | #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD | ||
64 | #define SCANRATE_DONE BUTTON_PLAY | ||
65 | #define SCANRATE_FASTINC BUTTON_FFWD | ||
66 | #define SCANRATE_FASTDEC BUTTON_REW | ||
67 | #define SCANRATE_INC BUTTON_UP | ||
68 | #define SCANRATE_DEC BUTTON_DOWN | ||
69 | |||
70 | #elif CONFIG_KEYPAD == MPIO_HD200_PAD | ||
71 | #define SCANRATE_DONE BUTTON_PLAY | ||
72 | #define SCANRATE_FASTINC BUTTON_FF | ||
73 | #define SCANRATE_FASTDEC BUTTON_REW | ||
74 | #define SCANRATE_INC BUTTON_VOL_UP | ||
75 | #define SCANRATE_DEC BUTTON_VOL_DOWN | ||
76 | |||
77 | #elif CONFIG_KEYPAD == MPIO_HD300_PAD | ||
78 | #define SCANRATE_DONE BUTTON_PLAY | ||
79 | #define SCANRATE_FASTINC BUTTON_UP | ||
80 | #define SCANRATE_FASTDEC BUTTON_DOWN | ||
81 | #define SCANRATE_INC BUTTON_FF | ||
82 | #define SCANRATE_DEC BUTTON_REW | ||
83 | |||
84 | #endif | ||
85 | 45 | ||
86 | /* Default refresh rates in 1/10 Hz */ | 46 | /* Default refresh rates in 1/10 Hz */ |
87 | #if defined ARCHOS_RECORDER || defined ARCHOS_FMRECORDER \ | 47 | #if defined ARCHOS_RECORDER || defined ARCHOS_FMRECORDER \ |
@@ -199,34 +159,36 @@ int plugin_main(void) | |||
199 | need_refresh = true; | 159 | need_refresh = true; |
200 | change = false; | 160 | change = false; |
201 | } | 161 | } |
202 | button = rb->button_get(true); | 162 | button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, |
163 | ARRAYLEN(plugin_contexts)); | ||
203 | switch (button) | 164 | switch (button) |
204 | { | 165 | { |
205 | case SCANRATE_FASTINC: | 166 | case SCANRATE_FASTINC: |
206 | case SCANRATE_FASTINC|BUTTON_REPEAT: | 167 | case SCANRATE_FASTINC_REPEAT: |
207 | scan_rate += 10; | 168 | scan_rate += 10; |
208 | change = true; | 169 | change = true; |
209 | break; | 170 | break; |
210 | 171 | ||
211 | case SCANRATE_FASTDEC: | 172 | case SCANRATE_FASTDEC: |
212 | case SCANRATE_FASTDEC|BUTTON_REPEAT: | 173 | case SCANRATE_FASTDEC_REPEAT: |
213 | scan_rate -= 10; | 174 | scan_rate -= 10; |
214 | change = true; | 175 | change = true; |
215 | break; | 176 | break; |
216 | 177 | ||
217 | case SCANRATE_INC: | 178 | case SCANRATE_INC: |
218 | case SCANRATE_INC|BUTTON_REPEAT: | 179 | case SCANRATE_INC_REPEAT: |
219 | scan_rate++; | 180 | scan_rate++; |
220 | change = true; | 181 | change = true; |
221 | break; | 182 | break; |
222 | 183 | ||
223 | case SCANRATE_DEC: | 184 | case SCANRATE_DEC: |
224 | case SCANRATE_DEC|BUTTON_REPEAT: | 185 | case SCANRATE_DEC_REPEAT: |
225 | scan_rate--; | 186 | scan_rate--; |
226 | change = true; | 187 | change = true; |
227 | break; | 188 | break; |
228 | 189 | ||
229 | case SCANRATE_DONE: | 190 | case SCANRATE_QUIT: |
191 | case SCANRATE_QUIT2: | ||
230 | done = true; | 192 | done = true; |
231 | break; | 193 | break; |
232 | } | 194 | } |