Lamp plugin: accept the reduced patch of FS #8934 by Alexander Papst

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17425 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2008-05-08 21:23:31 +00:00
parent 7835a20347
commit 21a3733888
5 changed files with 56 additions and 2 deletions

View file

@ -590,6 +590,14 @@ static const struct plugin_api rockbox_api = {
#ifdef HAVE_TOUCHPAD
touchpad_set_mode,
#endif /* HAVE_TOUCHPAD */
#ifdef HAVE_BUTTON_LIGHT
buttonlight_set_timeout,
buttonlight_off,
buttonlight_on,
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
buttonlight_set_brightness,
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* HAVE_BUTTON_LIGHT */
};
int plugin_load(const char* plugin, void* parameter)

View file

@ -737,6 +737,14 @@ struct plugin_api {
#ifdef HAVE_TOUCHPAD
void (*touchpad_set_mode)(enum touchpad_mode);
#endif /* HAVE_TOUCHPAD */
#ifdef HAVE_BUTTON_LIGHT
void (*buttonlight_set_timeout)(int value);
void (*buttonlight_off)(void);
void (*buttonlight_on)(void);
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
void (*buttonlight_set_brightness)(int val);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#endif /* HAVE_BUTTON_LIGHT */
};
/* plugin header */

View file

@ -115,6 +115,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
short old_brightness = rb->global_settings->brightness;
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
short old_buttonlight_brightness =
rb->global_settings->buttonlight_brightness;
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#if LCD_DEPTH > 1
unsigned bg_color=rb->lcd_get_background();
@ -125,6 +129,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
rb->backlight_set_brightness(MAX_BRIGHTNESS_SETTING);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
rb->buttonlight_set_brightness(MAX_BRIGHTNESS_SETTING);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#ifdef HAVE_LCD_INVERT
#ifdef OLYMPUS_MROBE_100
@ -136,9 +143,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#endif /* HAVE_LCD_INVERT */
backlight_force_on(rb);
#ifdef HAVE_BUTTON_LIGHT
buttonlight_force_on(rb);
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_COLOR
do
do
{
if(cs < 0)
cs = NUM_COLORSETS-1;
@ -198,6 +208,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* restore */
backlight_use_settings(rb);
#ifdef HAVE_BUTTON_LIGHT
buttonlight_use_settings(rb);
#endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_LCD_INVERT
rb->lcd_set_invert_display(rb->global_settings->invert);
@ -206,6 +219,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
rb->backlight_set_brightness(old_brightness);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
rb->buttonlight_set_brightness(old_buttonlight_brightness);
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
#if LCD_DEPTH > 1
rb->lcd_set_background(bg_color);

View file

@ -72,3 +72,22 @@ void remote_backlight_use_settings(struct plugin_api* rb)
#endif /* CONFIG_CHARGING */
}
#endif /* HAVE_REMOTE_LCD */
#ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */
void buttonlight_force_on(struct plugin_api* rb)
{
if (!rb)
return;
if (rb->global_settings->buttonlight_timeout > 0)
rb->buttonlight_set_timeout(0);
}
/* Reset buttonlight operation to its settings */
void buttonlight_use_settings(struct plugin_api* rb)
{
if (!rb)
return;
rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout);
}
#endif /* HAVE_BUTTON_LIGHT */

View file

@ -30,5 +30,8 @@ void backlight_use_settings(struct plugin_api* rb);
void remote_backlight_force_on(struct plugin_api* rb);
void remote_backlight_use_settings(struct plugin_api* rb);
#endif
#ifdef HAVE_BUTTON_LIGHT
void buttonlight_force_on(struct plugin_api* rb);
void buttonlight_use_settings(struct plugin_api* rb);
#endif
#endif