mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
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
This commit is contained in:
parent
07a09041d6
commit
a5d4d67763
6 changed files with 88 additions and 14 deletions
|
@ -132,6 +132,9 @@ static const struct plugin_api rockbox_api = {
|
||||||
backlight_on,
|
backlight_on,
|
||||||
backlight_off,
|
backlight_off,
|
||||||
backlight_set_timeout,
|
backlight_set_timeout,
|
||||||
|
#if CONFIG_CHARGING
|
||||||
|
backlight_set_timeout_plugged,
|
||||||
|
#endif
|
||||||
gui_syncsplash,
|
gui_syncsplash,
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
/* remote lcd */
|
/* remote lcd */
|
||||||
|
|
|
@ -112,12 +112,12 @@
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 71
|
#define PLUGIN_API_VERSION 72
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 71
|
#define PLUGIN_MIN_API_VERSION 72
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -210,6 +210,9 @@ struct plugin_api {
|
||||||
void (*backlight_on)(void);
|
void (*backlight_on)(void);
|
||||||
void (*backlight_off)(void);
|
void (*backlight_off)(void);
|
||||||
void (*backlight_set_timeout)(int index);
|
void (*backlight_set_timeout)(int index);
|
||||||
|
#if CONFIG_CHARGING
|
||||||
|
void (*backlight_set_timeout_plugged)(int index);
|
||||||
|
#endif
|
||||||
void (*splash)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
|
void (*splash)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
|
|
@ -30,3 +30,4 @@ bmp.c
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
pluginlib_actions.c
|
pluginlib_actions.c
|
||||||
|
helper.c
|
||||||
|
|
46
apps/plugins/lib/helper.c
Normal file
46
apps/plugins/lib/helper.c
Normal file
|
@ -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
|
||||||
|
}
|
30
apps/plugins/lib/helper.h
Normal file
30
apps/plugins/lib/helper.h
Normal file
|
@ -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
|
|
@ -104,6 +104,7 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "gray.h"
|
#include "gray.h"
|
||||||
|
#include "helper.h"
|
||||||
|
|
||||||
#include "mpeg2.h"
|
#include "mpeg2.h"
|
||||||
#include "mpeg_settings.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_clear_display();
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
/* make sure the backlight is always on when viewing video
|
backlight_force_on();
|
||||||
(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
|
|
||||||
|
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(true);
|
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);
|
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
|
||||||
|
|
||||||
#ifdef HAVE_BACKLIGHT
|
backlight_use_settings();
|
||||||
/* reset backlight settings */
|
|
||||||
rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue