Fix display bugs with H10 LCDs (both 20GB and 5/6GB models). The 20GB LCD is actually a 128x160 LCD rotated 90 degrees, so we need to take account of this. The 5/6GB LCD is not rotated by 90 degrees but was treated as if it was (FS #5925, patch thanks to Thilo-Alexander Ginkel)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10886 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Barry Wardell 2006-09-04 23:10:27 +00:00
parent 7c587a25e5
commit 9b1dd444b0
3 changed files with 58 additions and 13 deletions

View file

@ -236,4 +236,5 @@ Christopher Borcsok
Victor Cardenas
Andrew Melville
Pengxuan Liu
Andrew Cupper
Andrew Cupper
Thilo-Alexander Ginkel

View file

@ -97,7 +97,7 @@
#define CPU_FREQ 11289600
/* Type of LCD */
#define CONFIG_LCD LCD_H10
#define CONFIG_LCD LCD_H10_20GB
#define DEFAULT_CONTRAST_SETTING 19

View file

@ -104,8 +104,8 @@ static inline bool timer_check(int clock_start, int usecs)
#define R_GATE_SCAN_START_POS 0x40
#define R_1ST_SCR_DRV_POS 0x42
#define R_2ND_SCR_DRV_POS 0x43
#define R_VERT_RAM_ADDR_POS 0x44
#define R_HORIZ_RAM_ADDR_POS 0x45
#define R_HORIZ_RAM_ADDR_POS 0x44
#define R_VERT_RAM_ADDR_POS 0x45
#endif
@ -219,18 +219,40 @@ void lcd_yuv_blit(unsigned char * const src[3],
y0 = y;
y1 = y + height - 1;
/* max horiz << 8 | start horiz */
#if CONFIG_LCD == LCD_H10_5GB
/* start horiz << 8 | max horiz */
lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
lcd_send_data((x0 << 8) | x1);
/* start vert << 8 | max vert */
lcd_send_cmd(R_VERT_RAM_ADDR_POS);
lcd_send_data((y0 << 8) | y1);
/* max vert << 8 | start vert */
/* start horiz << 8 | start vert */
lcd_send_cmd(R_RAM_ADDR_SET);
lcd_send_data(((x0 << 8) | y0));
#elif CONFIG_LCD == LCD_H10_20GB
/* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin
* is actually the bottom left and horizontal and vertical are swapped.
* Rockbox expects the origin to be the top left so we need to use
* 127 - y instead of just y */
/* start horiz << 8 | max horiz */
lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
lcd_send_data(((127-y1) << 8) | (127-y0));
/* start vert << 8 | max vert */
lcd_send_cmd(R_VERT_RAM_ADDR_POS);
lcd_send_data((x0 << 8) | x1);
/* position cursor (set AD0-AD15) */
/* start vert << 8 | start horiz */
/* start horiz << 8 | start vert */
lcd_send_cmd(R_RAM_ADDR_SET);
lcd_send_data(((y0 << 8) | x0));
lcd_send_data((((127-y0) << 8) | x0));
#endif /* CONFIG_LCD */
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);
@ -390,17 +412,39 @@ void lcd_update_rect(int x0, int y0, int width, int height)
x1 = t;
}
/* max horiz << 8 | start horiz */
#if CONFIG_LCD == LCD_H10_5GB
/* start horiz << 8 | max horiz */
lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
lcd_send_data((x0 << 8) | x1);
/* start vert << 8 | max vert */
lcd_send_cmd(R_VERT_RAM_ADDR_POS);
lcd_send_data((y0 << 8) | y1);
/* max vert << 8 | start vert */
/* start horiz << 8 | start vert */
lcd_send_cmd(R_RAM_ADDR_SET);
lcd_send_data(((x0 << 8) | y0));
#elif CONFIG_LCD == LCD_H10_20GB
/* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin
* is actually the bottom left and horizontal and vertical are swapped.
* Rockbox expects the origin to be the top left so we need to use
* 127 - y instead of just y */
/* start horiz << 8 | max horiz */
lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
lcd_send_data(((127-y1) << 8) | (127-y0));
/* start vert << 8 | max vert */
lcd_send_cmd(R_VERT_RAM_ADDR_POS);
lcd_send_data((x0 << 8) | x1);
/* position cursor (set AD0-AD15) */
/* start vert << 8 | start horiz */
/* start horiz << 8 | start vert */
lcd_send_cmd(R_RAM_ADDR_SET);
lcd_send_data(((y0 << 8) | x0));
lcd_send_data((((127-y0) << 8) | x0));
#endif /* CONFIG_LCD */
/* start drawing */
lcd_send_cmd(R_WRITE_DATA_2_GRAM);