diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 36 | ||||
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 18 |
2 files changed, 31 insertions, 23 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index b68890a1e9..c78382d9e3 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c | |||
@@ -90,10 +90,8 @@ static int cached_roll = 0; | |||
90 | 90 | ||
91 | /* scrolling */ | 91 | /* scrolling */ |
92 | static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */ | 92 | static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */ |
93 | #ifndef SIMULATOR | ||
94 | static void scroll_thread(void); | 93 | static void scroll_thread(void); |
95 | static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)]; | 94 | static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)]; |
96 | #endif | ||
97 | static const char scroll_name[] = "remote_scroll"; | 95 | static const char scroll_name[] = "remote_scroll"; |
98 | static char scroll_ticks = 12; /* # of ticks between updates*/ | 96 | static char scroll_ticks = 12; /* # of ticks between updates*/ |
99 | static int scroll_delay = HZ/2; /* ticks delay before start */ | 97 | static int scroll_delay = HZ/2; /* ticks delay before start */ |
@@ -355,7 +353,18 @@ static void remote_tick(void) | |||
355 | } | 353 | } |
356 | } | 354 | } |
357 | } | 355 | } |
356 | } | ||
357 | #endif /* !SIMULATOR */ | ||
358 | |||
359 | /* LCD init */ | ||
360 | #ifdef SIMULATOR | ||
361 | |||
362 | void lcd_remote_init(void) | ||
363 | { | ||
364 | create_thread(scroll_thread, scroll_stack, | ||
365 | sizeof(scroll_stack), scroll_name); | ||
358 | } | 366 | } |
367 | #else /* !SIMULATOR */ | ||
359 | 368 | ||
360 | /* Initialise ports and kick off monitor */ | 369 | /* Initialise ports and kick off monitor */ |
361 | void lcd_remote_init(void) | 370 | void lcd_remote_init(void) |
@@ -997,7 +1006,7 @@ void lcd_remote_puts(int x, int y, const unsigned char *str) | |||
997 | void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) | 1006 | void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) |
998 | { | 1007 | { |
999 | int xpos,ypos,w,h; | 1008 | int xpos,ypos,w,h; |
1000 | int lastmode = lcd_remote_get_drawmode(); | 1009 | int lastmode = drawmode; |
1001 | 1010 | ||
1002 | /* make sure scrolling is turned off on the line we are updating */ | 1011 | /* make sure scrolling is turned off on the line we are updating */ |
1003 | scrolling_lines &= ~(1 << y); | 1012 | scrolling_lines &= ~(1 << y); |
@@ -1009,14 +1018,14 @@ void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) | |||
1009 | xpos = xmargin + x*w / strlen(str); | 1018 | xpos = xmargin + x*w / strlen(str); |
1010 | ypos = ymargin + y*h; | 1019 | ypos = ymargin + y*h; |
1011 | lcd_remote_putsxy(xpos, ypos, str); | 1020 | lcd_remote_putsxy(xpos, ypos, str); |
1012 | lcd_remote_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1021 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
1013 | lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h); | 1022 | lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h); |
1014 | if (style & STYLE_INVERT) | 1023 | if (style & STYLE_INVERT) |
1015 | { | 1024 | { |
1016 | lcd_remote_set_drawmode(DRMODE_COMPLEMENT); | 1025 | drawmode = DRMODE_COMPLEMENT; |
1017 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, h); | 1026 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, h); |
1018 | } | 1027 | } |
1019 | lcd_remote_set_drawmode(lastmode); | 1028 | drawmode = lastmode; |
1020 | } | 1029 | } |
1021 | 1030 | ||
1022 | /*** scrolling ***/ | 1031 | /*** scrolling ***/ |
@@ -1120,7 +1129,6 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int | |||
1120 | scrolling_lines &= ~(1<<y); | 1129 | scrolling_lines &= ~(1<<y); |
1121 | } | 1130 | } |
1122 | 1131 | ||
1123 | #ifndef SIMULATOR | ||
1124 | static void scroll_thread(void) | 1132 | static void scroll_thread(void) |
1125 | { | 1133 | { |
1126 | struct font* pf; | 1134 | struct font* pf; |
@@ -1134,13 +1142,14 @@ static void scroll_thread(void) | |||
1134 | 1142 | ||
1135 | while ( 1 ) { | 1143 | while ( 1 ) { |
1136 | 1144 | ||
1145 | #ifndef SIMULATOR | ||
1137 | if (init_remote) /* request to initialize the remote lcd */ | 1146 | if (init_remote) /* request to initialize the remote lcd */ |
1138 | { | 1147 | { |
1139 | init_remote = false; /* clear request */ | 1148 | init_remote = false; /* clear request */ |
1140 | remote_lcd_init(); | 1149 | remote_lcd_init(); |
1141 | lcd_remote_update(); | 1150 | lcd_remote_update(); |
1142 | } | 1151 | } |
1143 | 1152 | #endif | |
1144 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { | 1153 | for ( index = 0; index < SCROLLABLE_LINES; index++ ) { |
1145 | /* really scroll? */ | 1154 | /* really scroll? */ |
1146 | if ( !(scrolling_lines&(1<<index)) ) | 1155 | if ( !(scrolling_lines&(1<<index)) ) |
@@ -1181,22 +1190,21 @@ static void scroll_thread(void) | |||
1181 | s->offset %= s->width; | 1190 | s->offset %= s->width; |
1182 | } | 1191 | } |
1183 | 1192 | ||
1184 | lastmode = lcd_remote_get_drawmode(); | 1193 | lastmode = drawmode; |
1185 | lcd_remote_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1194 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
1186 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); | 1195 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); |
1187 | lcd_remote_set_drawmode(DRMODE_SOLID); | 1196 | drawmode = DRMODE_SOLID; |
1188 | lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line); | 1197 | lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line); |
1189 | if (s->invert) | 1198 | if (s->invert) |
1190 | { | 1199 | { |
1191 | lcd_remote_set_drawmode(DRMODE_COMPLEMENT); | 1200 | drawmode = DRMODE_COMPLEMENT; |
1192 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); | 1201 | lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); |
1193 | } | 1202 | } |
1194 | lcd_remote_set_drawmode(lastmode); | 1203 | drawmode = lastmode; |
1195 | lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); | 1204 | lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); |
1196 | } | 1205 | } |
1197 | 1206 | ||
1198 | sleep(scroll_ticks); | 1207 | sleep(scroll_ticks); |
1199 | } | 1208 | } |
1200 | } | 1209 | } |
1201 | #endif /* SIMULATOR */ | ||
1202 | 1210 | ||
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 37a15961d5..b3696d7db5 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c | |||
@@ -885,7 +885,7 @@ void lcd_putsxy(int x, int y, const unsigned char *str) | |||
885 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) | 885 | void lcd_puts_style(int x, int y, const unsigned char *str, int style) |
886 | { | 886 | { |
887 | int xpos,ypos,w,h; | 887 | int xpos,ypos,w,h; |
888 | int lastmode = lcd_get_drawmode(); | 888 | int lastmode = drawmode; |
889 | 889 | ||
890 | /* make sure scrolling is turned off on the line we are updating */ | 890 | /* make sure scrolling is turned off on the line we are updating */ |
891 | scrolling_lines &= ~(1 << y); | 891 | scrolling_lines &= ~(1 << y); |
@@ -897,14 +897,14 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) | |||
897 | xpos = xmargin + x*w / strlen(str); | 897 | xpos = xmargin + x*w / strlen(str); |
898 | ypos = ymargin + y*h; | 898 | ypos = ymargin + y*h; |
899 | lcd_putsxy(xpos, ypos, str); | 899 | lcd_putsxy(xpos, ypos, str); |
900 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 900 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
901 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); | 901 | lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); |
902 | if (style & STYLE_INVERT) | 902 | if (style & STYLE_INVERT) |
903 | { | 903 | { |
904 | lcd_set_drawmode(DRMODE_COMPLEMENT); | 904 | drawmode = DRMODE_COMPLEMENT; |
905 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); | 905 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); |
906 | } | 906 | } |
907 | lcd_set_drawmode(lastmode); | 907 | drawmode = lastmode; |
908 | } | 908 | } |
909 | 909 | ||
910 | /* put a string at a given char position */ | 910 | /* put a string at a given char position */ |
@@ -1066,17 +1066,17 @@ static void scroll_thread(void) | |||
1066 | s->offset %= s->width; | 1066 | s->offset %= s->width; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | lastmode = lcd_get_drawmode(); | 1069 | lastmode = drawmode; |
1070 | lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1070 | drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); |
1071 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1071 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1072 | lcd_set_drawmode(DRMODE_SOLID); | 1072 | drawmode = DRMODE_SOLID; |
1073 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); | 1073 | lcd_putsxyofs(xpos, ypos, s->offset, s->line); |
1074 | if (s->invert) | 1074 | if (s->invert) |
1075 | { | 1075 | { |
1076 | lcd_set_drawmode(DRMODE_COMPLEMENT); | 1076 | drawmode = DRMODE_COMPLEMENT; |
1077 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1077 | lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1078 | } | 1078 | } |
1079 | lcd_set_drawmode(lastmode); | 1079 | drawmode = lastmode; |
1080 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); | 1080 | lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); |
1081 | } | 1081 | } |
1082 | 1082 | ||