summaryrefslogtreecommitdiffstats
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)
init_threads();
buffer_init();
lcd_init();
+#ifdef HAVE_REMOTE_LCD
+ lcd_remote_init();
+#endif
font_init();
show_logo();
lang_init();
@@ -148,11 +151,9 @@ void init(void)
settings_reset();
lcd_init();
-
-#ifdef HAVE_REMOTE_LCD
+#ifdef HAVE_REMOTE_LCD
lcd_remote_init();
#endif
-
font_init();
show_logo();
lang_init();
@@ -291,7 +292,7 @@ void init(void)
talk_init();
/* runtime database has to be initialized after audio_init() */
rundb_init();
-
+
#ifdef AUTOROCK
{
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;
/* scrolling */
static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */
-#ifndef SIMULATOR
static void scroll_thread(void);
static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)];
-#endif
static const char scroll_name[] = "remote_scroll";
static char scroll_ticks = 12; /* # of ticks between updates*/
static int scroll_delay = HZ/2; /* ticks delay before start */
@@ -355,7 +353,18 @@ static void remote_tick(void)
}
}
}
+}
+#endif /* !SIMULATOR */
+
+/* LCD init */
+#ifdef SIMULATOR
+
+void lcd_remote_init(void)
+{
+ create_thread(scroll_thread, scroll_stack,
+ sizeof(scroll_stack), scroll_name);
}
+#else /* !SIMULATOR */
/* Initialise ports and kick off monitor */
void lcd_remote_init(void)
@@ -997,7 +1006,7 @@ void lcd_remote_puts(int x, int y, const unsigned char *str)
void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
{
int xpos,ypos,w,h;
- int lastmode = lcd_remote_get_drawmode();
+ int lastmode = drawmode;
/* make sure scrolling is turned off on the line we are updating */
scrolling_lines &= ~(1 << y);
@@ -1009,14 +1018,14 @@ void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
xpos = xmargin + x*w / strlen(str);
ypos = ymargin + y*h;
lcd_remote_putsxy(xpos, ypos, str);
- lcd_remote_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h);
if (style & STYLE_INVERT)
{
- lcd_remote_set_drawmode(DRMODE_COMPLEMENT);
+ drawmode = DRMODE_COMPLEMENT;
lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, h);
}
- lcd_remote_set_drawmode(lastmode);
+ drawmode = lastmode;
}
/*** scrolling ***/
@@ -1120,7 +1129,6 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int
scrolling_lines &= ~(1<<y);
}
-#ifndef SIMULATOR
static void scroll_thread(void)
{
struct font* pf;
@@ -1134,13 +1142,14 @@ static void scroll_thread(void)
while ( 1 ) {
+#ifndef SIMULATOR
if (init_remote) /* request to initialize the remote lcd */
{
init_remote = false; /* clear request */
remote_lcd_init();
lcd_remote_update();
}
-
+#endif
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
/* really scroll? */
if ( !(scrolling_lines&(1<<index)) )
@@ -1181,22 +1190,21 @@ static void scroll_thread(void)
s->offset %= s->width;
}
- lastmode = lcd_remote_get_drawmode();
- lcd_remote_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ lastmode = drawmode;
+ drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
- lcd_remote_set_drawmode(DRMODE_SOLID);
+ drawmode = DRMODE_SOLID;
lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line);
if (s->invert)
{
- lcd_remote_set_drawmode(DRMODE_COMPLEMENT);
+ drawmode = DRMODE_COMPLEMENT;
lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
}
- lcd_remote_set_drawmode(lastmode);
+ drawmode = lastmode;
lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
}
sleep(scroll_ticks);
}
}
-#endif /* SIMULATOR */
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)
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
{
int xpos,ypos,w,h;
- int lastmode = lcd_get_drawmode();
+ int lastmode = drawmode;
/* make sure scrolling is turned off on the line we are updating */
scrolling_lines &= ~(1 << y);
@@ -897,14 +897,14 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style)
xpos = xmargin + x*w / strlen(str);
ypos = ymargin + y*h;
lcd_putsxy(xpos, ypos, str);
- lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h);
if (style & STYLE_INVERT)
{
- lcd_set_drawmode(DRMODE_COMPLEMENT);
+ drawmode = DRMODE_COMPLEMENT;
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h);
}
- lcd_set_drawmode(lastmode);
+ drawmode = lastmode;
}
/* put a string at a given char position */
@@ -1066,17 +1066,17 @@ static void scroll_thread(void)
s->offset %= s->width;
}
- lastmode = lcd_get_drawmode();
- lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ lastmode = drawmode;
+ drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
- lcd_set_drawmode(DRMODE_SOLID);
+ drawmode = DRMODE_SOLID;
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
if (s->invert)
{
- lcd_set_drawmode(DRMODE_COMPLEMENT);
+ drawmode = DRMODE_COMPLEMENT;
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
}
- lcd_set_drawmode(lastmode);
+ drawmode = lastmode;
lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
}