diff options
author | Kevin Ferrare <kevin@rockbox.org> | 2008-01-23 08:25:04 +0000 |
---|---|---|
committer | Kevin Ferrare <kevin@rockbox.org> | 2008-01-23 08:25:04 +0000 |
commit | ebe5acfb9dd80bfce2c915a568e2c86244b67510 (patch) | |
tree | c7c6894575e6c5b3d318556cc439d5aa8783061a /apps/plugins | |
parent | 8a91c19f7003a34a650b6baf52b23cbdaf767919 (diff) | |
download | rockbox-ebe5acfb9dd80bfce2c915a568e2c86244b67510.tar.gz rockbox-ebe5acfb9dd80bfce2c915a568e2c86244b67510.zip |
Fixed the problems on the new version of the fire plugin (so repush it), added new actions to the pluginlib_actions to fix the keymaps on the Sansa e200 for the clock and fire plugins. Also slightly simplified the metronome plugin's key mapping with those new actions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16148 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/clock/clock.c | 13 | ||||
-rw-r--r-- | apps/plugins/fire.c | 464 | ||||
-rw-r--r-- | apps/plugins/lib/fixedpoint.h | 8 | ||||
-rw-r--r-- | apps/plugins/lib/pluginlib_actions.c | 48 | ||||
-rw-r--r-- | apps/plugins/lib/pluginlib_actions.h | 8 | ||||
-rw-r--r-- | apps/plugins/metronome.c | 27 |
6 files changed, 263 insertions, 305 deletions
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c index f9da5bd09c..d0b8f90847 100644 --- a/apps/plugins/clock/clock.c +++ b/apps/plugins/clock/clock.c | |||
@@ -33,13 +33,14 @@ PLUGIN_HEADER | |||
33 | /* Keymaps */ | 33 | /* Keymaps */ |
34 | const struct button_mapping* plugin_contexts[]={ | 34 | const struct button_mapping* plugin_contexts[]={ |
35 | generic_actions, | 35 | generic_actions, |
36 | generic_increase_decrease, | ||
36 | generic_directions, | 37 | generic_directions, |
37 | #if NB_SCREENS == 2 | 38 | #if NB_SCREENS == 2 |
38 | remote_directions | 39 | remote_directions |
39 | #endif | 40 | #endif |
40 | }; | 41 | }; |
42 | #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | ||
41 | 43 | ||
42 | #define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | ||
43 | #define ACTION_COUNTER_TOGGLE PLA_FIRE | 44 | #define ACTION_COUNTER_TOGGLE PLA_FIRE |
44 | #define ACTION_COUNTER_RESET PLA_FIRE_REPEAT | 45 | #define ACTION_COUNTER_RESET PLA_FIRE_REPEAT |
45 | #define ACTION_MENU PLA_MENU | 46 | #define ACTION_MENU PLA_MENU |
@@ -48,10 +49,10 @@ const struct button_mapping* plugin_contexts[]={ | |||
48 | #define ACTION_MODE_NEXT_REPEAT PLA_RIGHT_REPEAT | 49 | #define ACTION_MODE_NEXT_REPEAT PLA_RIGHT_REPEAT |
49 | #define ACTION_MODE_PREV PLA_LEFT | 50 | #define ACTION_MODE_PREV PLA_LEFT |
50 | #define ACTION_MODE_PREV_REPEAT PLA_LEFT_REPEAT | 51 | #define ACTION_MODE_PREV_REPEAT PLA_LEFT_REPEAT |
51 | #define ACTION_SKIN_NEXT PLA_UP | 52 | #define ACTION_SKIN_NEXT PLA_INC |
52 | #define ACTION_SKIN_NEXT_REPEAT PLA_UP_REPEAT | 53 | #define ACTION_SKIN_NEXT_REPEAT PLA_INC_REPEAT |
53 | #define ACTION_SKIN_PREV PLA_DOWN | 54 | #define ACTION_SKIN_PREV PLA_DEC |
54 | #define ACTION_SKIN_PREV_REPEAT PLA_DOWN_REPEAT | 55 | #define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT |
55 | 56 | ||
56 | extern struct plugin_api* rb; | 57 | extern struct plugin_api* rb; |
57 | 58 | ||
@@ -139,7 +140,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ | |||
139 | /************************* | 140 | /************************* |
140 | * Scan for button presses | 141 | * Scan for button presses |
141 | ************************/ | 142 | ************************/ |
142 | button = pluginlib_getaction(rb, HZ/10, plugin_contexts, NB_ACTION_CONTEXTS); | 143 | button = pluginlib_getaction(rb, HZ/10, plugin_contexts, PLA_ARRAY_COUNT); |
143 | redraw=true;/* we'll set it to false afterwards if there was no action */ | 144 | redraw=true;/* we'll set it to false afterwards if there was no action */ |
144 | switch (button){ | 145 | switch (button){ |
145 | case ACTION_COUNTER_TOGGLE: /* start/stop counter */ | 146 | case ACTION_COUNTER_TOGGLE: /* start/stop counter */ |
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index ed3509c168..7b03e12441 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c | |||
@@ -21,8 +21,11 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "helper.h" | 23 | #include "helper.h" |
24 | #ifdef HAVE_LCD_BITMAP | ||
25 | |||
26 | #include "pluginlib_actions.h" | ||
27 | #include "fixedpoint.h" | ||
24 | 28 | ||
25 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | ||
26 | #ifndef HAVE_LCD_COLOR | 29 | #ifndef HAVE_LCD_COLOR |
27 | #include "grey.h" | 30 | #include "grey.h" |
28 | #endif | 31 | #endif |
@@ -38,191 +41,82 @@ | |||
38 | 41 | ||
39 | PLUGIN_HEADER | 42 | PLUGIN_HEADER |
40 | 43 | ||
41 | /******************************* Globals ***********************************/ | ||
42 | |||
43 | static struct plugin_api* rb; /* global api struct pointer */ | 44 | static struct plugin_api* rb; /* global api struct pointer */ |
44 | 45 | ||
45 | static unsigned char fire[LCD_HEIGHT+3][FIRE_WIDTH]; | ||
46 | static unsigned char cooling_map[LCD_HEIGHT][FIRE_WIDTH]; | ||
47 | |||
48 | #ifndef HAVE_LCD_COLOR | 46 | #ifndef HAVE_LCD_COLOR |
49 | GREY_INFO_STRUCT | 47 | GREY_INFO_STRUCT |
50 | static unsigned char *gbuf; | 48 | static unsigned char draw_buffer[FIRE_WIDTH]; |
51 | static size_t gbuf_size = 0; | 49 | |
52 | static unsigned char draw_buffer[FIRE_WIDTH]; | ||
53 | #endif | 50 | #endif |
54 | 51 | ||
55 | /* Key assignement */ | 52 | /* Key assignement */ |
56 | 53 | const struct button_mapping* plugin_contexts[]= { | |
57 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 54 | generic_increase_decrease, |
58 | #define FIRE_QUIT BUTTON_OFF | 55 | generic_directions, |
59 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_MODE | 56 | #if defined(HAVE_REMOTE_LCD) |
60 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_REC | 57 | remote_directions, |
61 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
62 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
63 | |||
64 | #define FIRE_RC_QUIT BUTTON_RC_STOP | ||
65 | |||
66 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
67 | #define FIRE_QUIT BUTTON_OFF | ||
68 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_ON | ||
69 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_PLAY | ||
70 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
71 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
72 | |||
73 | #elif CONFIG_KEYPAD == ARCHOS_AV300_PAD | ||
74 | #define FIRE_QUIT BUTTON_OFF | ||
75 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_ON | ||
76 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_SELECT | ||
77 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
78 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
79 | |||
80 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
81 | #define FIRE_QUIT BUTTON_OFF | ||
82 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_MENU | ||
83 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
84 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
85 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
86 | |||
87 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | ||
88 | (CONFIG_KEYPAD == IPOD_1G2G_PAD) | ||
89 | #define FIRE_QUIT BUTTON_MENU | ||
90 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_SELECT | ||
91 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
92 | #define FIRE_INCREASE_MULT BUTTON_SCROLL_FWD | ||
93 | #define FIRE_DECREASE_MULT BUTTON_SCROLL_BACK | ||
94 | |||
95 | #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) | ||
96 | #define FIRE_QUIT BUTTON_POWER | ||
97 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_LEFT | ||
98 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
99 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
100 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
101 | |||
102 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) | ||
103 | #define FIRE_QUIT BUTTON_POWER | ||
104 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_LEFT | ||
105 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
106 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
107 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
108 | |||
109 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ | ||
110 | (CONFIG_KEYPAD == SANSA_C200_PAD) | ||
111 | #define FIRE_QUIT BUTTON_POWER | ||
112 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_LEFT | ||
113 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
114 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
115 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
116 | |||
117 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) | ||
118 | #define FIRE_QUIT BUTTON_POWER | ||
119 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_LEFT | ||
120 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_RIGHT | ||
121 | #define FIRE_INCREASE_MULT BUTTON_SCROLL_UP | ||
122 | #define FIRE_DECREASE_MULT BUTTON_SCROLL_DOWN | ||
123 | |||
124 | #elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) | ||
125 | #define FIRE_QUIT BUTTON_PLAY | ||
126 | #define FIRE_SWITCH_FLAMES_TYPE BUTTON_MODE | ||
127 | #define FIRE_SWITCH_FLAMES_MOVING BUTTON_EQ | ||
128 | #define FIRE_INCREASE_MULT BUTTON_UP | ||
129 | #define FIRE_DECREASE_MULT BUTTON_DOWN | ||
130 | |||
131 | #endif | 58 | #endif |
59 | generic_actions | ||
60 | }; | ||
61 | #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | ||
62 | |||
63 | #define FIRE_QUIT PLA_QUIT | ||
64 | #define FIRE_SWITCH_FLAMES_TYPE PLA_LEFT | ||
65 | #define FIRE_SWITCH_FLAMES_MOVING PLA_RIGHT | ||
66 | #define FIRE_INCREASE_MULT PLA_INC | ||
67 | #define FIRE_DECREASE_MULT PLA_DEC | ||
132 | 68 | ||
133 | #define MIN_FLAME_VALUE 0 | 69 | #define MIN_FLAME_VALUE 0 |
134 | #define COOL_MAX (440/LCD_HEIGHT+2) | 70 | #define COOL_MAX (440/LCD_HEIGHT+2) |
135 | 71 | ||
136 | /* fast unsigned multiplication (16x16bit->32bit or 32x32bit->32bit, | ||
137 | * whichever is faster for the architecture) */ | ||
138 | #ifdef CPU_ARM | ||
139 | #define FMULU(a, b) ((uint32_t) (((uint32_t) (a)) * ((uint32_t) (b)))) | ||
140 | #else /* SH1, coldfire */ | ||
141 | #define FMULU(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) | ||
142 | #endif | ||
143 | |||
144 | #ifndef HAVE_LCD_COLOR | 72 | #ifndef HAVE_LCD_COLOR |
145 | static const unsigned char palette[256] = { | 73 | static unsigned char palette[256]; |
146 | 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21, 22, | 74 | |
147 | 24, 25, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, 42, 43, 45, 46, | 75 | void color_palette_init(unsigned char* palette) |
148 | 48, 49, 51, 52, 54, 55, 57, 59, 60, 61, 63, 64, 66, 67, 69, 70, | 76 | { |
149 | 72, 73, 75, 76, 78, 79, 81, 82, 84, 85, 87, 88, 90, 91, 93, 94, | 77 | int i; |
150 | 96, 97, 99, 100, 102, 103, 105, 106, 108, 109, 111, 112, 114, 115, 117, 118, | 78 | for(i=0;i<=160;i++)//palette[i]=(3/2)*i |
151 | 120, 121, 123, 124, 126, 127, 129, 130, 132, 133, 135, 136, 138, 139, 141, 142, | 79 | palette[i]=(i*3)/2; |
152 | 144, 145, 147, 148, 150, 151, 153, 154, 156, 157, 159, 160, 162, 163, 165, 166, | 80 | |
153 | 168, 169, 171, 172, 174, 175, 177, 178, 180, 181, 183, 184, 186, 187, 189, 190, | ||
154 | 192, 193, 195, 196, 198, 199, 201, 202, 204, 205, 207, 208, 210, 211, 213, 214, | ||
155 | 216, 217, 219, 220, 222, 223, 225, 226, 228, 229, 231, 232, 234, 235, 237, 238, | ||
156 | /* 'regular' fire doesn't exceed this value */ | 81 | /* 'regular' fire doesn't exceed this value */ |
157 | 240, 240, 240, 240, 240, 240, 241, 241, 241, 241, 241, 241, 242, 242, 242, 242, | 82 | for(;i<=255;i++)//palette[i]=(3/20)*i+216 |
158 | 242, 242, 243, 243, 243, 243, 243, 243, 244, 244, 244, 244, 244, 244, 245, 245, | 83 | palette[i]=(i*3+20*217)/20; |
159 | 245, 245, 245, 245, 246, 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, | 84 | } |
160 | 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, 249, 249, 250, 250, 250, 250, | ||
161 | 250, 250, 251, 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, 252, 253, 253, | ||
162 | 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255 | ||
163 | }; | ||
164 | #else | 85 | #else |
165 | #define L(r,g,b) LCD_RGBPACK(r,g,b) | 86 | |
166 | 87 | static fb_data palette[256]; | |
167 | static const fb_data colorpalette[256] = { | 88 | |
168 | L( 0, 0, 0), L( 5, 0, 0), L( 10, 0, 0), L( 15, 0, 0), L( 20, 0, 0), | 89 | /* |
169 | L( 25, 0, 0), L( 30, 0, 0), L( 35, 0, 0), L( 40, 0, 0), L( 45, 0, 0), | 90 | * Color palette generation algorithm taken from |
170 | L( 50, 0, 0), L( 55, 0, 0), L( 60, 0, 0), L( 65, 0, 0), L( 70, 0, 0), | 91 | * the "The Demo Effects Collection" GPL project |
171 | L( 75, 0, 0), L( 80, 0, 0), L( 85, 0, 0), L( 90, 0, 0), L( 95, 0, 0), | 92 | * Copyright (C) 2002 W.P. van Paassen |
172 | L(100, 0, 0), L(105, 0, 0), L(110, 0, 0), L(115, 0, 0), L(120, 0, 0), | 93 | */ |
173 | L(125, 0, 0), L(130, 0, 0), L(135, 0, 0), L(140, 0, 0), L(145, 0, 0), | 94 | void color_palette_init(fb_data* palette) |
174 | L(150, 0, 0), L(155, 0, 0), L(160, 0, 0), L(165, 0, 0), L(170, 0, 0), | 95 | { |
175 | L(175, 0, 0), L(180, 0, 0), L(185, 0, 0), L(186, 2, 0), L(187, 5, 1), | 96 | int i; |
176 | L(188, 6, 2), L(189, 8, 3), L(190, 10, 4), L(191, 12, 4), L(192, 14, 5), | 97 | for (i = 0; i < 32; i++){ |
177 | L(193, 15, 6), L(194, 17, 7), L(195, 19, 8), L(196, 21, 8), L(197, 22, 9), | 98 | /* black to blue, 32 values*/ |
178 | L(198, 24, 10), L(198, 26, 10), L(199, 28, 10), L(200, 29, 11), L(201, 32, 11), | 99 | palette[i]=LCD_RGBPACK(0, 0, 2*i); |
179 | L(202, 34, 12), L(203, 36, 13), L(204, 39, 13), L(205, 40, 14), L(206, 42, 14), | 100 | |
180 | L(207, 43, 15), L(208, 46, 16), L(208, 48, 17), L(209, 50, 18), L(210, 51, 18), | 101 | /* blue to red, 32 values*/ |
181 | L(212, 53, 19), L(213, 55, 20), L(214, 57, 21), L(215, 59, 22), L(216, 61, 22), | 102 | palette[i + 32]=LCD_RGBPACK(8*i, 0, 64 - 2*i); |
182 | L(217, 63, 23), L(217, 65, 24), L(218, 67, 24), L(219, 69, 25), L(220, 70, 25), | 103 | |
183 | L(222, 72, 26), L(223, 74, 27), L(224, 76, 28), L(225, 78, 28), L(225, 80, 29), | 104 | /* red to yellow, 32 values*/ |
184 | L(226, 82, 29), L(227, 84, 30), L(228, 86, 31), L(228, 88, 32), L(229, 90, 32), | 105 | palette[i + 64]=LCD_RGBPACK(255, 8*i, 0); |
185 | L(230, 92, 32), L(231, 94, 33), L(232, 96, 34), L(233, 98, 35), L(234, 99, 36), | 106 | |
186 | L(235,101, 37), L(236,103, 37), L(237,105, 38), L(238,107, 39), L(240,109, 39), | 107 | /* yellow to white, 162 values */ |
187 | L(240,111, 40), L(241,113, 40), L(242,114, 41), L(242,116, 42), L(243,119, 43), | 108 | palette[i + 96]=LCD_RGBPACK(255, 255, 0 + 4*i); |
188 | L(245,120, 43), L(246,122, 44), L(247,124, 44), L(248,126, 46), L(248,128, 47), | 109 | palette[i + 128]=LCD_RGBPACK(255, 255, 64 + 4*i); |
189 | L(249,130, 47), L(251,131, 47), L(252,133, 48), L(253,135, 49), L(253,138, 49), | 110 | palette[i + 160]=LCD_RGBPACK(255, 255, 128 + 4*i); |
190 | L(253,140, 50), L(254,143, 49), L(254,145, 48), L(253,148, 47), L(253,151, 46), | 111 | palette[i + 192]=LCD_RGBPACK(255, 255, 192 + i); |
191 | L(253,154, 45), L(253,156, 44), L(253,158, 44), L(252,162, 42), L(252,165, 41), | 112 | palette[i + 224]=LCD_RGBPACK(255, 255, 224 + i); |
192 | L(252,167, 41), L(252,170, 40), L(251,173, 40), L(252,175, 38), L(252,178, 37), | 113 | } |
193 | L(251,181, 37), L(251,183, 36), L(251,186, 35), L(250,189, 34), L(250,192, 33), | 114 | } |
194 | L(250,194, 33), L(249,198, 31), L(249,200, 31), L(249,203, 30), L(249,206, 29), | 115 | |
195 | L(249,209, 28), L(249,211, 27), L(249,214, 26), L(248,216, 25), L(248,219, 25), | ||
196 | L(248,222, 24), L(248,224, 23), L(248,227, 22), L(248,230, 21), L(248,232, 21), | ||
197 | L(247,236, 19), L(247,238, 23), L(247,239, 31), L(247,239, 45), L(247,240, 55), | ||
198 | L(248,240, 68), L(247,241, 78), L(248,241, 90), L(247,242,102), L(248,242,114), | ||
199 | L(247,243,125), L(248,243,138), L(248,243,153), L(248,244,162), L(248,245,174), | ||
200 | /* 'regular' fire doesn't exceed this value */ | ||
201 | L(247,245,182), L(247,245,182), L(247,245,183), L(247,245,183), L(247,245,184), | ||
202 | L(247,245,184), L(247,245,185), L(247,245,185), L(247,245,186), L(247,245,186), | ||
203 | L(247,245,187), L(247,245,187), L(247,245,188), L(247,245,188), L(247,245,189), | ||
204 | L(247,245,189), L(248,245,190), L(248,245,190), L(248,245,191), L(248,245,191), | ||
205 | L(248,245,192), L(248,245,192), L(248,245,193), L(248,245,193), L(248,245,194), | ||
206 | L(248,245,194), L(248,245,195), L(248,245,195), L(248,245,196), L(248,245,196), | ||
207 | L(248,245,197), L(248,245,197), L(248,245,198), L(248,245,198), L(248,245,199), | ||
208 | L(248,245,199), L(248,245,200), L(248,245,200), L(248,245,201), L(248,245,201), | ||
209 | L(248,245,202), L(248,245,202), L(248,245,203), L(248,245,203), L(248,245,204), | ||
210 | L(248,245,204), L(248,245,205), L(248,245,205), L(248,246,206), L(248,246,206), | ||
211 | L(248,246,207), L(248,246,207), L(248,246,208), L(248,246,208), L(248,246,209), | ||
212 | L(248,246,209), L(248,246,210), L(248,246,210), L(248,246,211), L(248,246,211), | ||
213 | L(248,246,212), L(248,246,212), L(248,246,213), L(248,246,213), L(248,246,214), | ||
214 | L(248,246,214), L(248,246,215), L(248,246,215), L(248,246,216), L(248,246,216), | ||
215 | L(248,246,217), L(248,246,217), L(248,246,218), L(248,246,218), L(248,246,219), | ||
216 | L(248,246,219), L(248,246,220), L(248,246,220), L(248,246,221), L(248,246,221), | ||
217 | L(248,246,222), L(248,246,222), L(248,246,223), L(248,246,223), L(248,246,224), | ||
218 | L(248,246,224), L(248,246,225), L(248,246,225), L(248,246,226), L(248,246,226), | ||
219 | L(248,246,227), L(248,246,227), L(248,246,228), L(248,246,228), L(248,246,229), | ||
220 | L(248,246,229) | ||
221 | }; | ||
222 | #endif | 116 | #endif |
223 | 117 | ||
224 | static inline void tab_init_rand(unsigned char *tab, unsigned int tab_size, | 118 | static void tab_init_rand(unsigned char *tab, unsigned int tab_size, |
225 | int rand_max) | 119 | int rand_max) |
226 | { | 120 | { |
227 | unsigned char *end = tab + tab_size; | 121 | unsigned char *end = tab + tab_size; |
228 | 122 | ||
@@ -230,114 +124,133 @@ static inline void tab_init_rand(unsigned char *tab, unsigned int tab_size, | |||
230 | *tab++ = (unsigned char)rb->rand() % rand_max; | 124 | *tab++ = (unsigned char)rb->rand() % rand_max; |
231 | } | 125 | } |
232 | 126 | ||
233 | static inline void fire_generate(int mult, int flames_type, bool moving) | 127 | struct fire { |
128 | unsigned char fire[LCD_HEIGHT+3][FIRE_WIDTH]; | ||
129 | unsigned char cooling_map[LCD_HEIGHT][FIRE_WIDTH]; | ||
130 | int flames_type; | ||
131 | bool moving; | ||
132 | unsigned int mult; | ||
133 | }; | ||
134 | /* makes the instance a global variable since it's too big to fit on the target's stack */ | ||
135 | static struct fire fire; | ||
136 | |||
137 | static inline void fire_convolve(struct fire* fire) | ||
234 | { | 138 | { |
235 | unsigned int pixel_value = 0; /* stop the compiler complaining */ | 139 | unsigned int pixel_value; |
236 | unsigned int cooling_value; | 140 | unsigned int cooling_value; |
237 | unsigned char *ptr, *end, *cool; | 141 | unsigned char *ptr, *end, *cool; |
142 | unsigned int mult=fire->mult; | ||
238 | 143 | ||
239 | /* Randomize the bottom line */ | ||
240 | if(moving) | ||
241 | {/* moving must be true the first time the function is called */ | ||
242 | ptr = &fire[LCD_HEIGHT][0]; | ||
243 | end = ptr + FIRE_WIDTH; | ||
244 | |||
245 | do | ||
246 | { | ||
247 | *ptr++ = (MIN_FLAME_VALUE + rb->rand() % (256-MIN_FLAME_VALUE)); | ||
248 | } | ||
249 | while (ptr < end); | ||
250 | } | ||
251 | rb->yield(); | 144 | rb->yield(); |
252 | |||
253 | /* Convolve the pixels and handle cooling (to add nice shapes effects later) */ | 145 | /* Convolve the pixels and handle cooling (to add nice shapes effects later) */ |
254 | cool = &cooling_map[0][0]; | 146 | cool = &fire->cooling_map[0][0]; |
255 | ptr = &fire[0][0]; | 147 | ptr = &fire->fire[0][0]; |
256 | end = ptr + LCD_HEIGHT*FIRE_WIDTH; | 148 | end = ptr + LCD_HEIGHT*FIRE_WIDTH; |
257 | 149 | ||
258 | switch (flames_type) | 150 | switch (fire->flames_type){ |
259 | { | 151 | case 0: |
260 | case 0: | 152 | do{ |
261 | do | 153 | pixel_value = ptr[FIRE_WIDTH-1] /* fire[y+1][x-1] */ |
262 | { | ||
263 | pixel_value = ptr[FIRE_WIDTH-1] /* fire[y+1][x-1] */ | ||
264 | + ptr[2*FIRE_WIDTH] /* fire[y+2][x] */ | 154 | + ptr[2*FIRE_WIDTH] /* fire[y+2][x] */ |
265 | + ptr[FIRE_WIDTH+1] /* fire[y+1][x+1] */ | 155 | + ptr[FIRE_WIDTH+1] /* fire[y+1][x+1] */ |
266 | + ptr[3*FIRE_WIDTH]; /* fire[y+3][x] */ | 156 | + ptr[3*FIRE_WIDTH]; /* fire[y+3][x] */ |
267 | pixel_value = FMULU(pixel_value, mult) >> 10; | 157 | pixel_value = FMULU(pixel_value, mult) >> 10; |
268 | 158 | ||
269 | cooling_value = *cool++; | 159 | cooling_value = *cool++; |
270 | if (cooling_value <= pixel_value) | 160 | if (cooling_value <= pixel_value) |
271 | pixel_value -= cooling_value; | 161 | pixel_value -= cooling_value; |
272 | /* else it's too cold, don't frost the pixels !!! */ | 162 | /* else it's too cold, don't frost the pixels !!! */ |
273 | 163 | ||
274 | if (pixel_value > 255) | 164 | if (pixel_value > 255) |
275 | pixel_value = 255; | 165 | pixel_value = 255; |
276 | 166 | ||
277 | *ptr++ = pixel_value; | 167 | *ptr++ = pixel_value; |
278 | } | 168 | }while (ptr < end); |
279 | while (ptr < end); | 169 | break; |
280 | break; | ||
281 | 170 | ||
282 | case 1: | 171 | case 1: |
283 | mult -= 2; | 172 | mult -= 2; |
284 | do | 173 | do{ |
285 | { | 174 | pixel_value = ptr[FIRE_WIDTH-1] /* fire[y+1][x-1] */ |
286 | pixel_value = ptr[FIRE_WIDTH-1] /* fire[y+1][x-1] */ | ||
287 | + ptr[FIRE_WIDTH] /* fire[y+1][x] */ | 175 | + ptr[FIRE_WIDTH] /* fire[y+1][x] */ |
288 | + ptr[FIRE_WIDTH+1] /* fire[y+1][x+1] */ | 176 | + ptr[FIRE_WIDTH+1] /* fire[y+1][x+1] */ |
289 | + ptr[2*FIRE_WIDTH]; /* fire[y+2][x] */ | 177 | + ptr[2*FIRE_WIDTH]; /* fire[y+2][x] */ |
290 | pixel_value = FMULU(pixel_value, mult) >> 10; | 178 | pixel_value = FMULU(pixel_value, mult) >> 10; |
291 | 179 | ||
292 | cooling_value = *cool++; | 180 | cooling_value = *cool++; |
293 | if (cooling_value <= pixel_value) | 181 | if (cooling_value <= pixel_value) |
294 | pixel_value -= cooling_value; | 182 | pixel_value -= cooling_value; |
295 | /* else it's too cold, don't frost the pixels !!! */ | 183 | /* else it's too cold, don't frost the pixels !!! */ |
296 | 184 | ||
297 | if (pixel_value > 255) | 185 | if (pixel_value > 255) |
298 | pixel_value = 255; | 186 | pixel_value = 255; |
299 | 187 | ||
300 | *ptr++ = pixel_value; | 188 | *ptr++ = pixel_value; |
301 | } | 189 | }while (ptr < end); |
302 | while (ptr < end); | 190 | break; |
303 | break; | ||
304 | 191 | ||
305 | default: /* We should never reach this */ | 192 | default: /* We should never reach this */ |
306 | break; | 193 | break; |
307 | } | 194 | } |
308 | rb->yield(); | 195 | rb->yield(); |
309 | } | 196 | } |
310 | 197 | ||
311 | static inline void fire_draw(void) | 198 | static void fire_generate_bottom_seed(struct fire* fire) |
312 | { | 199 | { |
313 | int y; | 200 | unsigned char *ptr, *end; |
314 | unsigned char *src = &fire[0][0]; | 201 | ptr = &fire->fire[LCD_HEIGHT][0]; |
315 | #ifndef HAVE_LCD_COLOR | 202 | end = ptr + FIRE_WIDTH; |
316 | unsigned char *dest, *end; | 203 | do{ |
204 | *ptr++ = (MIN_FLAME_VALUE + rb->rand() % (256-MIN_FLAME_VALUE)); | ||
205 | }while (ptr < end); | ||
206 | } | ||
317 | 207 | ||
318 | for (y = 0; y < LCD_HEIGHT; y++) | 208 | static inline void fire_step(struct fire* fire) |
319 | { | 209 | { |
320 | dest = draw_buffer; | 210 | if(fire->moving){ |
321 | end = dest + FIRE_WIDTH; | 211 | /* Randomize the bottom line */ |
212 | fire_generate_bottom_seed(fire); | ||
213 | /* Add here further effects like fire letters, ball ... */ | ||
214 | } | ||
215 | fire_convolve(fire); | ||
216 | } | ||
322 | 217 | ||
323 | do | 218 | static void fire_init(struct fire* fire) |
324 | *dest++ = palette[*src++]; | 219 | { |
325 | while (dest < end); | 220 | fire->mult = 261; |
221 | fire->flames_type=0; | ||
222 | fire->moving=true; | ||
223 | rb->memset(&fire->fire[0][0], 0, sizeof(fire->fire)); | ||
224 | tab_init_rand(&fire->cooling_map[0][0], LCD_HEIGHT*FIRE_WIDTH, COOL_MAX); | ||
225 | fire_generate_bottom_seed(fire); | ||
226 | } | ||
326 | 227 | ||
327 | grey_ub_gray_bitmap(draw_buffer, 0, y, FIRE_WIDTH, 1); | 228 | static inline void fire_draw(struct fire* fire) |
328 | } | 229 | { |
230 | int y; | ||
231 | unsigned char *src = &fire->fire[0][0]; | ||
232 | #ifndef HAVE_LCD_COLOR | ||
233 | unsigned char *dest, *end; | ||
329 | #else | 234 | #else |
330 | fb_data *dest, *end; | 235 | fb_data *dest, *end; |
236 | #endif | ||
331 | 237 | ||
332 | for (y = 0; y < LCD_HEIGHT; y++) | 238 | for (y = 0; y < LCD_HEIGHT; y++){ |
333 | { | 239 | #ifndef HAVE_LCD_COLOR |
240 | dest = draw_buffer; | ||
241 | #else | ||
334 | dest = rb->lcd_framebuffer + LCD_WIDTH * y + FIRE_XPOS; | 242 | dest = rb->lcd_framebuffer + LCD_WIDTH * y + FIRE_XPOS; |
243 | #endif | ||
335 | end = dest + FIRE_WIDTH; | 244 | end = dest + FIRE_WIDTH; |
336 | 245 | ||
337 | do | 246 | do |
338 | *dest++ = colorpalette[*src++]; | 247 | *dest++ = palette[*src++]; |
339 | while (dest < end); | 248 | while (dest < end); |
249 | #ifndef HAVE_LCD_COLOR | ||
250 | grey_ub_gray_bitmap(draw_buffer, 0, y, FIRE_WIDTH, 1); | ||
251 | #endif | ||
340 | } | 252 | } |
253 | #ifdef HAVE_LCD_COLOR | ||
341 | rb->lcd_update(); | 254 | rb->lcd_update(); |
342 | #endif | 255 | #endif |
343 | } | 256 | } |
@@ -345,7 +258,6 @@ static inline void fire_draw(void) | |||
345 | void cleanup(void *parameter) | 258 | void cleanup(void *parameter) |
346 | { | 259 | { |
347 | (void)parameter; | 260 | (void)parameter; |
348 | |||
349 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 261 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
350 | rb->cpu_boost(false); | 262 | rb->cpu_boost(false); |
351 | #endif | 263 | #endif |
@@ -356,77 +268,75 @@ void cleanup(void *parameter) | |||
356 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ | 268 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ |
357 | } | 269 | } |
358 | 270 | ||
359 | /* | ||
360 | * Main function that also contain the main plasma | ||
361 | * algorithm. | ||
362 | */ | ||
363 | 271 | ||
364 | int main(void) | 272 | #ifndef HAVE_LCD_COLOR |
273 | int init_grey(void) | ||
365 | { | 274 | { |
366 | int button; | 275 | unsigned char *gbuf; |
367 | int mult = 261; | 276 | size_t gbuf_size = 0; |
368 | int flames_type=0; | ||
369 | bool moving=true; | ||
370 | 277 | ||
371 | #ifndef HAVE_LCD_COLOR | ||
372 | /* get the remainder of the plugin buffer */ | 278 | /* get the remainder of the plugin buffer */ |
373 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | 279 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); |
374 | 280 | ||
375 | if (!grey_init(rb, gbuf, gbuf_size, false, FIRE_WIDTH, LCD_HEIGHT, NULL)) | 281 | if (!grey_init(rb, gbuf, gbuf_size, false, FIRE_WIDTH, LCD_HEIGHT, NULL)){ |
376 | { | ||
377 | rb->splash(HZ, "not enough memory"); | 282 | rb->splash(HZ, "not enough memory"); |
378 | return PLUGIN_ERROR; | 283 | return PLUGIN_ERROR; |
379 | } | 284 | } |
380 | /* switch on greyscale overlay */ | 285 | /* switch on greyscale overlay */ |
381 | grey_set_position(FIRE_XPOS, 0); | 286 | grey_set_position(FIRE_XPOS, 0); |
382 | grey_show(true); | 287 | grey_show(true); |
288 | return PLUGIN_OK; | ||
289 | } | ||
383 | #endif | 290 | #endif |
384 | 291 | ||
292 | int main(void) | ||
293 | { | ||
294 | int action; | ||
295 | |||
296 | #ifndef HAVE_LCD_COLOR | ||
297 | if(init_grey()!=PLUGIN_OK) | ||
298 | return(PLUGIN_ERROR); | ||
299 | #endif | ||
300 | color_palette_init(palette); | ||
301 | |||
385 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 302 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
386 | rb->cpu_boost(true); | 303 | rb->cpu_boost(true); |
387 | #endif | 304 | #endif |
388 | rb->memset(&fire[0][0], 0, sizeof(fire)); | 305 | |
389 | tab_init_rand(&cooling_map[0][0], LCD_HEIGHT*FIRE_WIDTH, COOL_MAX); | 306 | fire_init(&fire); |
390 | while (true) | 307 | while (true){ |
391 | { | 308 | fire_step(&fire); |
392 | fire_generate(mult, flames_type, moving); | 309 | fire_draw(&fire); |
393 | fire_draw(); | ||
394 | rb->yield(); | 310 | rb->yield(); |
395 | 311 | ||
396 | button = rb->button_get(false); | 312 | action = pluginlib_getaction(rb, 0, plugin_contexts, PLA_ARRAY_COUNT); |
397 | 313 | ||
398 | switch(button) | 314 | switch(action){ |
399 | { | 315 | case FIRE_QUIT: |
400 | #ifdef FIRE_RC_QUIT | ||
401 | case FIRE_RC_QUIT : | ||
402 | #endif | ||
403 | case (FIRE_QUIT): | ||
404 | cleanup(NULL); | 316 | cleanup(NULL); |
405 | return PLUGIN_OK; | 317 | return PLUGIN_OK; |
406 | break; | ||
407 | 318 | ||
408 | case (FIRE_INCREASE_MULT): | 319 | case FIRE_INCREASE_MULT: |
409 | ++mult; | 320 | ++fire.mult; |
410 | break; | 321 | break; |
411 | 322 | ||
412 | case (FIRE_DECREASE_MULT): | 323 | case FIRE_DECREASE_MULT: |
413 | if (mult > 0) | 324 | if (fire.mult > 0) |
414 | --mult; | 325 | --fire.mult; |
415 | break; | 326 | break; |
416 | 327 | ||
417 | case (FIRE_SWITCH_FLAMES_TYPE): | 328 | case FIRE_SWITCH_FLAMES_TYPE: |
418 | flames_type = (flames_type + 1) % 2; | 329 | fire.flames_type = (fire.flames_type + 1) % 2; |
419 | break; | 330 | break; |
420 | 331 | ||
421 | case (FIRE_SWITCH_FLAMES_MOVING): | 332 | case FIRE_SWITCH_FLAMES_MOVING: |
422 | moving = !moving; | 333 | fire.moving = !fire.moving; |
423 | break; | 334 | break; |
424 | 335 | ||
425 | default: | 336 | default: |
426 | if (rb->default_event_handler_ex(button, cleanup, NULL) | 337 | if (rb->default_event_handler_ex(action, cleanup, NULL) |
427 | == SYS_USB_CONNECTED) | 338 | == SYS_USB_CONNECTED) |
428 | return PLUGIN_USB_CONNECTED; | 339 | return PLUGIN_USB_CONNECTED; |
429 | break; | ||
430 | } | 340 | } |
431 | } | 341 | } |
432 | } | 342 | } |
@@ -437,7 +347,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
437 | { | 347 | { |
438 | int ret; | 348 | int ret; |
439 | 349 | ||
440 | rb = api; // copy to global api pointer | 350 | rb = api; //copy to global api pointer |
441 | (void)parameter; | 351 | (void)parameter; |
442 | #if LCD_DEPTH > 1 | 352 | #if LCD_DEPTH > 1 |
443 | rb->lcd_set_backdrop(NULL); | 353 | rb->lcd_set_backdrop(NULL); |
diff --git a/apps/plugins/lib/fixedpoint.h b/apps/plugins/lib/fixedpoint.h index 719915709a..a9650e7977 100644 --- a/apps/plugins/lib/fixedpoint.h +++ b/apps/plugins/lib/fixedpoint.h | |||
@@ -24,3 +24,11 @@ long fsqrt(long a, unsigned int fracbits); | |||
24 | long cos_int(int val); | 24 | long cos_int(int val); |
25 | long sin_int(int val); | 25 | long sin_int(int val); |
26 | long flog(int x); | 26 | long flog(int x); |
27 | |||
28 | /* fast unsigned multiplication (16x16bit->32bit or 32x32bit->32bit, | ||
29 | * whichever is faster for the architecture) */ | ||
30 | #ifdef CPU_ARM | ||
31 | #define FMULU(a, b) ((uint32_t) (((uint32_t) (a)) * ((uint32_t) (b)))) | ||
32 | #else /* SH1, coldfire */ | ||
33 | #define FMULU(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b)))) | ||
34 | #endif | ||
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c index e74ffc0315..f358bb59f6 100644 --- a/apps/plugins/lib/pluginlib_actions.c +++ b/apps/plugins/lib/pluginlib_actions.c | |||
@@ -335,6 +335,54 @@ const struct button_mapping generic_actions[] = | |||
335 | {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} | 335 | {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} |
336 | }; | 336 | }; |
337 | 337 | ||
338 | const struct button_mapping generic_increase_decrease[] = | ||
339 | { | ||
340 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ | ||
341 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) \ | ||
342 | || (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \ | ||
343 | || (CONFIG_KEYPAD == GIGABEAT_PAD) \ | ||
344 | || (CONFIG_KEYPAD == RECORDER_PAD) \ | ||
345 | || (CONFIG_KEYPAD == ARCHOS_AV300_PAD) \ | ||
346 | || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \ | ||
347 | || (CONFIG_KEYPAD == ONDIO_PAD) \ | ||
348 | || (CONFIG_KEYPAD == COWOND2_PAD) | ||
349 | {PLA_INC, BUTTON_UP, BUTTON_NONE}, | ||
350 | {PLA_DEC, BUTTON_DOWN, BUTTON_NONE}, | ||
351 | {PLA_INC_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE}, | ||
352 | {PLA_DEC_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
353 | #elif (CONFIG_KEYPAD == SANSA_C200_PAD) | ||
354 | {PLA_INC, BUTTON_VOL_UP, BUTTON_NONE}, | ||
355 | {PLA_DEC, BUTTON_VOL_DOWN, BUTTON_NONE}, | ||
356 | {PLA_INC_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE}, | ||
357 | {PLA_DEC_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
358 | #elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \ | ||
359 | || (CONFIG_KEYPAD == IPOD_3G_PAD) \ | ||
360 | || (CONFIG_KEYPAD == SANSA_E200_PAD) \ | ||
361 | || (CONFIG_KEYPAD == IPOD_4G_PAD) | ||
362 | {PLA_INC, BUTTON_SCROLL_FWD, BUTTON_NONE}, | ||
363 | {PLA_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE}, | ||
364 | {PLA_INC_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE}, | ||
365 | {PLA_DEC_REPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE}, | ||
366 | #elif CONFIG_KEYPAD == PLAYER_PAD | ||
367 | {PLA_INC, BUTTON_STOP, BUTTON_NONE}, | ||
368 | {PLA_DEC, BUTTON_PLAY, BUTTON_NONE}, | ||
369 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) \ | ||
370 | || (CONFIG_KEYPAD == MROBE100_PAD) | ||
371 | {PLA_INC, BUTTON_SCROLL_UP, BUTTON_NONE}, | ||
372 | {PLA_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE}, | ||
373 | {PLA_INC_REPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE}, | ||
374 | {PLA_DEC_REPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
375 | #elif (CONFIG_KEYPAD == MROBE500_PAD) | ||
376 | {PLA_INC, BUTTON_RC_PLAY, BUTTON_NONE}, | ||
377 | {PLA_DEC, BUTTON_RC_DOWN, BUTTON_NONE}, | ||
378 | {PLA_INC_REPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE}, | ||
379 | {PLA_DEC_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE}, | ||
380 | #else | ||
381 | #error pluginlib_actions: Unsupported keypad | ||
382 | #endif | ||
383 | {CONTEXT_CUSTOM,BUTTON_NONE,BUTTON_NONE} | ||
384 | }; | ||
385 | |||
338 | static struct button_mapping **plugin_context_order; | 386 | static struct button_mapping **plugin_context_order; |
339 | static int plugin_context_count = 0; | 387 | static int plugin_context_count = 0; |
340 | static int last_context = 0; /* index into plugin_context_order | 388 | static int last_context = 0; /* index into plugin_context_order |
diff --git a/apps/plugins/lib/pluginlib_actions.h b/apps/plugins/lib/pluginlib_actions.h index b0b9871de8..c11a087904 100644 --- a/apps/plugins/lib/pluginlib_actions.h +++ b/apps/plugins/lib/pluginlib_actions.h | |||
@@ -35,7 +35,12 @@ enum { | |||
35 | PLA_DOWN_REPEAT, | 35 | PLA_DOWN_REPEAT, |
36 | PLA_LEFT_REPEAT, | 36 | PLA_LEFT_REPEAT, |
37 | PLA_RIGHT_REPEAT, | 37 | PLA_RIGHT_REPEAT, |
38 | 38 | ||
39 | PLA_INC, | ||
40 | PLA_DEC, | ||
41 | PLA_INC_REPEAT, | ||
42 | PLA_DEC_REPEAT, | ||
43 | |||
39 | PLA_QUIT, | 44 | PLA_QUIT, |
40 | PLA_START, | 45 | PLA_START, |
41 | PLA_MENU, | 46 | PLA_MENU, |
@@ -51,6 +56,7 @@ extern const struct button_mapping remote_directions[]; | |||
51 | extern const struct button_mapping generic_directions[]; | 56 | extern const struct button_mapping generic_directions[]; |
52 | extern const struct button_mapping generic_left_right_fire[]; | 57 | extern const struct button_mapping generic_left_right_fire[]; |
53 | extern const struct button_mapping generic_actions[]; | 58 | extern const struct button_mapping generic_actions[]; |
59 | extern const struct button_mapping generic_increase_decrease[]; | ||
54 | 60 | ||
55 | int pluginlib_getaction(struct plugin_api *api,int timeout, | 61 | int pluginlib_getaction(struct plugin_api *api,int timeout, |
56 | const struct button_mapping *plugin_contexts[], | 62 | const struct button_mapping *plugin_contexts[], |
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index 4b345df460..402f4ac3fc 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c | |||
@@ -21,20 +21,10 @@ | |||
21 | 21 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | #define METRONOME_QUIT PLA_QUIT | 23 | #define METRONOME_QUIT PLA_QUIT |
24 | 24 | #define METRONOME_VOL_UP PLA_INC | |
25 | /* for volume changes, PLA with scrollwheel isn't proper */ | 25 | #define METRONOME_VOL_DOWN PLA_DEC |
26 | 26 | #define METRONOME_VOL_UP_REP PLA_INC_REPEAT | |
27 | #ifdef HAVE_SCROLLWHEEL | 27 | #define METRONOME_VOL_DOWN_REP PLA_DEC_REPEAT |
28 | #define METRONOME_VOL_UP PLA_DOWN | ||
29 | #define METRONOME_VOL_DOWN PLA_UP | ||
30 | #define METRONOME_VOL_UP_REP PLA_DOWN_REPEAT | ||
31 | #define METRONOME_VOL_DOWN_REP PLA_UP_REPEAT | ||
32 | #else | ||
33 | #define METRONOME_VOL_UP PLA_UP | ||
34 | #define METRONOME_VOL_DOWN PLA_DOWN | ||
35 | #define METRONOME_VOL_UP_REP PLA_UP_REPEAT | ||
36 | #define METRONOME_VOL_DOWN_REP PLA_DOWN_REPEAT | ||
37 | #endif | ||
38 | #define METRONOME_LEFT PLA_LEFT | 28 | #define METRONOME_LEFT PLA_LEFT |
39 | #define METRONOME_RIGHT PLA_RIGHT | 29 | #define METRONOME_RIGHT PLA_RIGHT |
40 | #define METRONOME_LEFT_REP PLA_LEFT_REPEAT | 30 | #define METRONOME_LEFT_REP PLA_LEFT_REPEAT |
@@ -77,6 +67,7 @@ static const struct button_mapping iriver_syncaction[] = | |||
77 | #endif /* #if CONFIG_KEYPAD == ONDIO_PAD */ | 67 | #endif /* #if CONFIG_KEYPAD == ONDIO_PAD */ |
78 | 68 | ||
79 | const struct button_mapping *plugin_contexts[]={ | 69 | const struct button_mapping *plugin_contexts[]={ |
70 | generic_increase_decrease, | ||
80 | generic_directions, | 71 | generic_directions, |
81 | #if CONFIG_KEYPAD == ONDIO_PAD | 72 | #if CONFIG_KEYPAD == ONDIO_PAD |
82 | ondio_action, | 73 | ondio_action, |
@@ -85,6 +76,7 @@ const struct button_mapping *plugin_contexts[]={ | |||
85 | #endif | 76 | #endif |
86 | generic_actions | 77 | generic_actions |
87 | }; | 78 | }; |
79 | #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | ||
88 | 80 | ||
89 | static struct plugin_api* rb; | 81 | static struct plugin_api* rb; |
90 | 82 | ||
@@ -308,13 +300,6 @@ void tap(void) | |||
308 | 300 | ||
309 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ | 301 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ |
310 | int button; | 302 | int button; |
311 | #if (CONFIG_KEYPAD == ONDIO_PAD) \ | ||
312 | || (CONFIG_KEYPAD == IRIVER_H100_PAD) \ | ||
313 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
314 | #define PLA_ARRAY_COUNT 3 | ||
315 | #else | ||
316 | #define PLA_ARRAY_COUNT 2 | ||
317 | #endif | ||
318 | enum plugin_status status; | 303 | enum plugin_status status; |
319 | 304 | ||
320 | (void)parameter; | 305 | (void)parameter; |