summaryrefslogtreecommitdiff
path: root/apps/plugins/bounce.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/bounce.c')
-rw-r--r--apps/plugins/bounce.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index d4244745bc..9cf1ccf341 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -30,6 +30,17 @@
30#define XSPEED 3 30#define XSPEED 3
31#define YADD -4 31#define YADD -4
32 32
33/* variable button definitions */
34#if CONFIG_KEYPAD == RECORDER_PAD
35#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
36#define BOUNCE_MODE (BUTTON_ON | BUTTON_REL)
37
38#elif CONFIG_KEYPAD == ONDIO_PAD
39#define BOUNCE_QUIT (BUTTON_OFF | BUTTON_REL)
40#define BOUNCE_MODE (BUTTON_MENU | BUTTON_REL)
41
42#endif
43
33static struct plugin_api* rb; 44static struct plugin_api* rb;
34 45
35static unsigned char table[]={ 46static unsigned char table[]={
@@ -172,6 +183,7 @@ struct counter values[]={
172 {"ydistt", -6}, 183 {"ydistt", -6},
173}; 184};
174 185
186#ifdef HAVE_RTC
175static unsigned char yminute[]={ 187static unsigned char yminute[]={
17653,53,52,52,51,50,49,47,46,44,42,40,38,36,34,32,29,27,25,23,21,19,17,16,14,13,12,11,11,10,10,10,11,11,12,13,14,16,17,19,21,23,25,27,29,31,34,36,38,40,42,44,46,47,49,50,51,52,52,53, 18853,53,52,52,51,50,49,47,46,44,42,40,38,36,34,32,29,27,25,23,21,19,17,16,14,13,12,11,11,10,10,10,11,11,12,13,14,16,17,19,21,23,25,27,29,31,34,36,38,40,42,44,46,47,49,50,51,52,52,53,
177}; 189};
@@ -218,6 +230,7 @@ static void addclock(void)
218 yminute[(i+1)%60]); 230 yminute[(i+1)%60]);
219 } 231 }
220} 232}
233#endif /* HAVE_RTC */
221 234
222static int scrollit(void) 235static int scrollit(void)
223{ 236{
@@ -236,10 +249,10 @@ static int scrollit(void)
236 while(1) 249 while(1)
237 { 250 {
238 b = rb->button_get_w_tmo(HZ/10); 251 b = rb->button_get_w_tmo(HZ/10);
239 if ( b == (BUTTON_OFF|BUTTON_REL) ) 252 if ( b == BOUNCE_QUIT )
240 return 0; 253 return 0;
241 254
242 if ( b == (BUTTON_ON|BUTTON_REL) ) 255 if ( b == BOUNCE_MODE )
243 return 1; 256 return 1;
244 257
245 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) 258 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
@@ -256,7 +269,9 @@ static int scrollit(void)
256 yy += YADD; 269 yy += YADD;
257 xx+= LCD_WIDTH/LETTERS_ON_SCREEN; 270 xx+= LCD_WIDTH/LETTERS_ON_SCREEN;
258 } 271 }
272#ifdef HAVE_RTC
259 addclock(); 273 addclock();
274#endif
260 rb->lcd_update(); 275 rb->lcd_update();
261 276
262 x-= XSPEED; 277 x-= XSPEED;
@@ -293,10 +308,10 @@ static int loopit(void)
293 while(1) 308 while(1)
294 { 309 {
295 b = rb->button_get_w_tmo(HZ/10); 310 b = rb->button_get_w_tmo(HZ/10);
296 if ( b == (BUTTON_OFF|BUTTON_REL) ) 311 if ( b == BOUNCE_QUIT )
297 return 0; 312 return 0;
298 313
299 if ( b == (BUTTON_ON|BUTTON_REL) ) 314 if ( b == BOUNCE_MODE )
300 return 1; 315 return 1;
301 316
302 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED ) 317 if ( rb->default_event_handler(b) == SYS_USB_CONNECTED )
@@ -309,7 +324,9 @@ static int loopit(void)
309 x+= speed[xsanke&15] + values[NUM_XADD].num; 324 x+= speed[xsanke&15] + values[NUM_XADD].num;
310 325
311 rb->lcd_clear_display(); 326 rb->lcd_clear_display();
327#ifdef HAVE_RTC
312 addclock(); 328 addclock();
329#endif
313 if(timeout) { 330 if(timeout) {
314 switch(b) { 331 switch(b) {
315 case BUTTON_LEFT: 332 case BUTTON_LEFT:
@@ -402,7 +419,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
402 419
403 rb->lcd_setfont(FONT_UI); 420 rb->lcd_setfont(FONT_UI);
404 421
405 return h = 0 ? PLUGIN_OK : PLUGIN_USB_CONNECTED; 422 return (h == 0) ? PLUGIN_OK : PLUGIN_USB_CONNECTED;
406} 423}
407 424
408#endif 425#endif