Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

flashlight.c
Monday, February 4th, 2008 at 4:56:35pm UTC 

  1. Index: apps/plugins/CATEGORIES
  2. ===================================================================
  3. --- apps/plugins/CATEGORIES     (Revision 16213)
  4. +++ apps/plugins/CATEGORIES     (Arbeitskopie)
  5. @@ -95,3 +95,4 @@
  6.  wormlet,games
  7.  xobox,games
  8.  zxbox,viewers
  9. +flashlight,apps
  10. Index: apps/plugins/SOURCES
  11. ===================================================================
  12. --- apps/plugins/SOURCES        (Revision 16213)
  13. +++ apps/plugins/SOURCES        (Arbeitskopie)
  14. @@ -21,6 +21,9 @@
  15.  stopwatch.c
  16.  vbrfix.c
  17.  viewer.c
  18. +#ifdef HAVE_BACKLIGHT
  19. +flashlight.c
  20. +#endif /* HAVE_BACKLIGHT */
  21.  
  22.  #ifdef OLYMPUS_MROBE_500
  23.  /* remove these once the plugins before it are compileable */
  24. Index: apps/plugins/flashlight.c
  25. ===================================================================
  26. --- apps/plugins/flashlight.c   (Revision 0)
  27. +++ apps/plugins/flashlight.c   (Revision 0)
  28. @@ -0,0 +1,64 @@
  29. +/***************************************************************************
  30. + *             __________               __   ___.
  31. + *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  32. + *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  33. + *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  34. + *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  35. + *                     \/            \/     \/    \/            \/
  36. + * $ld$
  37. + *
  38. + * Copyright (C) 2007 vmh
  39. + * Copyright (C) 2008 kugel.
  40. + *
  41. + * All files in this archive are subject to the GNU General Public License.
  42. + * See the file COPYING in the source tree root for full license agreement.
  43. + *
  44. + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  45. + * KIND, either express or implied.
  46. + *
  47. + ****************************************************************************/
  48. +
  49. +#include "plugin.h"
  50. +#include "helper.h"
  51. +
  52. +
  53. +PLUGIN_HEADER
  54. +
  55. +static struct plugin_api* rb; /* global api struct pointer */
  56. +/* this is the plugin entry point */
  57. +enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
  58. +{
  59. +    (void)parameter;
  60. +    rb = api;
  61. +#ifdef HAVE_BACKLIGHT_BRIGHTNESS
  62. +    short old_brightness = rb->global_settings->brightness;
  63. +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
  64. +
  65. +#if LCD_DEPTH > 1
  66. +    rb->lcd_set_backdrop(NULL);
  67. +    unsigned bg_color=rb->lcd_get_background()
  68. +    rb->lcd_set_background(LCD_WHITE);   
  69. +#endif
  70. +#ifdef HAVE_BACKLIGHT_BRIGHTNESS
  71. +    rb->backlight_set_brightness(MAX_BRIGHTNESS_SETTING);
  72. +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
  73. +
  74. +    backlight_force_on(rb);
  75. +   
  76. +    /* wait */
  77. +    while(rb->button_get(false)==BUTTON_NONE){ /* press any button to quit */
  78. +      rb->yield();
  79. +    }
  80. +   
  81. +    /* restore */
  82. +    backlight_use_settings(rb);
  83. +
  84. +#ifdef HAVE_BACKLIGHT_BRIGHTNESS
  85. +    rb->backlight_set_brightness(old_brightness);
  86. +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
  87. +
  88. +#if LCD_DEPTH > 1
  89. +    rb->lcd_set_background(bg_color);   
  90. +#endif   
  91. +    return PLUGIN_OK;
  92. +}
  93.  
  94. Eigenschaftsänderungen: apps/plugins/flashlight.c
  95. ___________________________________________________________________
  96. Name: svn:executable
  97.    + *
  98.  
  99. Index: apps/plugin.c
  100. ===================================================================
  101. --- apps/plugin.c       (Revision 16213)
  102. +++ apps/plugin.c       (Arbeitskopie)
  103. @@ -133,6 +133,7 @@
  104.      backlight_on,
  105.      backlight_off,
  106.      backlight_set_timeout,
  107. +
  108.  #if CONFIG_CHARGING
  109.      backlight_set_timeout_plugged,
  110.  #endif
  111. @@ -592,6 +593,10 @@
  112.      dsp_configure,
  113.      dsp_process,
  114.  #endif /* CONFIG_CODEC == SWCODEC */
  115. +
  116. +#ifdef HAVE_BACKLIGHT_BRIGHTNESS
  117. +    backlight_set_brightness,
  118. +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
  119.  };
  120.  
  121.  int plugin_load(const char* plugin, void* parameter)
  122. Index: apps/plugin.h
  123. ===================================================================
  124. --- apps/plugin.h       (Revision 16213)
  125. +++ apps/plugin.h       (Arbeitskopie)
  126. @@ -119,11 +119,15 @@
  127.  #define PLUGIN_MAGIC 0x526F634B /* RocK */
  128.  
  129.  /* increase this every time the api struct changes */
  130. -#define PLUGIN_API_VERSION 99
  131. +#define PLUGIN_API_VERSION 100
  132.  
  133.  /* update this to latest version if a change to the api struct breaks
  134.     backwards compatibility (and please take the opportunity to sort in any
  135. -   new function which are "waiting" at the end of the function table) */
  136. +   new function which are "waiting" at the end of the function table)
  137. +   
  138. +   backlight_set_brightness
  139. +   
  140. +   */
  141.  #define PLUGIN_MIN_API_VERSION 98
  142.  
  143.  /* plugin return codes */
  144. @@ -731,6 +736,10 @@
  145.      int (*dsp_process)(struct dsp_config *dsp, char *dest,
  146.                         const char *src[], int count);
  147.  #endif /* CONFIG_CODEC == SWCODEC */
  148. +
  149. +#ifdef HAVE_BACKLIGHT_BRIGHTNESS
  150. +    void (*backlight_set_brightness)(int val); /* Move this up on the next change to PLUGIN_MIN_API_VERSION */
  151. +#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
  152.  };
  153.  
  154.  /* plugin header */

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right