diff options
| author | Peter D'Hoye <peter.dhoye@gmail.com> | 2007-08-13 22:31:11 +0000 |
|---|---|---|
| committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2007-08-13 22:31:11 +0000 |
| commit | a5d4d67763a01f27453ae453c73e2bc4695131f9 (patch) | |
| tree | 4c15a114b24ba96ec7f9096b06051c9d2f55c625 /apps/plugins | |
| parent | 07a09041d6ca8c84280e9f9b372e8cc0eeb8166e (diff) | |
| download | rockbox-a5d4d67763a01f27453ae453c73e2bc4695131f9.zip rockbox-a5d4d67763a01f27453ae453c73e2bc4695131f9.tar.gz rockbox-a5d4d67763a01f27453ae453c73e2bc4695131f9.tar.bz2 rockbox-a5d4d67763a01f27453ae453c73e2bc4695131f9.tar.xz | |
Also keep the backlight on in mpegplayer when plugged in. Fixes FS #7584. Created two helper functions for this, because this issue also exists in other plugins (to do). The helper functions are in the pluginlib in helper.[ch], where other common stuff can be put.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14321 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/lib/SOURCES | 1 | ||||
| -rw-r--r-- | apps/plugins/lib/helper.c | 46 | ||||
| -rw-r--r-- | apps/plugins/lib/helper.h | 30 | ||||
| -rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 15 |
4 files changed, 80 insertions, 12 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 88d362a..f671184 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -30,3 +30,4 @@ bmp.c #endif #endif pluginlib_actions.c +helper.c diff --git a/apps/plugins/lib/helper.c b/apps/plugins/lib/helper.c new file mode 100644 index 0000000..cf1877d --- /dev/null +++ b/apps/plugins/lib/helper.c @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: helper.c 12179 2007-08-14 23:08:15Z peter $ + * + * Copyright (C) 2007 by Peter D'Hoye + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "plugin.h" + +/* the plugin must declare the plugin_api struct pointer itself */ +extern struct plugin_api* rb; + +/* force the backlight on */ +void backlight_force_on(void) +{ +#ifdef HAVE_BACKLIGHT + rb->backlight_set_timeout(1); +#if CONFIG_CHARGING + rb->backlight_set_timeout_plugged(1); +#endif +#endif +} + +/* reset backlight operation to its settings */ +void backlight_use_settings(void) +{ +#ifdef HAVE_BACKLIGHT + rb->backlight_set_timeout(rb->global_settings->backlight_timeout); +#if CONFIG_CHARGING + rb->backlight_set_timeout_plugged(rb->global_settings-> \ + backlight_timeout_plugged); +#endif +#endif +} diff --git a/apps/plugins/lib/helper.h b/apps/plugins/lib/helper.h new file mode 100644 index 0000000..abeac59 --- /dev/null +++ b/apps/plugins/lib/helper.h @@ -0,0 +1,30 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: helper.h 10254 2007-08-14 19:44:44Z peter $ + * + * Copyright (C) 2007 by Peter D'Hoye + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _LIB_HELPER_H_ +#define _LIB_HELPER_H_ + +#include "plugin.h" + +/** + * Backlight on/off operations + */ +void backlight_force_on(void); +void backlight_use_settings(void); + +#endif diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 273e01b..f4da970 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -104,6 +104,7 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz #include "plugin.h" #include "gray.h" +#include "helper.h" #include "mpeg2.h" #include "mpeg_settings.h" @@ -1856,14 +1857,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_clear_display(); rb->lcd_update(); - /* make sure the backlight is always on when viewing video - (actually it should also set the timeout when plugged in, - but the function backlight_set_timeout_plugged is not - available in plugins) */ -#ifdef HAVE_BACKLIGHT - if (rb->global_settings->backlight_timeout > 0) - rb->backlight_set_timeout(1); -#endif + backlight_force_on(); #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(true); @@ -2000,10 +1994,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->pcm_set_frequency(HW_SAMPR_DEFAULT); -#ifdef HAVE_BACKLIGHT - /* reset backlight settings */ - rb->backlight_set_timeout(rb->global_settings->backlight_timeout); -#endif + backlight_use_settings(); return status; } |