Index: apps/plugins/CATEGORIES =================================================================== --- apps/plugins/CATEGORIES (Revision 16213) +++ apps/plugins/CATEGORIES (Arbeitskopie) @@ -95,3 +95,4 @@ wormlet,games xobox,games zxbox,viewers +flashlight,apps Index: apps/plugins/SOURCES =================================================================== --- apps/plugins/SOURCES (Revision 16213) +++ apps/plugins/SOURCES (Arbeitskopie) @@ -21,6 +21,9 @@ stopwatch.c vbrfix.c viewer.c +#ifdef HAVE_BACKLIGHT +flashlight.c +#endif /* HAVE_BACKLIGHT */ #ifdef OLYMPUS_MROBE_500 /* remove these once the plugins before it are compileable */ Index: apps/plugins/flashlight.c =================================================================== --- apps/plugins/flashlight.c (Revision 0) +++ apps/plugins/flashlight.c (Revision 0) @@ -0,0 +1,65 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $ld$ + * + * Copyright (C) 2007 Vuong Minh Hiep (vmh) + * Copyright (C) 2008 Thomas Martitz (kugel.) + * + * 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" +#include "helper.h" + + +PLUGIN_HEADER + +static struct plugin_api* rb; /* global api struct pointer */ + +/* this is the plugin entry point */ +enum plugin_status plugin_start(struct plugin_api* api, void* parameter) +{ + (void)parameter; + rb = api; +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + short old_brightness = rb->global_settings->brightness; +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ + +#if LCD_DEPTH > 1 + rb->lcd_set_backdrop(NULL); + unsigned bg_color=rb->lcd_get_background(); + rb->lcd_set_background(LCD_WHITE); +#endif +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + rb->backlight_set_brightness(MAX_BRIGHTNESS_SETTING); +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ + + backlight_force_on(rb); + + /* wait */ + while(rb->button_get(false)==BUTTON_NONE){ /* press any button to quit */ + rb->yield(); + } + + /* restore */ + backlight_use_settings(rb); + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + rb->backlight_set_brightness(old_brightness); +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ + +#if LCD_DEPTH > 1 + rb->lcd_set_background(bg_color); +#endif + return PLUGIN_OK; +} Eigenschaftsänderungen: apps/plugins/flashlight.c ___________________________________________________________________ Name: svn:executable + * Index: apps/plugin.c =================================================================== --- apps/plugin.c (Revision 16213) +++ apps/plugin.c (Arbeitskopie) @@ -133,6 +133,7 @@ backlight_on, backlight_off, backlight_set_timeout, + #if CONFIG_CHARGING backlight_set_timeout_plugged, #endif @@ -592,6 +593,10 @@ dsp_configure, dsp_process, #endif /* CONFIG_CODEC == SWCODEC */ + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + backlight_set_brightness, +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ }; int plugin_load(const char* plugin, void* parameter) Index: apps/plugin.h =================================================================== --- apps/plugin.h (Revision 16213) +++ apps/plugin.h (Arbeitskopie) @@ -119,11 +119,15 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 99 +#define PLUGIN_API_VERSION 100 /* update this to latest version if a change to the api struct breaks 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) + + backlight_set_brightness + + */ #define PLUGIN_MIN_API_VERSION 98 /* plugin return codes */ @@ -217,6 +221,7 @@ void (*backlight_on)(void); void (*backlight_off)(void); void (*backlight_set_timeout)(int index); + #if CONFIG_CHARGING void (*backlight_set_timeout_plugged)(int index); #endif @@ -731,6 +736,10 @@ int (*dsp_process)(struct dsp_config *dsp, char *dest, const char *src[], int count); #endif /* CONFIG_CODEC == SWCODEC */ + +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + void (*backlight_set_brightness)(int val); /* Move this up on the next change to PLUGIN_MIN_API_VERSION */ +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ }; /* plugin header */