From 3a5bd7acb677a37d8662f7ce0c9a392d0d75da18 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 7 Jul 2005 21:03:58 +0000 Subject: 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 --- apps/main.c | 9 +++++---- firmware/drivers/lcd-h100-remote.c | 36 ++++++++++++++++++++++-------------- firmware/drivers/lcd-recorder.c | 18 +++++++++--------- 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<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); } -- cgit v1.2.3