Now the X5 LCD driver works as expected
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9177 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c5b63269fc
commit
d0e8c57b77
1 changed files with 44 additions and 10 deletions
|
@ -38,8 +38,45 @@ static bool display_on=false; /* is the display turned on? */
|
|||
#define R_RAM_ADDR_SET 0x21
|
||||
#define R_WRITE_DATA_2_GRAM 0x22
|
||||
|
||||
/*****************************************************
|
||||
The tables below were generated by the following script:
|
||||
|
||||
#!/usr/bin/perl
|
||||
|
||||
# low byte table
|
||||
print "short low8to9[] = {\n";
|
||||
$str = " ";
|
||||
for my $m (0 .. 255) {
|
||||
# RRRRRGGG => RRRRR0GGG
|
||||
my $v = (($m & 0xF8) << 1) | ($m & 0x07);
|
||||
if(length($str) > 75) {
|
||||
print "$str\n";
|
||||
$str=" ";
|
||||
}
|
||||
$str .= sprintf("0x%03x, ", $v);
|
||||
}
|
||||
print "$str\n};\n";
|
||||
|
||||
$str = " ";
|
||||
# high byte table
|
||||
print "short high8to9[] = {\n";
|
||||
|
||||
# high byte table
|
||||
for my $m (0 .. 255) {
|
||||
# GGGBBBBB = GGGBBBBB0
|
||||
my $v = (($m & 0xFF) << 1);
|
||||
if(length($str) > 75) {
|
||||
print "$str\n";
|
||||
$str=" ";
|
||||
}
|
||||
$str .= sprintf("0x%03x, ", $v);
|
||||
}
|
||||
print "$str\n};\n";
|
||||
|
||||
*****************************************************/
|
||||
|
||||
/* Lookup tables for 16->18bit conversion */
|
||||
const short low8to9[] = {
|
||||
const short high8to9[] = {
|
||||
0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x010, 0x011, 0x012,
|
||||
0x013, 0x014, 0x015, 0x016, 0x017, 0x020, 0x021, 0x022, 0x023, 0x024, 0x025,
|
||||
0x026, 0x027, 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, 0x040,
|
||||
|
@ -65,7 +102,7 @@ const short low8to9[] = {
|
|||
0x1e2, 0x1e3, 0x1e4, 0x1e5, 0x1e6, 0x1e7, 0x1f0, 0x1f1, 0x1f2, 0x1f3, 0x1f4,
|
||||
0x1f5, 0x1f6, 0x1f7,
|
||||
} ICONST_ATTR;
|
||||
const short high8to9[] = {
|
||||
const short low8to9[] = {
|
||||
0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, 0x010, 0x012, 0x014,
|
||||
0x016, 0x018, 0x01a, 0x01c, 0x01e, 0x020, 0x022, 0x024, 0x026, 0x028, 0x02a,
|
||||
0x02c, 0x02e, 0x030, 0x032, 0x034, 0x036, 0x038, 0x03a, 0x03c, 0x03e, 0x040,
|
||||
|
@ -172,9 +209,9 @@ void lcd_init_device(void)
|
|||
|
||||
lcd_write_reg(0x0d, 0x0401);
|
||||
lcd_write_reg(0x0e, 0x321e);
|
||||
lcd_write_reg(0x01, 0x0113);
|
||||
lcd_write_reg(0x01, 0x0313);
|
||||
lcd_write_reg(0x02, 0x0700);
|
||||
lcd_write_reg(0x05, 0x9018);
|
||||
lcd_write_reg(0x05, 0x9038);
|
||||
lcd_write_reg(0x06, 0x0000);
|
||||
lcd_write_reg(0x0b, 0x4000);
|
||||
|
||||
|
@ -189,7 +226,7 @@ void lcd_init_device(void)
|
|||
lcd_write_reg(0x35,0x0704);
|
||||
lcd_write_reg(0x36,0x0407);
|
||||
lcd_write_reg(0x37,0x0503);
|
||||
lcd_write_reg(0x0f,0x0000);
|
||||
lcd_write_reg(0x0f,0x0002);
|
||||
lcd_write_reg(0x11,0x0000);
|
||||
lcd_write_reg(0x14,0x9f00);
|
||||
lcd_write_reg(0x15,0x5c00);
|
||||
|
@ -290,10 +327,7 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
}
|
||||
|
||||
/* reset update window */
|
||||
/* horiz ram addr: 0 - 175 */
|
||||
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0xaf00);
|
||||
|
||||
/* vert ram addr: 0 - 219 */
|
||||
lcd_write_reg(R_VERT_RAM_ADDR_POS, 0xdb00);
|
||||
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 0x7f00);
|
||||
lcd_write_reg(R_VERT_RAM_ADDR_POS, 0x9f00);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue