summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-07-07 21:03:58 +0000
committerJens Arnold <amiconn@rockbox.org>2005-07-07 21:03:58 +0000
commit3a5bd7acb677a37d8662f7ce0c9a392d0d75da18 (patch)
tree4d288fdbeb130dce3af39e03444386fcea3b7e45
parent81b32e093178d9de3b63e8ea571e5df6a65497ff (diff)
downloadrockbox-3a5bd7acb677a37d8662f7ce0c9a392d0d75da18.tar.gz
rockbox-3a5bd7acb677a37d8662f7ce0c9a392d0d75da18.zip
Enabled scrolling on the remote LCD in the simulator. Some small shortcuts in the H1x0 remote LCD driver and the recorder LCD driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7057 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/main.c9
-rw-r--r--firmware/drivers/lcd-h100-remote.c36
-rw-r--r--firmware/drivers/lcd-recorder.c18
3 files changed, 36 insertions, 27 deletions
diff --git a/apps/main.c b/apps/main.c
index 9b9ab0eb12..fec69b073a 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -98,6 +98,9 @@ void init(void)
98 init_threads(); 98 init_threads();
99 buffer_init(); 99 buffer_init();
100 lcd_init(); 100 lcd_init();
101#ifdef HAVE_REMOTE_LCD
102 lcd_remote_init();
103#endif
101 font_init(); 104 font_init();
102 show_logo(); 105 show_logo();
103 lang_init(); 106 lang_init();
@@ -148,11 +151,9 @@ void init(void)
148 settings_reset(); 151 settings_reset();
149 152
150 lcd_init(); 153 lcd_init();
151 154#ifdef HAVE_REMOTE_LCD
152#ifdef HAVE_REMOTE_LCD
153 lcd_remote_init(); 155 lcd_remote_init();
154#endif 156#endif
155
156 font_init(); 157 font_init();
157 show_logo(); 158 show_logo();
158 lang_init(); 159 lang_init();
@@ -291,7 +292,7 @@ void init(void)
291 talk_init(); 292 talk_init();
292 /* runtime database has to be initialized after audio_init() */ 293 /* runtime database has to be initialized after audio_init() */
293 rundb_init(); 294 rundb_init();
294 295
295 296
296#ifdef AUTOROCK 297#ifdef AUTOROCK
297 { 298 {
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 */
92static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */ 92static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */
93#ifndef SIMULATOR
94static void scroll_thread(void); 93static void scroll_thread(void);
95static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)]; 94static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)];
96#endif
97static const char scroll_name[] = "remote_scroll"; 95static const char scroll_name[] = "remote_scroll";
98static char scroll_ticks = 12; /* # of ticks between updates*/ 96static char scroll_ticks = 12; /* # of ticks between updates*/
99static int scroll_delay = HZ/2; /* ticks delay before start */ 97static 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
362void 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 */
361void lcd_remote_init(void) 370void lcd_remote_init(void)
@@ -997,7 +1006,7 @@ void lcd_remote_puts(int x, int y, const unsigned char *str)
997void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style) 1006void 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
1124static void scroll_thread(void) 1132static 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)
885void lcd_puts_style(int x, int y, const unsigned char *str, int style) 885void 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