diff options
Diffstat (limited to 'apps/plugins/test_grey.c')
-rw-r--r-- | apps/plugins/test_grey.c | 108 |
1 files changed, 25 insertions, 83 deletions
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c index f4555c1eed..c4179df135 100644 --- a/apps/plugins/test_grey.c +++ b/apps/plugins/test_grey.c | |||
@@ -21,87 +21,27 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/grey.h" | 22 | #include "lib/grey.h" |
23 | #include "lib/helper.h" | 23 | #include "lib/helper.h" |
24 | 24 | #include "lib/pluginlib_actions.h" | |
25 | 25 | ||
26 | 26 | /* this set the context to use with PLA */ | |
27 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ | 27 | static const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; |
28 | || (CONFIG_KEYPAD == IPOD_1G2G_PAD) | 28 | |
29 | #define GREY_QUIT BUTTON_MENU | 29 | #define GREY_QUIT PLA_EXIT |
30 | #define GREY_OK BUTTON_SELECT | 30 | #define GREY_QUIT2 PLA_CANCEL |
31 | #define GREY_PREV BUTTON_LEFT | 31 | #define GREY_OK PLA_SELECT |
32 | #define GREY_NEXT BUTTON_RIGHT | 32 | #define GREY_PREV PLA_LEFT |
33 | #define GREY_UP BUTTON_SCROLL_FWD | 33 | #define GREY_NEXT PLA_RIGHT |
34 | #define GREY_DOWN BUTTON_SCROLL_BACK | 34 | #ifdef HAVE_SCROLLWHEEL |
35 | 35 | #define GREY_UP PLA_SCROLL_FWD | |
36 | #elif CONFIG_KEYPAD == IRIVER_H100_PAD | 36 | #define GREY_UP_REPEAT PLA_SCROLL_FWD_REPEAT |
37 | #define GREY_QUIT BUTTON_OFF | 37 | #define GREY_DOWN PLA_SCROLL_BACK |
38 | #define GREY_OK BUTTON_SELECT | 38 | #define GREY_DOWN_REPEAT PLA_SCROLL_BACK_REPEAT |
39 | #define GREY_PREV BUTTON_LEFT | ||
40 | #define GREY_NEXT BUTTON_RIGHT | ||
41 | #define GREY_UP BUTTON_UP | ||
42 | #define GREY_DOWN BUTTON_DOWN | ||
43 | |||
44 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
45 | #define GREY_QUIT BUTTON_OFF | ||
46 | #define GREY_OK BUTTON_PLAY | ||
47 | #define GREY_PREV BUTTON_LEFT | ||
48 | #define GREY_NEXT BUTTON_RIGHT | ||
49 | #define GREY_UP BUTTON_UP | ||
50 | #define GREY_DOWN BUTTON_DOWN | ||
51 | |||
52 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
53 | #define GREY_QUIT BUTTON_OFF | ||
54 | #define GREY_OK BUTTON_MENU | ||
55 | #define GREY_PREV BUTTON_LEFT | ||
56 | #define GREY_NEXT BUTTON_RIGHT | ||
57 | #define GREY_UP BUTTON_UP | ||
58 | #define GREY_DOWN BUTTON_DOWN | ||
59 | |||
60 | #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ | ||
61 | || (CONFIG_KEYPAD == MROBE100_PAD) \ | ||
62 | || (CONFIG_KEYPAD == SANSA_CLIP_PAD) | ||
63 | #define GREY_QUIT BUTTON_POWER | ||
64 | #define GREY_OK BUTTON_SELECT | ||
65 | #define GREY_PREV BUTTON_LEFT | ||
66 | #define GREY_NEXT BUTTON_RIGHT | ||
67 | #define GREY_UP BUTTON_UP | ||
68 | #define GREY_DOWN BUTTON_DOWN | ||
69 | |||
70 | #elif CONFIG_KEYPAD == IAUDIO_M3_PAD | ||
71 | #define GREY_QUIT BUTTON_RC_REC | ||
72 | #define GREY_OK BUTTON_RC_PLAY | ||
73 | #define GREY_PREV BUTTON_RC_REW | ||
74 | #define GREY_NEXT BUTTON_RC_FF | ||
75 | #define GREY_UP BUTTON_RC_VOL_UP | ||
76 | #define GREY_DOWN BUTTON_RC_VOL_DOWN | ||
77 | |||
78 | #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD | ||
79 | #define GREY_QUIT BUTTON_REC | ||
80 | #define GREY_OK BUTTON_PLAY | ||
81 | #define GREY_PREV BUTTON_LEFT | ||
82 | #define GREY_NEXT BUTTON_RIGHT | ||
83 | #define GREY_UP BUTTON_UP | ||
84 | #define GREY_DOWN BUTTON_DOWN | ||
85 | |||
86 | #elif CONFIG_KEYPAD == MPIO_HD200_PAD | ||
87 | #define GREY_QUIT (BUTTON_REC|BUTTON_PLAY) | ||
88 | #define GREY_OK BUTTON_PLAY | ||
89 | #define GREY_PREV BUTTON_REW | ||
90 | #define GREY_NEXT BUTTON_FF | ||
91 | #define GREY_UP BUTTON_VOL_UP | ||
92 | #define GREY_DOWN BUTTON_VOL_DOWN | ||
93 | |||
94 | #elif CONFIG_KEYPAD == MPIO_HD300_PAD | ||
95 | #define GREY_QUIT (BUTTON_REC|BUTTON_REPEAT) | ||
96 | #define GREY_OK BUTTON_PLAY | ||
97 | #define GREY_PREV BUTTON_REW | ||
98 | #define GREY_NEXT BUTTON_FF | ||
99 | #define GREY_UP BUTTON_UP | ||
100 | #define GREY_DOWN BUTTON_DOWN | ||
101 | |||
102 | #else | 39 | #else |
103 | #error unsupported keypad | 40 | #define GREY_UP PLA_UP |
104 | #endif | 41 | #define GREY_UP_REPEAT PLA_UP_REPEAT |
42 | #define GREY_DOWN PLA_DOWN | ||
43 | #define GREY_DOWN_REPEAT PLA_DOWN_REPEAT | ||
44 | #endif /*HAVE_SCROLLWHEEL*/ | ||
105 | 45 | ||
106 | #define BLOCK_WIDTH (LCD_WIDTH/8) | 46 | #define BLOCK_WIDTH (LCD_WIDTH/8) |
107 | #define BLOCK_HEIGHT (LCD_HEIGHT/8) | 47 | #define BLOCK_HEIGHT (LCD_HEIGHT/8) |
@@ -207,7 +147,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
207 | fill_rastered(1, 1, 2, 2, cur_step - 1); | 147 | fill_rastered(1, 1, 2, 2, cur_step - 1); |
208 | grey_update(); | 148 | grey_update(); |
209 | 149 | ||
210 | button = rb->button_get(true); | 150 | button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, |
151 | ARRAYLEN(plugin_contexts)); | ||
211 | switch (button) | 152 | switch (button) |
212 | { | 153 | { |
213 | case GREY_PREV: | 154 | case GREY_PREV: |
@@ -221,7 +162,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
221 | break; | 162 | break; |
222 | 163 | ||
223 | case GREY_UP: | 164 | case GREY_UP: |
224 | case GREY_UP|BUTTON_REPEAT: | 165 | case GREY_UP_REPEAT: |
225 | l = lcd_levels[cur_step]; | 166 | l = lcd_levels[cur_step]; |
226 | if (l < 255) | 167 | if (l < 255) |
227 | { | 168 | { |
@@ -233,7 +174,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
233 | break; | 174 | break; |
234 | 175 | ||
235 | case GREY_DOWN: | 176 | case GREY_DOWN: |
236 | case GREY_DOWN|BUTTON_REPEAT: | 177 | case GREY_DOWN_REPEAT: |
237 | l = lcd_levels[cur_step]; | 178 | l = lcd_levels[cur_step]; |
238 | if (l > 0) | 179 | if (l > 0) |
239 | { | 180 | { |
@@ -273,6 +214,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
273 | /* fall through */ | 214 | /* fall through */ |
274 | 215 | ||
275 | case GREY_QUIT: | 216 | case GREY_QUIT: |
217 | case GREY_QUIT2: | ||
276 | done = true; | 218 | done = true; |
277 | break; | 219 | break; |
278 | } | 220 | } |