diff options
Diffstat (limited to 'firmware/drivers/lcd-h100-remote.c')
-rw-r--r-- | firmware/drivers/lcd-h100-remote.c | 36 |
1 files changed, 22 insertions, 14 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 | ||