diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-15 12:25:57 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-15 12:25:57 +0000 |
commit | 0a4b247080dd132e847071adbc006ad9de2ca608 (patch) | |
tree | 5eb04ea6eefba517233d9c649ce5f6c56e6d16be /firmware/drivers/lcd-player.c | |
parent | 6e0a75c596a6c4ec5ec2820e1873c8527aec5007 (diff) | |
download | rockbox-0a4b247080dd132e847071adbc006ad9de2ca608.tar.gz rockbox-0a4b247080dd132e847071adbc006ad9de2ca608.zip |
The player firmware now autodetects the LCD type. No need for two player versions anymore
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2658 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/lcd-player.c')
-rw-r--r-- | firmware/drivers/lcd-player.c | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/firmware/drivers/lcd-player.c b/firmware/drivers/lcd-player.c index f0a222f831..a262b83fe9 100644 --- a/firmware/drivers/lcd-player.c +++ b/firmware/drivers/lcd-player.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "config.h" | 19 | #include "config.h" |
20 | #include "hwcompat.h" | ||
20 | 21 | ||
21 | #ifdef HAVE_LCD_CHARCELLS | 22 | #ifdef HAVE_LCD_CHARCELLS |
22 | 23 | ||
@@ -32,19 +33,18 @@ | |||
32 | 33 | ||
33 | /*** definitions ***/ | 34 | /*** definitions ***/ |
34 | 35 | ||
35 | #ifdef HAVE_NEW_CHARCELL_LCD | 36 | #define OLD_LCD_CONTRAST_SET ((char)0xA8) |
36 | # define LCD_CONTRAST_SET ((char)0x50) | 37 | #define OLD_LCD_CRAM ((char)0xB0) /* Characters */ |
37 | # define LCD_CRAM ((char)0x80) /* Characters */ | 38 | #define OLD_LCD_PRAM ((char)0x80) /* Patterns */ |
38 | # define LCD_PRAM ((char)0xC0) /* Patterns */ | 39 | #define OLD_LCD_IRAM ((char)0xE0) /* Icons */ |
39 | # define LCD_IRAM ((char)0x40) /* Icons */ | 40 | |
40 | #else | 41 | #define NEW_LCD_CONTRAST_SET ((char)0x50) |
41 | # define LCD_CONTRAST_SET ((char)0xA8) | 42 | #define NEW_LCD_CRAM ((char)0x80) /* Characters */ |
42 | # define LCD_CRAM ((char)0xB0) /* Characters */ | 43 | #define NEW_LCD_PRAM ((char)0xC0) /* Patterns */ |
43 | # define LCD_PRAM ((char)0x80) /* Patterns */ | 44 | #define NEW_LCD_IRAM ((char)0x40) /* Icons */ |
44 | # define LCD_IRAM ((char)0xE0) /* Icons */ | 45 | |
45 | #endif | 46 | #define LCD_CURSOR(x,y) ((char)(lcd_cram+((y)*16+(x)))) |
46 | #define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x)))) | 47 | #define LCD_ICON(i) ((char)(lcd_iram+i)) |
47 | #define LCD_ICON(i) ((char)(LCD_IRAM+i)) | ||
48 | 48 | ||
49 | /*** generic code ***/ | 49 | /*** generic code ***/ |
50 | 50 | ||
@@ -68,9 +68,7 @@ static char scroll_spacing = 3; /* spaces between end and start of text */ | |||
68 | static struct scrollinfo scroll; /* only one scroll line at the moment */ | 68 | static struct scrollinfo scroll; /* only one scroll line at the moment */ |
69 | static int scroll_count = 0; | 69 | static int scroll_count = 0; |
70 | 70 | ||
71 | #ifdef HAVE_NEW_CHARCELL_LCD | 71 | static const unsigned char new_lcd_ascii[] = { |
72 | |||
73 | static const unsigned char lcd_ascii[] = { | ||
74 | 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, | 72 | 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, |
75 | 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, | 73 | 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, |
76 | 0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17, | 74 | 0x10,0x11,0x05,0x13,0x14,0x15,0x16,0x17, |
@@ -105,9 +103,7 @@ static const unsigned char lcd_ascii[] = { | |||
105 | 0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79 | 103 | 0x20,0x75,0x75,0x75,0x75,0x79,0x20,0x79 |
106 | }; | 104 | }; |
107 | 105 | ||
108 | #else | 106 | static const unsigned char old_lcd_ascii[] = { |
109 | |||
110 | static const unsigned char lcd_ascii[] = { | ||
111 | 0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89, | 107 | 0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89, |
112 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | 108 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, |
113 | 0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00, | 109 | 0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00, |
@@ -141,7 +137,15 @@ static const unsigned char lcd_ascii[] = { | |||
141 | 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24, | 137 | 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24, |
142 | 0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d | 138 | 0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d |
143 | }; | 139 | }; |
144 | #endif /* HAVE_NEW_CHARCELL_LCD */ | 140 | |
141 | static bool new_lcd; | ||
142 | |||
143 | static unsigned const char *lcd_ascii; | ||
144 | static char lcd_contrast_set; | ||
145 | static char lcd_cram; | ||
146 | static char lcd_pram; | ||
147 | static char lcd_iram; | ||
148 | |||
145 | 149 | ||
146 | void lcd_clear_display(void) | 150 | void lcd_clear_display(void) |
147 | { | 151 | { |
@@ -170,14 +174,15 @@ void lcd_putc(int x, int y, unsigned char ch) | |||
170 | void lcd_define_pattern (int which,char *pattern,int length) | 174 | void lcd_define_pattern (int which,char *pattern,int length) |
171 | { | 175 | { |
172 | int i; | 176 | int i; |
173 | lcd_write(true,LCD_PRAM|which); | 177 | lcd_write(true,lcd_pram | which); |
174 | for (i=0;i<length;i++) | 178 | for (i=0;i<length;i++) |
175 | lcd_write(false,pattern[i]); | 179 | lcd_write(false,pattern[i]); |
176 | } | 180 | } |
177 | 181 | ||
178 | void lcd_double_height(bool on) | 182 | void lcd_double_height(bool on) |
179 | { | 183 | { |
180 | lcd_write(true,on?9:8); | 184 | if(new_lcd) |
185 | lcd_write(true,on?9:8); | ||
181 | } | 186 | } |
182 | 187 | ||
183 | static char icon_pos[] = | 188 | static char icon_pos[] = |
@@ -238,13 +243,29 @@ void lcd_icon(int icon, bool enable) | |||
238 | 243 | ||
239 | void lcd_init (void) | 244 | void lcd_init (void) |
240 | { | 245 | { |
246 | new_lcd = has_new_lcd(); | ||
247 | |||
248 | if(new_lcd) { | ||
249 | lcd_ascii = new_lcd_ascii; | ||
250 | lcd_contrast_set = NEW_LCD_CONTRAST_SET; | ||
251 | lcd_cram = NEW_LCD_CRAM; | ||
252 | lcd_pram = NEW_LCD_PRAM; | ||
253 | lcd_iram = NEW_LCD_IRAM; | ||
254 | } else { | ||
255 | lcd_ascii = old_lcd_ascii; | ||
256 | lcd_contrast_set = OLD_LCD_CONTRAST_SET; | ||
257 | lcd_cram = OLD_LCD_CRAM; | ||
258 | lcd_pram = OLD_LCD_PRAM; | ||
259 | lcd_iram = OLD_LCD_IRAM; | ||
260 | } | ||
261 | |||
241 | create_thread(scroll_thread, scroll_stack, | 262 | create_thread(scroll_thread, scroll_stack, |
242 | sizeof(scroll_stack), scroll_name); | 263 | sizeof(scroll_stack), scroll_name); |
243 | } | 264 | } |
244 | 265 | ||
245 | void lcd_set_contrast(int val) | 266 | void lcd_set_contrast(int val) |
246 | { | 267 | { |
247 | lcd_write(true, LCD_CONTRAST_SET); | 268 | lcd_write(true, lcd_contrast_set); |
248 | lcd_write(false, 31-val); | 269 | lcd_write(false, 31-val); |
249 | } | 270 | } |
250 | 271 | ||