diff --git a/firmware/SOURCES b/firmware/SOURCES index b8471dc37d..5e37892efe 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -1189,6 +1189,7 @@ target/arm/imx233/fmradio-imx233.c #endif target/arm/imx233/creative-zen/backlight-zen.c # if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) +drivers/lcd-memframe.c target/arm/imx233/creative-zen/lcd-zen.c # elif defined(CREATIVE_ZENMOZAIC) target/arm/imx233/creative-zen/lcd-zenmozaic.c diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES index d74d4d3c60..a9293b4297 100644 --- a/firmware/asm/SOURCES +++ b/firmware/asm/SOURCES @@ -10,7 +10,8 @@ strlen.c #if (defined(SANSA_E200) || defined(GIGABEAT_F) || defined(GIGABEAT_S) || \ defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ - defined(SAMSUNG_YPR1) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ + defined(SAMSUNG_YPR1) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ + defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI)) && \ !defined(SIMULATOR) #if LCD_DEPTH == 24 lcd-as-memframe-24bit.c diff --git a/firmware/export/config/creativezen.h b/firmware/export/config/creativezen.h index e41a246ccf..5b89438691 100644 --- a/firmware/export/config/creativezen.h +++ b/firmware/export/config/creativezen.h @@ -95,10 +95,8 @@ #define LCD_HEIGHT 240 /* sqrt(320^2 + 240^2) / 2.5 = 160.0 */ #define LCD_DPI 160 -#define LCD_DEPTH 16 /* 65536 colours */ -#define LCD_PIXELFORMAT RGB565 /* rgb565 */ -/* framebuffer uses 24-bit/pix */ -#define IMX233_FRAMEBUFFER_SIZE (LCD_WIDTH * LCD_HEIGHT * 3) +#define LCD_DEPTH 24 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB888 /* rgb565 */ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/export/config/creativezenxfi.h b/firmware/export/config/creativezenxfi.h index d70a452312..f74a2ca165 100644 --- a/firmware/export/config/creativezenxfi.h +++ b/firmware/export/config/creativezenxfi.h @@ -102,10 +102,8 @@ #define LCD_HEIGHT 240 /* sqrt(320^2 + 240^2) / 2.5 = 160.0 */ #define LCD_DPI 160 -#define LCD_DEPTH 16 /* 65536 colours */ -#define LCD_PIXELFORMAT RGB565 /* rgb565 */ -/* framebuffer uses 24-bit/pix */ -#define IMX233_FRAMEBUFFER_SIZE (LCD_WIDTH * LCD_HEIGHT * 3) +#define LCD_DEPTH 24 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB888 /* rgb565 */ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF diff --git a/firmware/target/arm/imx233/creative-zen/lcd-target.h b/firmware/target/arm/imx233/creative-zen/lcd-target.h index b28bda347a..299ffa3dfb 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-target.h +++ b/firmware/target/arm/imx233/creative-zen/lcd-target.h @@ -23,4 +23,9 @@ bool lcd_debug_screen(void); +#if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) +#define LCD_FRAMEBUF_ADDR(col, row) (row*LCD_WIDTH + col + (fb_data *)FRAME) +extern void lcd_set_active(bool active); +#endif + #endif /* LCD_TARGET_H */ diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zen.c b/firmware/target/arm/imx233/creative-zen/lcd-zen.c index 6482c58787..c594209db9 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zen.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zen.c @@ -30,16 +30,14 @@ #include "clkctrl-imx233.h" #include "pinctrl-imx233.h" #include "dma-imx233.h" -#include "regs/regs-uartdbg.h" #include "logf.h" +#include "lcd-target.h" #ifndef BOOTLOADER #include "button.h" #include "font.h" #include "action.h" #endif -static bool lcd_on; - /** * DMA */ @@ -170,7 +168,7 @@ static void lcd_power_seq(void) static void lcd_init_seq(void) { /* NOTE I don't understand why I have to use BGR, logic would say I should not */ - spi_write_reg(0x1, 0x2b1d);// inversion + spi_write_reg(0x1, 0x231d);// no inversion spi_write_reg(0x2, 0x300); /* NOTE by default stmp3700 has vsync/hsync active low and data launch * at negative edge of dotclk, reflect this in the polarity settings */ @@ -225,18 +223,13 @@ static void lcd_display_off_seq(void) * Rockbox */ -bool lcd_active(void) -{ - return lcd_on; -} - void lcd_enable(bool enable) { - if(lcd_on == enable) + if(lcd_active() == enable) return; - lcd_on = enable; - if(lcd_on) + lcd_set_active(enable); + if(lcd_active()) { // enable spi spi_enable(true); @@ -341,27 +334,3 @@ void lcd_init_device(void) // enable lcd_enable(true); } - -void lcd_update(void) -{ - lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); -} - -void lcd_update_rect(int x, int y, int w, int h) -{ - #ifdef HAVE_LCD_ENABLE - if(!lcd_on) - return; - #endif - for(int yy = y; yy < y + h; yy++) - { - uint16_t *pix = FBADDR(x, yy); - uint8_t *p = 3 * (yy * LCD_WIDTH + x) + (uint8_t *)FRAME; - for(int xx = 0; xx < w; xx++, pix++) - { - *p++ = RGB_UNPACK_RED(*pix); - *p++ = RGB_UNPACK_GREEN(*pix); - *p++ = RGB_UNPACK_BLUE(*pix); - } - } -} diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c index eac36676ae..c1bc379a49 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c @@ -127,6 +127,8 @@ void lcd_enable(bool enable) return; lcd_on = enable; + if(enable) + send_event(LCD_EVENT_ACTIVATION, NULL); } #endif diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c index 3bc8e67e5d..06b0f158f3 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zenv.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenv.c @@ -138,6 +138,8 @@ void lcd_enable(bool enable) return; lcd_on = enable; + if(enable) + send_event(LCD_EVENT_ACTIVATION, NULL); } #endif diff --git a/tools/configure b/tools/configure index 022f38071b..cfc9aa5767 100755 --- a/tools/configure +++ b/tools/configure @@ -2377,7 +2377,7 @@ fi target="CREATIVE_ZEN" memory=32 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" - bmp2rb_native="$rootdir/tools/bmp2rb -f 4" + bmp2rb_native="$rootdir/tools/bmp2rb -f 9" tool="$rootdir/tools/scramble -add=zen" output="rockbox.creative" bootoutput="bootloader-zen.creative"