Index: firmware/export/config-c200.h =================================================================== --- firmware/export/config-c200.h (revision 18117) +++ firmware/export/config-c200.h (working copy) @@ -48,7 +48,7 @@ #define LCD_PIXELFORMAT RGB565 /* rgb565 */ /* define this if you have LCD enable function */ -/* TODO: #define HAVE_LCD_ENABLE */ +#define HAVE_LCD_ENABLE /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE should be defined as well. */ Index: firmware/target/arm/sandisk/sansa-c200/lcd-c200.c =================================================================== --- firmware/target/arm/sandisk/sansa-c200/lcd-c200.c (revision 18117) +++ firmware/target/arm/sandisk/sansa-c200/lcd-c200.c (working copy) @@ -26,6 +26,7 @@ /* Display status */ static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; +static bool is_lcd_enabled = true; /* LCD command set for Samsung S6B33B2 */ @@ -189,6 +190,36 @@ (void)yesno; } +void lcd_enable(bool yesno) +{ + if (yesno == is_lcd_enabled) + { + /* no change */ + return; + } + is_lcd_enabled = yesno; + + if (yesno) + { + lcd_send_command(R_STANDBY_OFF); + lcd_send_command(R_DISPLAY_ON); + /* force an lcd_update and notify listeners */ + lcd_update(); + lcd_call_enable_hook(); + } + else + { + lcd_send_command(R_DISPLAY_OFF); + lcd_send_command(R_STANDBY_ON); + } +} + +bool lcd_enabled(void) +{ + return is_lcd_enabled; +} + + /* turn the display upside down (call lcd_update() afterwards) */ void lcd_set_flip(bool yesno) { @@ -220,6 +251,12 @@ unsigned char const * yuv_src[3]; off_t z; + if (!is_lcd_enabled) + { + /* don't bother to update when LCD is disabled */ + return; + } + /* Sorry, but width and height must be >= 2 or else */ width &= ~1; height >>= 1; @@ -291,6 +328,12 @@ { const fb_data *addr; + if (!is_lcd_enabled) + { + /* don't bother to update when LCD is disabled */ + return; + } + if (x + width >= LCD_WIDTH) width = LCD_WIDTH - x; if (y + height >= LCD_HEIGHT)