From 90e8dc8f6b8b1396f9b16361cff7a32204dfa069 Mon Sep 17 00:00:00 2001 From: Szymon Dziok Date: Wed, 15 Dec 2010 22:06:51 +0000 Subject: HDD6330: implement lcd_set_flip() function. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28839 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config/gogearhdd6330.h | 2 +- firmware/target/arm/philips/hdd6330/lcd-hdd6330.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/firmware/export/config/gogearhdd6330.h b/firmware/export/config/gogearhdd6330.h index c91e2a45d8..b0128cc84c 100644 --- a/firmware/export/config/gogearhdd6330.h +++ b/firmware/export/config/gogearhdd6330.h @@ -71,7 +71,7 @@ #endif /* define this if you can flip your LCD */ -/* #define HAVE_LCD_FLIP */ +#define HAVE_LCD_FLIP /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c index 4549f09d2a..86006c9636 100644 --- a/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c +++ b/firmware/target/arm/philips/hdd6330/lcd-hdd6330.c @@ -37,6 +37,9 @@ /* Display status */ static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; +/* Used for flip offset correction */ +static int x_offset; + /* wait for LCD */ static inline void lcd_wait_write(void) { @@ -66,6 +69,8 @@ void lcd_init_device(void) lcd_send_data(0x48); lcd_send_reg(LCD_REG_UNKNOWN_05); lcd_send_data(0x0f); + + x_offset = 16; } /*** hardware configuration ***/ @@ -89,7 +94,10 @@ void lcd_set_invert_display(bool yesno) /* turn the display upside down (call lcd_update() afterwards) */ void lcd_set_flip(bool yesno) { - (void)yesno; + int flip = (yesno) ? 0x88 : 0x48; + x_offset = (yesno) ? 4 : 16; + lcd_send_reg(LCD_REG_UNKNOWN_01); + lcd_send_data(flip); } void lcd_yuv_set_options(unsigned options) @@ -131,10 +139,10 @@ void lcd_blit_yuv(unsigned char * const src[3], lcd_send_data(y + height - 1); lcd_send_reg(LCD_REG_VERT_ADDR_START); - lcd_send_data(x + 16); + lcd_send_data(x + x_offset); lcd_send_reg(LCD_REG_VERT_ADDR_END); - lcd_send_data(x + width - 1 + 16); + lcd_send_data(x + width - 1 + x_offset); lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM); @@ -223,10 +231,10 @@ void lcd_update_rect(int x, int y, int width, int height) lcd_send_data(y + height - 1); lcd_send_reg(LCD_REG_VERT_ADDR_START); - lcd_send_data(x + 16); + lcd_send_data(x + x_offset); lcd_send_reg(LCD_REG_VERT_ADDR_END); - lcd_send_data(x + width - 1 + 16); + lcd_send_data(x + width - 1 + x_offset); lcd_send_reg(LCD_REG_WRITE_DATA_2_GRAM); -- cgit v1.2.3