summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2008-05-08 21:23:31 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2008-05-08 21:23:31 +0000
commit21a373388833b8f4f7284cff16d48cab7857de2f (patch)
tree65b423f62c89a66ec7d408121d2be2087a7093fe /apps
parent7835a203473cff4255c1703349fd42ce08b61a46 (diff)
downloadrockbox-21a373388833b8f4f7284cff16d48cab7857de2f.tar.gz
rockbox-21a373388833b8f4f7284cff16d48cab7857de2f.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c8
-rw-r--r--apps/plugin.h8
-rw-r--r--apps/plugins/lamp.c18
-rw-r--r--apps/plugins/lib/helper.c19
-rw-r--r--apps/plugins/lib/helper.h5
5 files changed, 56 insertions, 2 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 6c6be901f3..230013e127 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -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)
diff --git a/apps/plugin.h b/apps/plugin.h
index 8839271f43..d4c6a862ce 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -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 */
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index c755219378..943cc97fce 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -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);
diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c
index 3af60b5473..8ac822b407 100644
--- a/apps/plugins/lib/helper.c
+++ b/apps/plugins/lib/helper.c
@@ -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 */
diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h
index 744ad4dbd3..4d1328bd0c 100644
--- a/apps/plugins/lib/helper.h
+++ b/apps/plugins/lib/helper.h
@@ -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