1
0
Fork 0
forked from len0rd/rockbox

First step of charcell LCD code rework: * Make it fully unicode aware so that adding non-ISO8859-1 scripts becomes possible (limited by the LCD capabilities of course). * Make the API more similar to the bitmap LCD code's API. * Moved hardware dependent parts to target tree. * Simplified code. * Jumpscroll temporarily non-functional.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12916 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-03-26 07:52:13 +00:00
parent 165f62d0cd
commit ad4e3d6657
26 changed files with 1652 additions and 1806 deletions

View file

@ -26,13 +26,13 @@
typedef const unsigned char * ICON;
#define NOICON NULL
#else
typedef short ICON;
typedef long ICON;
#define NOICON -1
#endif
#define Icon_NOICON -1
#define CURSOR_CHAR 0x92
#define CURSOR_CHAR 0xe10c
#define CURSOR_WIDTH 6
#define CURSOR_HEIGHT 8

View file

@ -30,8 +30,8 @@
enum {
Icon_Queued = 'Q',
Icon_Moving = 'M',
Icon_Unknown = 0x90,
Icon_Bookmark = 0x16,
Icon_Unknown = 0xe100,
Icon_Bookmark,
Icon_Plugin,
Icon_Folder,
Icon_Firmware,

View file

@ -31,53 +31,46 @@
#include "misc.h"
#include "rbunicode.h"
#define KBD_BUF_SIZE 64
#define KEYBOARD_PAGES 3
extern unsigned short *lcd_ascii;
static unsigned char* kbd_setupkeys(int page, int* len)
static unsigned short *kbd_setupkeys(int page, int* len)
{
static unsigned char lines[128];
unsigned ch;
static unsigned short kbdline[KBD_BUF_SIZE];
const unsigned char *p;
int i = 0;
switch (page)
switch (page)
{
case 0: /* Capitals */
for (ch = 'A'; ch <= 'Z'; ch++)
lines[i++] = ch;
for (ch = 0xc0; ch <= 0xdd; ch++)
if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
lines[i++] = ch;
p = "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅ"
"ÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÝ";
break;
case 1: /* Small */
for (ch = 'a'; ch <= 'z'; ch++)
lines[i++] = ch;
for (ch = 0xdf; ch <= 0xff; ch++)
if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
lines[i++] = ch;
p = "abcdefghijklmnopqrstuvwxyzßàáâãä"
"åçèéêëìíîïñòóôöøùúûüýÿ";
break;
case 2: /* Others */
for (ch = ' '; ch <= '@'; ch++)
lines[i++] = ch;
default: /* Others */
p = " !\"#$%&'()*+,-./0123456789:;<=>?@[]_{}~";
break;
}
lines[i] = 0;
while (*p)
p = utf8decode(p, &kbdline[i++]);
*len = i;
return lines;
return kbdline;
}
/* Delimiters for highlighting the character selected for insertion */
#define KEYBOARD_INSERT_LEFT 0x81
#define KEYBOARD_INSERT_RIGHT 0x82
#define KEYBOARD_INSERT_LEFT 0xe110
#define KEYBOARD_INSERT_RIGHT 0xe10f
#define KEYBOARD_CURSOR 0x7f
#define KEYBOARD_ARROW 0x92
#define KEYBOARD_ARROW 0xe10c
/* helper function to spell a char if voice UI is enabled */
static void kbd_spellchar(char c)
@ -101,9 +94,8 @@ int kbd_input(char* text, int buflen)
int len, len_utf8, i, j;
int editpos, curpos, leftpos;
unsigned char *line = kbd_setupkeys(page, &linelen);
unsigned short *line = kbd_setupkeys(page, &linelen);
unsigned char temptext[36];
unsigned char tmp;
unsigned char *utf8;
int button, lastbutton = 0;
@ -130,20 +122,14 @@ int kbd_input(char* text, int buflen)
lcd_putc(0, 0, KEYBOARD_ARROW);
lcd_putc(0, 1, ' ');
}
/* Draw insert chars */
utf8 = temptext;
tmp = KEYBOARD_INSERT_LEFT;
utf8 = iso_decode(&tmp, utf8, 0, 1);
utf8 = iso_decode(&line[x], utf8, 0, 1);
tmp = KEYBOARD_INSERT_RIGHT;
utf8 = iso_decode(&tmp, utf8, 0, 1);
lcd_putc(1, 0, KEYBOARD_INSERT_LEFT);
lcd_putc(2, 0, line[x]);
lcd_putc(3, 0, KEYBOARD_INSERT_RIGHT);
for (i = 1; i < 8; i++)
{
utf8 = iso_decode(&line[(x+i)%linelen], utf8, 0, 1);
lcd_putc(i + 3, 0, line[(x+i)%linelen]);
}
*utf8 = 0;
lcd_puts(1, 0, temptext);
/* write out the text */
curpos = MIN(MIN(editpos, 10 - MIN(len_utf8 - editpos, 3)), 9);
@ -175,7 +161,7 @@ int kbd_input(char* text, int buflen)
lcd_remove_cursor();
lcd_puts(1, 1, temptext);
lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR);
gui_syncstatusbar_draw(&statusbars, true);
}
@ -270,7 +256,7 @@ int kbd_input(char* text, int buflen)
}
else /* inserts the selected char */
{
utf8 = iso_decode((unsigned char*)&line[x], temptext, 0, 1);
utf8 = utf8encode(line[x], temptext);
*utf8 = 0;
j = strlen(temptext);
if (len + j < buflen)

View file

@ -67,6 +67,9 @@ static const struct plugin_api rockbox_api = {
/* lcd */
lcd_set_contrast,
lcd_clear_display,
lcd_setmargins,
lcd_getstringsize,
lcd_putsxy,
lcd_puts,
lcd_puts_scroll,
lcd_stop_scroll,
@ -80,11 +83,9 @@ static const struct plugin_api rockbox_api = {
PREFIX(lcd_icon),
lcd_double_height,
#else
lcd_setmargins,
lcd_set_drawmode,
lcd_get_drawmode,
lcd_setfont,
lcd_getstringsize,
lcd_drawpixel,
lcd_drawline,
lcd_hline,
@ -109,7 +110,6 @@ static const struct plugin_api rockbox_api = {
bidi_l2v,
font_get_bits,
font_load,
lcd_putsxy,
lcd_puts_style,
lcd_puts_scroll_style,
&lcd_framebuffer[0][0],

View file

@ -29,7 +29,7 @@
#define MEM 2
#endif
#include <stdbool.h>
#include <stdbool.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
@ -110,12 +110,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 49
#define PLUGIN_API_VERSION 50
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 47
#define PLUGIN_MIN_API_VERSION 50
/* plugin return codes */
enum plugin_status {
@ -135,24 +135,25 @@ struct plugin_api {
/* lcd */
void (*lcd_set_contrast)(int x);
void (*lcd_clear_display)(void);
void (*lcd_setmargins)(int x, int y);
int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
void (*lcd_puts)(int x, int y, const unsigned char *string);
void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
void (*lcd_stop_scroll)(void);
#ifdef HAVE_LCD_CHARCELLS
void (*lcd_define_pattern)(int which,const char *pattern);
unsigned char (*lcd_get_locked_pattern)(void);
void (*lcd_unlock_pattern)(unsigned char pat);
void (*lcd_putc)(int x, int y, unsigned short ch);
void (*lcd_put_cursor)(int x, int y, char cursor_char);
void (*lcd_define_pattern)(unsigned long ucs, const char *pattern);
unsigned long (*lcd_get_locked_pattern)(void);
void (*lcd_unlock_pattern)(unsigned long ucs);
void (*lcd_putc)(int x, int y, unsigned long ucs);
void (*lcd_put_cursor)(int x, int y, unsigned long ucs);
void (*lcd_remove_cursor)(void);
void (*PREFIX(lcd_icon))(int icon, bool enable);
void (*lcd_double_height)(bool on);
#else
void (*lcd_setmargins)(int x, int y);
void (*lcd_set_drawmode)(int mode);
int (*lcd_get_drawmode)(void);
void (*lcd_setfont)(int font);
int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
void (*lcd_drawpixel)(int x, int y);
void (*lcd_drawline)(int x1, int y1, int x2, int y2);
void (*lcd_hline)(int x1, int x2, int y);
@ -184,7 +185,6 @@ struct plugin_api {
unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
struct font* (*font_load)(const char *path);
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
int style);

View file

@ -138,7 +138,7 @@ static unsigned char *abbrev_str[12] = {
};
static unsigned char heuro,hhome; /*Handles for the new patterns*/
static unsigned long heuro,hhome; /*Handles for the new patterns*/
static struct plugin_api* rb;
@ -239,7 +239,6 @@ static void round(longlong_t* i, longlong_t* f, int n)
*/
static void display(longlong_t euro, longlong_t home, bool pos)
{
char c1,c2;
longlong_t i,f;
unsigned char str[20];
unsigned char s1[20];
@ -247,52 +246,50 @@ static void display(longlong_t euro, longlong_t home, bool pos)
if (pos)
{ /*Edit the second line*/
c1=0x20;
rb->strcpy(s1,"%c%c%6d.%02d");
c2=0x81;
rb->strcpy(s1," %6d.%02d");
if (nb_digit[country]==2)
rb->strcpy(s2,"%c%c%06d.%02d");
rb->strcpy(s2,"\xee\x84\x90%06d.%02d");
else
rb->strcpy(s2,"%c%c%09d");
rb->strcpy(s2,"\xee\x84\x90%09d");
}
else
{
c1=0x81;
rb->strcpy(s1,"%c%c%06d.%02d");
c2=0x20;
rb->strcpy(s1,"\xee\x84\x90%06d.%02d");
if (nb_digit[country]==2)
rb->strcpy(s2,"%c%c%6d.%02d");
rb->strcpy(s2," %6d.%02d");
else
rb->strcpy(s2,"%c%c%9d");
rb->strcpy(s2," %9d");
}
rb->lcd_remove_cursor();
/*First line*/
rb->lcd_putc(0,0,heuro);
split(euro,&i,&f);
if (pos)
round(&i,&f,2);
rb->snprintf(str,sizeof(str),s1,heuro,c1,(int)i,(int)f);
rb->snprintf(str,sizeof(str),s1,(int)i,(int)f);
if (!pos)
{
rb->lcd_puts(0,0,str);
rb->lcd_puts(1,0,str);
rb->lcd_put_cursor(10-cur_pos,0,0x5F);
}
else
rb->lcd_puts_scroll(0,0,str);
rb->lcd_puts_scroll(1,0,str);
/*Second line*/
rb->lcd_putc(0,1,hhome);
split(home,&i,&f);
if (!pos)
round(&i,&f,nb_digit[country]);
rb->snprintf(str,sizeof(str),s2,hhome,c2,(int)i,(int)f);
rb->snprintf(str,sizeof(str),s2,(int)i,(int)f);
if (pos)
{
rb->lcd_puts(0,1,str);
rb->lcd_puts(1,1,str);
rb->lcd_put_cursor(10-cur_pos,1,0x5F);
}
else
rb->lcd_puts_scroll(0,1,str);
rb->lcd_puts_scroll(1,1,str);
}
@ -363,7 +360,7 @@ static int euro_menu(void)
rb->lcd_clear_display();
rb->lcd_puts(0,0," Currency");
rb->lcd_puts(0,1," Exit");
rb->lcd_putc(0,c,0x81);
rb->lcd_putc(0,c,0xe110);
switch (rb->button_get(true))
{

View file

@ -203,7 +203,7 @@ static const unsigned char tk_pat[4][7] = {
};
static unsigned char cur_pat[7];
static unsigned char gfx_chars[5];
static unsigned long gfx_chars[5];
static void release_gfx(void)
{

View file

@ -47,7 +47,7 @@ static unsigned char pattern[]={
};
static unsigned char str[12]; /*Containt the first line*/
static unsigned char h1,h2,h3; /*Handle for the pattern*/
static unsigned long h1,h2,h3; /*Handle for the pattern*/
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
@ -109,10 +109,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_define_pattern(h1, pattern);
rb->lcd_define_pattern(h2, pattern+7);
rb->lcd_define_pattern(h3, pattern+28);
rb->snprintf(str,sizeof(str),"%c%cJackpot%c%c",h1,h2,h2,h1);
rb->lcd_puts(0,0,str);
rb->snprintf(str,sizeof(str)," %c V1.1 %c",h3,h3);
rb->lcd_puts(0,1,str);
rb->lcd_puts(0,0," Jackpot ");
rb->lcd_putc(0,0,h1); rb->lcd_putc(1,0,h2);
rb->lcd_putc(9,0,h2); rb->lcd_putc(10,0,h1);
rb->lcd_puts(0,1," V1.1 ");
rb->lcd_putc(1,1,h3); rb->lcd_putc(9,1,h3);
rb->sleep(HZ*2);
rb->lcd_clear_display();

View file

@ -31,7 +31,7 @@ static int char_width;
static int char_height;
static int pixel_height;
static int pixel_width;
static unsigned char gfx_chars[8];
static unsigned long gfx_chars[8];
static unsigned char gfx_buffer[56];
static int drawmode = DRMODE_SOLID;

View file

@ -56,7 +56,7 @@ static unsigned char pattern2[]={0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}; /*2
static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/
static unsigned char str[12]; /*String use to display the first line*/
static unsigned char hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static bool end; /*If true game is finished*/
static struct plugin_api* rb;
@ -74,8 +74,8 @@ static void impossible(void)
static void lose(void)
{
rb->lcd_define_pattern(hsmile,smile);
rb->snprintf(str,sizeof(str),"You Win!!%c",hsmile);
rb->lcd_puts(0,1,str);
rb->lcd_puts(0,1,"You Win!!");
rb->lcd_putc(8,1,hsmile);
end=true;
rb->sleep(HZ*2);
return;
@ -86,8 +86,8 @@ static void lose(void)
static void win(void)
{
rb->lcd_define_pattern(hcry,cry);
rb->snprintf(str,sizeof(str),"You Lose!!%c",hcry);
rb->lcd_puts(0,1,str);
rb->lcd_puts(0,1,"You Lose!!");
rb->lcd_putc(9,1,hcry);
end=true;
rb->sleep(HZ*2);
return;
@ -100,22 +100,22 @@ static void display_first_line(int x)
int i;
rb->snprintf(str,sizeof(str)," =%d",x);
rb->lcd_puts(0,0,str);
rb->lcd_define_pattern(h1,pattern3);
for(i=0;i<x/3;i++)
str[i]=h1;
for (i=0;i<x/3;i++)
rb->lcd_putc(i,0,h1);
if (x%3==2)
{
rb->lcd_define_pattern(h2,pattern2);
str[i]=h2;
rb->lcd_putc(i,0,h2);
}
if (x%3==1)
{
rb->lcd_define_pattern(h2,pattern1);
str[i]=h2;
rb->lcd_putc(i,0,h2);
}
rb->lcd_puts(0,0,str);
}
/* Call when the program end */

View file

@ -41,16 +41,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->depth=LCD_REMOTE_DEPTH;
screen->has_disk_led=false;
#if 1 /* all remote LCDs are bitmapped so far */
screen->width=LCD_REMOTE_WIDTH;
screen->height=LCD_REMOTE_HEIGHT;
screen->setmargins=&lcd_remote_setmargins;
screen->getymargin=&lcd_remote_getymargin;
screen->getxmargin=&lcd_remote_getxmargin;
screen->getstringsize=&lcd_remote_getstringsize;
#if 1 /* all remote LCDs are bitmapped so far */
screen->setfont=&lcd_remote_setfont;
screen->setfont(FONT_UI);
screen->getstringsize=&lcd_remote_getstringsize;
screen->putsxy=&lcd_remote_putsxy;
screen->mono_bitmap=&lcd_remote_mono_bitmap;
screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part;
screen->set_drawmode=&lcd_remote_set_drawmode;
@ -70,20 +69,14 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->drawline=&lcd_remote_drawline;
screen->vline=&lcd_remote_vline;
screen->hline=&lcd_remote_hline;
screen->scroll_speed=&lcd_remote_scroll_speed;
screen->scroll_delay=&lcd_remote_scroll_delay;
screen->scroll_step=&lcd_remote_scroll_step;
screen->invertscroll=&lcd_remote_invertscroll;
#endif /* LCD_REMOTE_DEPTH > 1 */
screen->puts_offset=&lcd_remote_puts_offset;
screen->puts_style_offset=&lcd_remote_puts_style_offset;
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
#endif /* 1 */
#if 0 /* no charcell remote LCDs so far */
screen->width=11;
screen->height=2;
screen->double_height=&lcd_remote_double_height;
screen->putc=&lcd_remote_putc;
screen->get_locked_pattern=&lcd_remote_get_locked_pattern;
@ -96,11 +89,16 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
#endif /* 0 */
screen->init=&lcd_remote_init;
screen->putsxy=&lcd_remote_putsxy;
screen->puts=&lcd_remote_puts;
screen->puts_offset=&lcd_remote_puts_offset;
screen->puts_scroll=&lcd_remote_puts_scroll;
screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
screen->scroll_speed=&lcd_remote_scroll_speed;
screen->scroll_delay=&lcd_remote_scroll_delay;
screen->stop_scroll=&lcd_remote_stop_scroll;
screen->clear_display=&lcd_remote_clear_display;
screen->update=&lcd_remote_update;
screen->puts=&lcd_remote_puts;
screen->backlight_on=&remote_backlight_on;
screen->backlight_off=&remote_backlight_off;
screen->is_backlight_on=&is_remote_backlight_on;
@ -116,16 +114,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
#elif defined(HAVE_REMOTE_LCD)
screen->has_disk_led=true;
#endif
#ifdef HAVE_LCD_BITMAP
screen->width=LCD_WIDTH;
screen->height=LCD_HEIGHT;
screen->setmargins=&lcd_setmargins;
screen->getymargin=&lcd_getymargin;
screen->getxmargin=&lcd_getxmargin;
screen->getstringsize=&lcd_getstringsize;
#ifdef HAVE_LCD_BITMAP
screen->setfont=&lcd_setfont;
screen->setfont(FONT_UI);
screen->getstringsize=&lcd_getstringsize;
screen->putsxy=&lcd_putsxy;
screen->mono_bitmap=&lcd_mono_bitmap;
screen->mono_bitmap_part=&lcd_mono_bitmap_part;
screen->set_drawmode=&lcd_set_drawmode;
@ -147,7 +144,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->get_foreground=&lcd_get_foreground;
screen->set_background=&lcd_set_background;
screen->set_foreground=&lcd_set_foreground;
#endif
#endif /* LCD_DEPTH > 1 */
screen->update_rect=&lcd_update_rect;
screen->fillrect=&lcd_fillrect;
screen->drawrect=&lcd_drawrect;
@ -155,20 +152,14 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->drawline=&lcd_drawline;
screen->vline=&lcd_vline;
screen->hline=&lcd_hline;
screen->scroll_speed=&lcd_scroll_speed;
screen->scroll_delay=&lcd_scroll_delay;
screen->scroll_step=&lcd_scroll_step;
screen->invertscroll=&lcd_invertscroll;
screen->puts_offset=&lcd_puts_offset;
screen->puts_style_offset=&lcd_puts_style_offset;
screen->puts_scroll_style=&lcd_puts_scroll_style;
screen->puts_scroll_offset=&lcd_puts_scroll_offset;
screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
screen->width=11; /* width in characters instead of pixels */
screen->height=2;
screen->double_height=&lcd_double_height;
screen->putc=&lcd_putc;
screen->get_locked_pattern=&lcd_get_locked_pattern;
@ -181,13 +172,18 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
#endif /* HAVE_LCD_CHARCELLS */
screen->init=&lcd_init;
screen->putsxy=&lcd_putsxy;
screen->puts=&lcd_puts;
screen->puts_offset=&lcd_puts_offset;
screen->puts_scroll=&lcd_puts_scroll;
screen->puts_scroll_offset=&lcd_puts_scroll_offset;
screen->scroll_speed=&lcd_scroll_speed;
screen->scroll_delay=&lcd_scroll_delay;
screen->stop_scroll=&lcd_stop_scroll;
screen->clear_display=&lcd_clear_display;
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
screen->update=&lcd_update;
#endif
screen->puts=&lcd_puts;
screen->backlight_on=&backlight_on;
screen->backlight_off=&backlight_off;
screen->is_backlight_on=&is_backlight_on;

View file

@ -60,24 +60,19 @@ struct screen
#ifdef HAS_BUTTONBAR
bool has_buttonbar;
#endif
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
void (*setmargins)(int x, int y);
int (*getxmargin)(void);
int (*getymargin)(void);
void (*setfont)(int newfont);
int (*getstringsize)(const unsigned char *str, int *w, int *h);
void (*putsxy)(int x, int y, const unsigned char *str);
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
void (*setfont)(int newfont);
void (*scroll_step)(int pixels);
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
void (*puts_style_offset)(int x, int y, const unsigned char *str,
int style, int offset);
void (*puts_scroll_style)(int x, int y, const unsigned char *string,
int style);
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
int offset);
void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
int style, int offset);
void (*mono_bitmap)(const unsigned char *src,
@ -114,17 +109,22 @@ struct screen
#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
void (*double_height)(bool on);
void (*putc)(int x, int y, unsigned short ch);
void (*putc)(int x, int y, unsigned long ucs);
void (*icon)(int icon, bool enable);
unsigned long (*get_locked_pattern)(void);
void (*define_pattern)(unsigned long ucs, const char *pattern);
#endif
void (*init)(void);
void (*putsxy)(int x, int y, const unsigned char *str);
void (*puts)(int x, int y, const unsigned char *str);
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
void (*puts_scroll)(int x, int y, const unsigned char *string);
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
int offset);
void (*scroll_speed)(int speed);
void (*scroll_delay)(int ms);
void (*stop_scroll)(void);
void (*clear_display)(void);
unsigned char (*get_locked_pattern)(void);
void (*define_pattern)(int pat, const char *pattern);
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
void (*update)(void);
#endif
@ -132,7 +132,6 @@ struct screen
void (*backlight_off)(void);
bool (*is_backlight_on)(void);
void (*backlight_set_timeout)(int index);
void (*puts)(int x, int y, const unsigned char *str);
};
/*

View file

@ -254,12 +254,12 @@ static void charging_display_info(bool animate)
}
#else /* not HAVE_LCD_BITMAP */
static unsigned char logo_chars[5];
static unsigned long logo_chars[4];
static const unsigned char logo_pattern[] = {
0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, /* char 1 */
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 2 */
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 3 */
0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, /* char 4 */
0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
};
static void logo_lock_patterns(bool on)
@ -270,7 +270,6 @@ static void logo_lock_patterns(bool on)
{
for (i = 0; i < 4; i++)
logo_chars[i] = lcd_get_locked_pattern();
logo_chars[4] = '\0';
}
else
{
@ -284,19 +283,20 @@ static void charging_display_info(bool animate)
int battv;
unsigned i, ypos;
static unsigned phase = 3;
char buf[28];
char buf[32];
battv = battery_voltage();
snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars,
battv / 100, battv % 100);
lcd_puts(0, 1, buf);
snprintf(buf, sizeof(buf), " %d.%02dV", battv / 100, battv % 100);
lcd_puts(4, 1, buf);
memcpy(buf, logo_pattern, 28); /* copy logo patterns */
memcpy(buf, logo_pattern, 32); /* copy logo patterns */
if (!animate) /* build the screen */
{
lcd_double_height(false);
lcd_puts(0, 0, "[Charging]");
for (i = 0; i < 4; i++)
lcd_putc(i, 1, logo_chars[i]);
}
else /* animate the logo */
{
@ -307,14 +307,14 @@ static void charging_display_info(bool animate)
ypos = (phase + i/5) % 9; /* "bounce" effect */
if (ypos > 4)
ypos = 8 - ypos;
buf[5 - ypos + 7 * (i/5)] |= 0x10 >> (i%5);
buf[5 - ypos + 8 * (i/5)] |= 0x10 >> (i%5);
}
}
phase++;
}
for (i = 0; i < 4; i++)
lcd_define_pattern(logo_chars[i], buf + 7 * i);
lcd_define_pattern(logo_chars[i], buf + 8 * i);
}
#endif /* (not) HAVE_LCD_BITMAP */