summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/apps/screens.c b/apps/screens.c
index 9a39b184c9..5b41cbf9f2 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -467,3 +467,63 @@ bool f3_screen(void)
467 return false; 467 return false;
468} 468}
469#endif 469#endif
470
471#ifdef HAVE_LCD_BITMAP
472#define SPACE 4 /* pixels between words */
473#else
474#define SPACE 1 /* one letter space */
475#undef LCD_WIDTH
476#define LCD_WIDTH 11
477#undef LCD_HEIGHT
478#define LCD_HEIGHT 2
479#endif
480
481void splash(char *text, /* what to say */
482 int ticks, /* fow how long */
483 int keymask) /* what keymask aborts the waiting (if any) */
484{
485 char *next;
486 char *store=NULL;
487 int x=0;
488 int y=0;
489 int w, h;
490 lcd_clear_display();
491
492 next = strtok_r(text, " ", &store);
493 while (next) {
494#ifdef HAVE_LCD_BITMAP
495 lcd_getstringsize(next, &w, &h);
496#else
497 w = strlen(next);
498 h = 1;
499#endif
500 if(x) {
501 if(x+w> LCD_WIDTH) {
502 /* too wide */
503 y+=h;
504 if(y > (LCD_HEIGHT-h))
505 /* STOP */
506 break;
507 x=0;
508 }
509 }
510#ifdef HAVE_LCD_BITMAP
511 lcd_putsxy(x, y, next);
512 lcd_update(); /* DURING DEBUG ONLY */
513#else
514 lcd_puts(x, y, next);
515#endif
516 x += w+SPACE; /* pixels space! */
517 next = strtok_r(NULL, " ", &store);
518 }
519 lcd_update();
520
521 if(ticks) {
522 int done = ticks + current_tick + 1;
523 while (TIME_BEFORE( current_tick, done)) {
524 int button = button_get_w_tmo(ticks);
525 if((button & keymask) == keymask)
526 break;
527 }
528 }
529}