summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-player.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-player.c')
-rw-r--r--firmware/drivers/lcd-player.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c
index 0ca551c63a..a03b1b024c 100644
--- a/firmware/drivers/lcd-player.c
+++ b/firmware/drivers/lcd-player.c
@@ -72,6 +72,17 @@ struct scrollinfo {
72 int direction; /* +1 for right or -1 for left*/ 72 int direction; /* +1 for right or -1 for left*/
73}; 73};
74 74
75#define MAX_CURSOR_CHARS 8
76struct cursorinfo {
77 int len;
78 char text[MAX_CURSOR_CHARS];
79 int textpos;
80 int y_pos;
81 int x_pos;
82 int divider;
83 int downcount;
84} cursor;
85
75static void scroll_thread(void); 86static void scroll_thread(void);
76static char scroll_stack[DEFAULT_STACK_SIZE]; 87static char scroll_stack[DEFAULT_STACK_SIZE];
77static char scroll_name[] = "scroll"; 88static char scroll_name[] = "scroll";
@@ -265,6 +276,7 @@ void lcd_clear_display(void)
265 bool update=false; 276 bool update=false;
266 DEBUGF("lcd_clear_display()\n"); 277 DEBUGF("lcd_clear_display()\n");
267 lcd_stop_scroll(); 278 lcd_stop_scroll();
279 cursor.len=0; /* Stop cursor */
268 for (i=0;i<22;i++) 280 for (i=0;i<22;i++)
269 update|=lcdx_putc(i%11, i/11, ' '); 281 update|=lcdx_putc(i%11, i/11, ' ');
270 if (update) 282 if (update)
@@ -301,6 +313,18 @@ void lcd_puts(int x, int y, unsigned char *string)
301 return lcd_puts_cont_scroll(x, y, string); 313 return lcd_puts_cont_scroll(x, y, string);
302} 314}
303 315
316void lcd_put_cursor(int x, int y, char cursor_char)
317{
318 cursor.text[0]=buffer_xlcd[x][y];
319 cursor.text[1]=cursor_char;
320 cursor.len=2;
321 cursor.textpos=0;
322 cursor.y_pos=y;
323 cursor.x_pos=x;
324 cursor.downcount=0;
325 cursor.divider=4;
326}
327
304void lcd_putc(int x, int y, unsigned short ch) 328void lcd_putc(int x, int y, unsigned short ch)
305{ 329{
306 bool update; 330 bool update;
@@ -573,7 +597,16 @@ static void scroll_thread(void)
573 lcd_puts_cont_scroll(s->startx, s->starty, buffer); 597 lcd_puts_cont_scroll(s->startx, s->starty, buffer);
574 } 598 }
575 } 599 }
576 600 if (cursor.len>0) {
601 if (cursor.downcount--<0) {
602 cursor.downcount=cursor.divider;
603 cursor.textpos++;
604 if (cursor.textpos>=cursor.len)
605 cursor.textpos=0;
606 update|=lcdx_putc(cursor.x_pos, cursor.y_pos,
607 cursor.text[cursor.textpos]);
608 }
609 }
577 if (update) { 610 if (update) {
578 lcd_update(); 611 lcd_update();
579 } 612 }