forked from len0rd/rockbox
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
This commit is contained in:
parent
81b32e0931
commit
3a5bd7acb6
3 changed files with 36 additions and 27 deletions
|
|
@ -98,6 +98,9 @@ void init(void)
|
||||||
init_threads();
|
init_threads();
|
||||||
buffer_init();
|
buffer_init();
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
lcd_remote_init();
|
||||||
|
#endif
|
||||||
font_init();
|
font_init();
|
||||||
show_logo();
|
show_logo();
|
||||||
lang_init();
|
lang_init();
|
||||||
|
|
@ -148,11 +151,9 @@ void init(void)
|
||||||
settings_reset();
|
settings_reset();
|
||||||
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
lcd_remote_init();
|
lcd_remote_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
font_init();
|
font_init();
|
||||||
show_logo();
|
show_logo();
|
||||||
lang_init();
|
lang_init();
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,8 @@ static int cached_roll = 0;
|
||||||
|
|
||||||
/* scrolling */
|
/* scrolling */
|
||||||
static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */
|
static volatile int scrolling_lines=0; /* Bitpattern of which lines are scrolling */
|
||||||
#ifndef SIMULATOR
|
|
||||||
static void scroll_thread(void);
|
static void scroll_thread(void);
|
||||||
static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
static long scroll_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
||||||
#endif
|
|
||||||
static const char scroll_name[] = "remote_scroll";
|
static const char scroll_name[] = "remote_scroll";
|
||||||
static char scroll_ticks = 12; /* # of ticks between updates*/
|
static char scroll_ticks = 12; /* # of ticks between updates*/
|
||||||
static int scroll_delay = HZ/2; /* ticks delay before start */
|
static int scroll_delay = HZ/2; /* ticks delay before start */
|
||||||
|
|
@ -356,6 +354,17 @@ 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 */
|
/* Initialise ports and kick off monitor */
|
||||||
void lcd_remote_init(void)
|
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)
|
void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
|
||||||
{
|
{
|
||||||
int xpos,ypos,w,h;
|
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 */
|
/* make sure scrolling is turned off on the line we are updating */
|
||||||
scrolling_lines &= ~(1 << y);
|
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);
|
xpos = xmargin + x*w / strlen(str);
|
||||||
ypos = ymargin + y*h;
|
ypos = ymargin + y*h;
|
||||||
lcd_remote_putsxy(xpos, ypos, str);
|
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);
|
lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h);
|
||||||
if (style & STYLE_INVERT)
|
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_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, h);
|
||||||
}
|
}
|
||||||
lcd_remote_set_drawmode(lastmode);
|
drawmode = lastmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** scrolling ***/
|
/*** scrolling ***/
|
||||||
|
|
@ -1120,7 +1129,6 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int
|
||||||
scrolling_lines &= ~(1<<y);
|
scrolling_lines &= ~(1<<y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
static void scroll_thread(void)
|
static void scroll_thread(void)
|
||||||
{
|
{
|
||||||
struct font* pf;
|
struct font* pf;
|
||||||
|
|
@ -1134,13 +1142,14 @@ static void scroll_thread(void)
|
||||||
|
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
if (init_remote) /* request to initialize the remote lcd */
|
if (init_remote) /* request to initialize the remote lcd */
|
||||||
{
|
{
|
||||||
init_remote = false; /* clear request */
|
init_remote = false; /* clear request */
|
||||||
remote_lcd_init();
|
remote_lcd_init();
|
||||||
lcd_remote_update();
|
lcd_remote_update();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
|
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
|
||||||
/* really scroll? */
|
/* really scroll? */
|
||||||
if ( !(scrolling_lines&(1<<index)) )
|
if ( !(scrolling_lines&(1<<index)) )
|
||||||
|
|
@ -1181,22 +1190,21 @@ static void scroll_thread(void)
|
||||||
s->offset %= s->width;
|
s->offset %= s->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastmode = lcd_remote_get_drawmode();
|
lastmode = drawmode;
|
||||||
lcd_remote_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||||
lcd_remote_fillrect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
|
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);
|
lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line);
|
||||||
if (s->invert)
|
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_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);
|
lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(scroll_ticks);
|
sleep(scroll_ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SIMULATOR */
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
|
||||||
{
|
{
|
||||||
int xpos,ypos,w,h;
|
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 */
|
/* make sure scrolling is turned off on the line we are updating */
|
||||||
scrolling_lines &= ~(1 << y);
|
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);
|
xpos = xmargin + x*w / strlen(str);
|
||||||
ypos = ymargin + y*h;
|
ypos = ymargin + y*h;
|
||||||
lcd_putsxy(xpos, ypos, str);
|
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);
|
lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h);
|
||||||
if (style & STYLE_INVERT)
|
if (style & STYLE_INVERT)
|
||||||
{
|
{
|
||||||
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
drawmode = DRMODE_COMPLEMENT;
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h);
|
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h);
|
||||||
}
|
}
|
||||||
lcd_set_drawmode(lastmode);
|
drawmode = lastmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put a string at a given char position */
|
/* put a string at a given char position */
|
||||||
|
|
@ -1066,17 +1066,17 @@ static void scroll_thread(void)
|
||||||
s->offset %= s->width;
|
s->offset %= s->width;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastmode = lcd_get_drawmode();
|
lastmode = drawmode;
|
||||||
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
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);
|
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
|
||||||
if (s->invert)
|
if (s->invert)
|
||||||
{
|
{
|
||||||
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
drawmode = DRMODE_COMPLEMENT;
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
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);
|
lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue