From a7f4e1f1c51c6f99d17eb25dbdd57a78af4cb0e1 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 29 Apr 2009 22:24:40 +0000 Subject: Simulate lcd_enable and lcd_sleep in the simulator. Therefore, turn backlight-sim.h into a .c too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20829 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/lcd-common.c | 55 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'uisimulator/common/lcd-common.c') diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index 7d40f36b0f..52db776856 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c @@ -22,8 +22,15 @@ * ****************************************************************************/ +#include "config.h" #include "lcd.h" -#include "lcd-sdl.h" + +#ifdef HAVE_LCD_ENABLE +static bool lcd_enabled = false; +#endif +#ifdef HAVE_LCD_SLEEP +static bool lcd_sleeping = true; +#endif void lcd_set_flip(bool yesno) { @@ -64,3 +71,49 @@ void lcd_remote_set_invert_display(bool invert) (void)invert; } #endif + +#ifdef HAVE_LCD_SLEEP +void lcd_sleep(void) +{ + lcd_sleeping = true; +} + +void lcd_awake(void) +{ + if (lcd_sleeping) + { + lcd_activation_call_hook(); + lcd_sleeping = false; + } +} +#endif +#ifdef HAVE_LCD_ENABLE +void lcd_enable(bool on) +{ + if (on && !lcd_enabled) + { +#ifdef HAVE_LCD_SLEEP + /* lcd_awake will handle the activation call */ + lcd_awake(); +#else + lcd_activation_call_hook(); +#endif + } + lcd_enabled = on; +} +#endif + +#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) +bool lcd_active(void) +{ + bool retval = false; +#ifdef HAVE_LCD_ENABLE + retval = lcd_enabled; +#endif +#ifdef HAVE_LCD_SLEEP + if (!retval) + retval = !lcd_sleeping; +#endif + return retval; +} +#endif -- cgit v1.2.3