diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 27 | ||||
-rw-r--r-- | firmware/export/lcd.h | 6 |
2 files changed, 30 insertions, 3 deletions
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 6665ea88dc..fcb7d306b8 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -81,6 +81,7 @@ struct scrollinfo { | |||
81 | int starty; | 81 | int starty; |
82 | bool backward; /* scroll presently forward or backward? */ | 82 | bool backward; /* scroll presently forward or backward? */ |
83 | bool bidir; | 83 | bool bidir; |
84 | bool invert; /* invert the scrolled text */ | ||
84 | long start_tick; | 85 | long start_tick; |
85 | }; | 86 | }; |
86 | 87 | ||
@@ -270,6 +271,11 @@ int lcd_getstringsize(unsigned char *str, int *w, int *h) | |||
270 | /* put a string at a given char position */ | 271 | /* put a string at a given char position */ |
271 | void lcd_puts(int x, int y, unsigned char *str) | 272 | void lcd_puts(int x, int y, unsigned char *str) |
272 | { | 273 | { |
274 | lcd_puts_style(x, y, str, STYLE_DEFAULT); | ||
275 | } | ||
276 | |||
277 | void lcd_puts_style(int x, int y, unsigned char *str, int style) | ||
278 | { | ||
273 | int xpos,ypos,w,h; | 279 | int xpos,ypos,w,h; |
274 | 280 | ||
275 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) | 281 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) |
@@ -294,6 +300,8 @@ void lcd_puts(int x, int y, unsigned char *str) | |||
294 | ypos = ymargin + y*h; | 300 | ypos = ymargin + y*h; |
295 | lcd_putsxy(xpos, ypos, str); | 301 | lcd_putsxy(xpos, ypos, str); |
296 | lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 302 | lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
303 | if (style & STYLE_INVERT) | ||
304 | lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, h); | ||
297 | 305 | ||
298 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) | 306 | #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) |
299 | lcd_update(); | 307 | lcd_update(); |
@@ -670,14 +678,19 @@ void lcd_invertpixel(int x, int y) | |||
670 | INVERT_PIXEL(x,y); | 678 | INVERT_PIXEL(x,y); |
671 | } | 679 | } |
672 | 680 | ||
673 | void lcd_puts_scroll(int x, int y, unsigned char* string) | 681 | void lcd_puts_scroll(int x, int y, unsigned char *string) |
682 | { | ||
683 | lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT); | ||
684 | } | ||
685 | |||
686 | void lcd_puts_scroll_style(int x, int y, unsigned char *string, int style) | ||
674 | { | 687 | { |
675 | struct scrollinfo* s; | 688 | struct scrollinfo* s; |
676 | int w, h; | 689 | int w, h; |
677 | int index; | 690 | int index; |
678 | int free_index=0; | 691 | int free_index=0; |
679 | 692 | ||
680 | DEBUGF("puts_scroll: %s\n", string); | 693 | DEBUGF("puts_scroll_style: %s\n", string); |
681 | 694 | ||
682 | for (index = 0; index < SCROLLABLE_LINES; index++) { | 695 | for (index = 0; index < SCROLLABLE_LINES; index++) { |
683 | s = &scroll[index]; | 696 | s = &scroll[index]; |
@@ -698,8 +711,14 @@ void lcd_puts_scroll(int x, int y, unsigned char* string) | |||
698 | index=free_index; | 711 | index=free_index; |
699 | s = &scroll[index]; /* get the proper 's' */ | 712 | s = &scroll[index]; /* get the proper 's' */ |
700 | s->start_tick = current_tick + scroll_delay; | 713 | s->start_tick = current_tick + scroll_delay; |
714 | s->invert = false; | ||
715 | if (style & STYLE_INVERT) { | ||
716 | s->invert = true; | ||
717 | lcd_puts_style(x,y,string,STYLE_INVERT); | ||
718 | } | ||
719 | else | ||
720 | lcd_puts(x,y,string); | ||
701 | 721 | ||
702 | lcd_puts(x,y,string); | ||
703 | lcd_getstringsize(string, &w, &h); | 722 | lcd_getstringsize(string, &w, &h); |
704 | 723 | ||
705 | if (LCD_WIDTH - x * 8 - xmargin < w) { | 724 | if (LCD_WIDTH - x * 8 - xmargin < w) { |
@@ -819,6 +838,8 @@ static void scroll_thread(void) | |||
819 | 838 | ||
820 | lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); | 839 | lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); |
821 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); | 840 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
841 | if (s->invert) | ||
842 | lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); | ||
822 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); | 843 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); |
823 | } | 844 | } |
824 | 845 | ||
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 74bbcc304e..45d9296555 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -24,14 +24,20 @@ | |||
24 | #include "sh7034.h" | 24 | #include "sh7034.h" |
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | #define STYLE_DEFAULT 0 | ||
28 | #define STYLE_INVERT 1 | ||
29 | |||
27 | /* common functions */ | 30 | /* common functions */ |
28 | extern void lcd_init(void); | 31 | extern void lcd_init(void); |
29 | extern void lcd_clear_display(void); | 32 | extern void lcd_clear_display(void); |
30 | extern void lcd_backlight(bool on); | 33 | extern void lcd_backlight(bool on); |
31 | extern void lcd_puts(int x, int y, unsigned char *string); | 34 | extern void lcd_puts(int x, int y, unsigned char *string); |
35 | extern void lcd_puts_style(int x, int y, unsigned char *string, int style); | ||
32 | extern void lcd_putc(int x, int y, unsigned short ch); | 36 | extern void lcd_putc(int x, int y, unsigned short ch); |
33 | 37 | ||
34 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); | 38 | extern void lcd_puts_scroll(int x, int y, unsigned char* string ); |
39 | extern void lcd_puts_scroll_style(int x, int y, unsigned char* string, | ||
40 | int style); | ||
35 | extern void lcd_icon(int icon, bool enable); | 41 | extern void lcd_icon(int icon, bool enable); |
36 | extern void lcd_stop_scroll(void); | 42 | extern void lcd_stop_scroll(void); |
37 | extern void lcd_scroll_speed( int speed ); | 43 | extern void lcd_scroll_speed( int speed ); |