Rework lcd_enabled and lcd_set/call_enable hook

a) lcd_enabled() is now lcd_active(), and is available for HAVE_LCD_SLEEP only targets (e.g. ipod video) too. It was depandent on HAVE_LCD_ENALE only before
b) rename the hook accordingly, and implement the hook for other other targets too (e.g. the clip [the only mono target with lcd_enable/lcd_sleep yet, so the code is still in the lcd driver], ipod, fuze, c200)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20331 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-03-17 02:43:47 +00:00
parent aad712d39f
commit b7739fbf1c
23 changed files with 101 additions and 84 deletions

View file

@ -159,22 +159,43 @@ void lcd_set_flip(bool yesno)
}
}
#ifdef HAVE_LCD_ENABLE
static void (*lcd_activation_hook)(void) = NULL;
void lcd_activation_set_hook(void (*func)(void))
{
lcd_activation_hook = func;
}
void lcd_activation_call_hook(void)
{
void (*func)(void) = lcd_activation_hook;
if (func != NULL)
func();
}
void lcd_enable(bool enable)
{
if(display_on == enable)
return;
if( (display_on = enable) ) /* simple '=' is not a typo ! */
{
lcd_write_command(LCD_SET_DISPLAY_ON);
lcd_activation_call_hook();
}
else
lcd_write_command(LCD_SET_DISPLAY_OFF);
}
bool lcd_enabled(void)
bool lcd_active(void)
{
return display_on;
}
#endif
/* LCD init, largely based on what OF does */
void lcd_init_device(void)