From ad4e3d665734b14a28f1ba5fa874663772dab3e7 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 26 Mar 2007 07:52:13 +0000 Subject: 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 --- firmware/export/config-player.h | 9 +++--- firmware/export/lcd-charcell.h | 41 +++++++++++++++++++++++ firmware/export/lcd-player-charset.h | 27 ---------------- firmware/export/lcd.h | 63 +++++++++++++++--------------------- 4 files changed, 72 insertions(+), 68 deletions(-) create mode 100644 firmware/export/lcd-charcell.h delete mode 100644 firmware/export/lcd-player-charset.h (limited to 'firmware/export') diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index ef5eedef79..e462ef2d8e 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -4,10 +4,11 @@ /* define this if you would like tagcache to build on this target */ #define HAVE_TAGCACHE -/* LCD dimensions (for the simulator) */ -#define LCD_WIDTH 132 /* Display width in pixels */ -#define LCD_HEIGHT 64 /* Display height in pixels */ -#define LCD_DEPTH 1 +#define LCD_WIDTH 11 +#define LCD_HEIGHT 2 +#define LCD_DEPTH 1 +#define SIM_LCD_WIDTH 132 /* pixels */ +#define SIM_LCD_HEIGHT 64 /* pixels */ /* define this if you have the Player's keyboard */ #define CONFIG_KEYPAD PLAYER_PAD diff --git a/firmware/export/lcd-charcell.h b/firmware/export/lcd-charcell.h new file mode 100644 index 0000000000..2676056e63 --- /dev/null +++ b/firmware/export/lcd-charcell.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: lcd-player.c 12835 2007-03-18 17:58:49Z amiconn $ + * + * Copyright (C) 2007 by Jens Arnold + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* map unicode characters to hardware or extended lcd characters */ +struct xchar_info { + unsigned short ucs; + unsigned short glyph; + /* 0x0000..0x7fff: fixed extended characters + * 0x8000..0xffff: variable extended characters + * Dontcare if priority == 0 */ + unsigned char priority; + unsigned char hw_char; /* direct or substitute */ +}; + +/* target dependent - to be adjusted for other charcell targets */ +#define HW_PATTERN_SIZE 7 /* number of bytes per pattern */ +#define MAX_HW_PATTERNS 8 /* max. number of user-definable hw patterns */ +extern int hw_pattern_count; /* actual number of user-definable hw patterns */ + +extern const struct xchar_info *xchar_info; +extern int xchar_info_size; /* number of entries */ +extern const unsigned char xfont_fixed[][8]; + +void lcd_charset_init(void); + diff --git a/firmware/export/lcd-player-charset.h b/firmware/export/lcd-player-charset.h deleted file mode 100644 index c94fab8f3b..0000000000 --- a/firmware/export/lcd-player-charset.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2003 by Kjell Ericson - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifdef HAVE_LCD_CHARCELLS - -#define NO_EXTENDED_LCD_CHARS 0x5e -#define RESERVED_CHAR 0xff -#define LAST_RESERVED_CHAR 0x16 -#define NOCHAR_OLD 0x24 -#define NOCHAR_NEW 0x20 - -#endif diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 1b7dbb4795..0d56389480 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -59,12 +59,21 @@ extern void lcd_init_device(void); extern void lcd_backlight(bool on); extern int lcd_default_contrast(void); extern void lcd_set_contrast(int val); +extern void lcd_setmargins(int xmargin, int ymargin); +extern int lcd_getxmargin(void); +extern int lcd_getymargin(void); +extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); extern void lcd_clear_display(void); +extern void lcd_putsxy(int x, int y, const unsigned char *string); extern void lcd_puts(int x, int y, const unsigned char *string); extern void lcd_puts_style(int x, int y, const unsigned char *string, int style); -extern void lcd_putc(int x, int y, unsigned short ch); +extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); +extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, + int offset); +extern void lcd_putc(int x, int y, unsigned long ucs); extern void lcd_stop_scroll(void); +extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_speed(int speed); extern void lcd_scroll_delay(int ms); extern void lcd_puts_scroll(int x, int y, const unsigned char* string); @@ -123,14 +132,14 @@ enum ICON_PARAM }; -extern void lcd_double_height(bool on); -extern void lcd_define_hw_pattern(int which,const char *pattern,int length); -extern 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_put_cursor(int x, int y, char cursor_char); +void lcd_double_height(bool on); +void lcd_put_hw_char(int x, int y, unsigned char hw_char); +void lcd_define_hw_pattern(int which, const char *pattern); +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_put_cursor(int x, int y, unsigned long cursor_ucs); void lcd_remove_cursor(void); -extern void lcd_bidir_scroll(int threshold); #define JUMP_SCROLL_ALWAYS 5 extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */ extern void lcd_jump_scroll_delay(int ms); @@ -303,17 +312,10 @@ extern void lcd_set_flip(bool yesno); extern void lcd_set_drawmode(int mode); extern int lcd_get_drawmode(void); -extern void lcd_setmargins(int xmargin, int ymargin); -extern int lcd_getxmargin(void); -extern int lcd_getymargin(void); extern void lcd_setfont(int font); -extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); -extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset); -extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, - int offset); extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, int style, int offset); @@ -338,10 +340,8 @@ extern void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, int stride, int x, int y, int width, int height); extern void lcd_bitmap(const fb_data *src, int x, int y, int width, int height); -extern void lcd_putsxy(int x, int y, const unsigned char *string); extern void lcd_invertscroll(int x, int y); -extern void lcd_bidir_scroll(int threshold); extern void lcd_scroll_step(int pixels); #if LCD_DEPTH > 1 @@ -380,36 +380,25 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, #endif /* HAVE_LCD_BITMAP */ /* internal usage, but in multiple drivers */ +#define SCROLL_SPACING 3 #ifdef HAVE_LCD_BITMAP -#define SCROLL_SPACING 3 -#define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2) +#define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2) +#else +#define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH + SCROLL_SPACING + 2) +#endif struct scrollinfo { char line[SCROLL_LINE_SIZE]; int len; /* length of line in chars */ - int width; /* length of line in pixels */ int offset; int startx; +#ifdef HAVE_LCD_BITMAP + int width; /* length of line in pixels */ + bool invert; /* invert the scrolled text */ +#endif bool backward; /* scroll presently forward or backward? */ bool bidir; - bool invert; /* invert the scrolled text */ long start_tick; }; -#else /* !HAVE_LCD_BITMAP */ - -struct scrollinfo { - int mode; - char text[MAX_PATH]; - int textlen; - int offset; - int turn_offset; - int startx; - int starty; - long scroll_start_tick; - int direction; /* +1 for right or -1 for left*/ - int jump_scroll; - int jump_scroll_steps; -}; -#endif #endif /* __LCD_H__ */ -- cgit v1.2.3