diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-26 07:52:13 +0000 |
commit | ad4e3d665734b14a28f1ba5fa874663772dab3e7 (patch) | |
tree | bff44652495f1319a4d11ed63b3d4e90cb11197f /firmware/export | |
parent | 165f62d0cd771660e4b8d2ba7475e14d0d6f2e9f (diff) | |
download | rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.tar.gz rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.zip |
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
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config-player.h | 9 | ||||
-rw-r--r-- | firmware/export/lcd-charcell.h | 41 | ||||
-rw-r--r-- | firmware/export/lcd-player-charset.h | 27 | ||||
-rw-r--r-- | firmware/export/lcd.h | 63 |
4 files changed, 72 insertions, 68 deletions
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 @@ | |||
4 | /* define this if you would like tagcache to build on this target */ | 4 | /* define this if you would like tagcache to build on this target */ |
5 | #define HAVE_TAGCACHE | 5 | #define HAVE_TAGCACHE |
6 | 6 | ||
7 | /* LCD dimensions (for the simulator) */ | 7 | #define LCD_WIDTH 11 |
8 | #define LCD_WIDTH 132 /* Display width in pixels */ | 8 | #define LCD_HEIGHT 2 |
9 | #define LCD_HEIGHT 64 /* Display height in pixels */ | 9 | #define LCD_DEPTH 1 |
10 | #define LCD_DEPTH 1 | 10 | #define SIM_LCD_WIDTH 132 /* pixels */ |
11 | #define SIM_LCD_HEIGHT 64 /* pixels */ | ||
11 | 12 | ||
12 | /* define this if you have the Player's keyboard */ | 13 | /* define this if you have the Player's keyboard */ |
13 | #define CONFIG_KEYPAD PLAYER_PAD | 14 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: lcd-player.c 12835 2007-03-18 17:58:49Z amiconn $ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* map unicode characters to hardware or extended lcd characters */ | ||
21 | struct xchar_info { | ||
22 | unsigned short ucs; | ||
23 | unsigned short glyph; | ||
24 | /* 0x0000..0x7fff: fixed extended characters | ||
25 | * 0x8000..0xffff: variable extended characters | ||
26 | * Dontcare if priority == 0 */ | ||
27 | unsigned char priority; | ||
28 | unsigned char hw_char; /* direct or substitute */ | ||
29 | }; | ||
30 | |||
31 | /* target dependent - to be adjusted for other charcell targets */ | ||
32 | #define HW_PATTERN_SIZE 7 /* number of bytes per pattern */ | ||
33 | #define MAX_HW_PATTERNS 8 /* max. number of user-definable hw patterns */ | ||
34 | extern int hw_pattern_count; /* actual number of user-definable hw patterns */ | ||
35 | |||
36 | extern const struct xchar_info *xchar_info; | ||
37 | extern int xchar_info_size; /* number of entries */ | ||
38 | extern const unsigned char xfont_fixed[][8]; | ||
39 | |||
40 | void lcd_charset_init(void); | ||
41 | |||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2003 by Kjell Ericson | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifdef HAVE_LCD_CHARCELLS | ||
20 | |||
21 | #define NO_EXTENDED_LCD_CHARS 0x5e | ||
22 | #define RESERVED_CHAR 0xff | ||
23 | #define LAST_RESERVED_CHAR 0x16 | ||
24 | #define NOCHAR_OLD 0x24 | ||
25 | #define NOCHAR_NEW 0x20 | ||
26 | |||
27 | #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); | |||
59 | extern void lcd_backlight(bool on); | 59 | extern void lcd_backlight(bool on); |
60 | extern int lcd_default_contrast(void); | 60 | extern int lcd_default_contrast(void); |
61 | extern void lcd_set_contrast(int val); | 61 | extern void lcd_set_contrast(int val); |
62 | extern void lcd_setmargins(int xmargin, int ymargin); | ||
63 | extern int lcd_getxmargin(void); | ||
64 | extern int lcd_getymargin(void); | ||
65 | extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); | ||
62 | 66 | ||
63 | extern void lcd_clear_display(void); | 67 | extern void lcd_clear_display(void); |
68 | extern void lcd_putsxy(int x, int y, const unsigned char *string); | ||
64 | extern void lcd_puts(int x, int y, const unsigned char *string); | 69 | extern void lcd_puts(int x, int y, const unsigned char *string); |
65 | extern void lcd_puts_style(int x, int y, const unsigned char *string, int style); | 70 | extern void lcd_puts_style(int x, int y, const unsigned char *string, int style); |
66 | extern void lcd_putc(int x, int y, unsigned short ch); | 71 | extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); |
72 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, | ||
73 | int offset); | ||
74 | extern void lcd_putc(int x, int y, unsigned long ucs); | ||
67 | extern void lcd_stop_scroll(void); | 75 | extern void lcd_stop_scroll(void); |
76 | extern void lcd_bidir_scroll(int threshold); | ||
68 | extern void lcd_scroll_speed(int speed); | 77 | extern void lcd_scroll_speed(int speed); |
69 | extern void lcd_scroll_delay(int ms); | 78 | extern void lcd_scroll_delay(int ms); |
70 | extern void lcd_puts_scroll(int x, int y, const unsigned char* string); | 79 | extern void lcd_puts_scroll(int x, int y, const unsigned char* string); |
@@ -123,14 +132,14 @@ enum | |||
123 | ICON_PARAM | 132 | ICON_PARAM |
124 | }; | 133 | }; |
125 | 134 | ||
126 | extern void lcd_double_height(bool on); | 135 | void lcd_double_height(bool on); |
127 | extern void lcd_define_hw_pattern(int which,const char *pattern,int length); | 136 | void lcd_put_hw_char(int x, int y, unsigned char hw_char); |
128 | extern void lcd_define_pattern(int which,const char *pattern); | 137 | void lcd_define_hw_pattern(int which, const char *pattern); |
129 | unsigned char lcd_get_locked_pattern(void); | 138 | void lcd_define_pattern(unsigned long ucs, const char *pattern); |
130 | void lcd_unlock_pattern(unsigned char pat); | 139 | unsigned long lcd_get_locked_pattern(void); |
131 | void lcd_put_cursor(int x, int y, char cursor_char); | 140 | void lcd_unlock_pattern(unsigned long ucs); |
141 | void lcd_put_cursor(int x, int y, unsigned long cursor_ucs); | ||
132 | void lcd_remove_cursor(void); | 142 | void lcd_remove_cursor(void); |
133 | extern void lcd_bidir_scroll(int threshold); | ||
134 | #define JUMP_SCROLL_ALWAYS 5 | 143 | #define JUMP_SCROLL_ALWAYS 5 |
135 | extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */ | 144 | extern void lcd_jump_scroll(int mode); /* 0=off, 1=once, ..., ALWAYS */ |
136 | extern void lcd_jump_scroll_delay(int ms); | 145 | extern void lcd_jump_scroll_delay(int ms); |
@@ -303,17 +312,10 @@ extern void lcd_set_flip(bool yesno); | |||
303 | 312 | ||
304 | extern void lcd_set_drawmode(int mode); | 313 | extern void lcd_set_drawmode(int mode); |
305 | extern int lcd_get_drawmode(void); | 314 | extern int lcd_get_drawmode(void); |
306 | extern void lcd_setmargins(int xmargin, int ymargin); | ||
307 | extern int lcd_getxmargin(void); | ||
308 | extern int lcd_getymargin(void); | ||
309 | extern void lcd_setfont(int font); | 315 | extern void lcd_setfont(int font); |
310 | extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); | ||
311 | 316 | ||
312 | extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); | ||
313 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, | 317 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, |
314 | int style, int offset); | 318 | int style, int offset); |
315 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, | ||
316 | int offset); | ||
317 | extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | 319 | extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, |
318 | int style, int offset); | 320 | int style, int offset); |
319 | 321 | ||
@@ -338,10 +340,8 @@ extern void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
338 | int stride, int x, int y, int width, int height); | 340 | int stride, int x, int y, int width, int height); |
339 | extern void lcd_bitmap(const fb_data *src, int x, int y, int width, | 341 | extern void lcd_bitmap(const fb_data *src, int x, int y, int width, |
340 | int height); | 342 | int height); |
341 | extern void lcd_putsxy(int x, int y, const unsigned char *string); | ||
342 | 343 | ||
343 | extern void lcd_invertscroll(int x, int y); | 344 | extern void lcd_invertscroll(int x, int y); |
344 | extern void lcd_bidir_scroll(int threshold); | ||
345 | extern void lcd_scroll_step(int pixels); | 345 | extern void lcd_scroll_step(int pixels); |
346 | 346 | ||
347 | #if LCD_DEPTH > 1 | 347 | #if LCD_DEPTH > 1 |
@@ -380,36 +380,25 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, | |||
380 | #endif /* HAVE_LCD_BITMAP */ | 380 | #endif /* HAVE_LCD_BITMAP */ |
381 | 381 | ||
382 | /* internal usage, but in multiple drivers */ | 382 | /* internal usage, but in multiple drivers */ |
383 | #define SCROLL_SPACING 3 | ||
383 | #ifdef HAVE_LCD_BITMAP | 384 | #ifdef HAVE_LCD_BITMAP |
384 | #define SCROLL_SPACING 3 | 385 | #define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2) |
385 | #define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2) | 386 | #else |
387 | #define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH + SCROLL_SPACING + 2) | ||
388 | #endif | ||
386 | 389 | ||
387 | struct scrollinfo { | 390 | struct scrollinfo { |
388 | char line[SCROLL_LINE_SIZE]; | 391 | char line[SCROLL_LINE_SIZE]; |
389 | int len; /* length of line in chars */ | 392 | int len; /* length of line in chars */ |
390 | int width; /* length of line in pixels */ | ||
391 | int offset; | 393 | int offset; |
392 | int startx; | 394 | int startx; |
395 | #ifdef HAVE_LCD_BITMAP | ||
396 | int width; /* length of line in pixels */ | ||
397 | bool invert; /* invert the scrolled text */ | ||
398 | #endif | ||
393 | bool backward; /* scroll presently forward or backward? */ | 399 | bool backward; /* scroll presently forward or backward? */ |
394 | bool bidir; | 400 | bool bidir; |
395 | bool invert; /* invert the scrolled text */ | ||
396 | long start_tick; | 401 | long start_tick; |
397 | }; | 402 | }; |
398 | #else /* !HAVE_LCD_BITMAP */ | ||
399 | |||
400 | struct scrollinfo { | ||
401 | int mode; | ||
402 | char text[MAX_PATH]; | ||
403 | int textlen; | ||
404 | int offset; | ||
405 | int turn_offset; | ||
406 | int startx; | ||
407 | int starty; | ||
408 | long scroll_start_tick; | ||
409 | int direction; /* +1 for right or -1 for left*/ | ||
410 | int jump_scroll; | ||
411 | int jump_scroll_steps; | ||
412 | }; | ||
413 | #endif | ||
414 | 403 | ||
415 | #endif /* __LCD_H__ */ | 404 | #endif /* __LCD_H__ */ |