Build doom on clipv2 and clip+
[kugel-rb.git] / apps / plugins / lib / helper.c
blobb95ee7ab357bd2172fa519d2dfe7e5468230bbc2
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Peter D'Hoye
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "plugin.h"
23 #include "helper.h"
25 #ifdef CPU_SH
26 /* Lookup table for using the BIT_N() macro in plugins */
27 const unsigned bit_n_table[32] = {
28 1LU<< 0, 1LU<< 1, 1LU<< 2, 1LU<< 3,
29 1LU<< 4, 1LU<< 5, 1LU<< 6, 1LU<< 7,
30 1LU<< 8, 1LU<< 9, 1LU<<10, 1LU<<11,
31 1LU<<12, 1LU<<13, 1LU<<14, 1LU<<15,
32 1LU<<16, 1LU<<17, 1LU<<18, 1LU<<19,
33 1LU<<20, 1LU<<21, 1LU<<22, 1LU<<23,
34 1LU<<24, 1LU<<25, 1LU<<26, 1LU<<27,
35 1LU<<28, 1LU<<29, 1LU<<30, 1LU<<31
37 #endif
39 /* Force the backlight on */
40 void backlight_force_on(void)
42 if (rb->global_settings->backlight_timeout > 0)
43 rb->backlight_set_timeout(0);
44 #if CONFIG_CHARGING
45 if (rb->global_settings->backlight_timeout_plugged > 0)
46 rb->backlight_set_timeout_plugged(0);
47 #endif /* CONFIG_CHARGING */
50 /* Reset backlight operation to its settings */
51 void backlight_use_settings(void)
53 rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
54 #if CONFIG_CHARGING
55 rb->backlight_set_timeout_plugged(rb->global_settings->
56 backlight_timeout_plugged);
57 #endif /* CONFIG_CHARGING */
60 #ifdef HAVE_REMOTE_LCD
61 /* Force the backlight on */
62 void remote_backlight_force_on(void)
64 if (rb->global_settings->remote_backlight_timeout > 0)
65 rb->remote_backlight_set_timeout(0);
66 #if CONFIG_CHARGING
67 if (rb->global_settings->remote_backlight_timeout_plugged > 0)
68 rb->remote_backlight_set_timeout_plugged(0);
69 #endif /* CONFIG_CHARGING */
72 /* Reset backlight operation to its settings */
73 void remote_backlight_use_settings(void)
75 rb->remote_backlight_set_timeout(rb->global_settings->
76 remote_backlight_timeout);
77 #if CONFIG_CHARGING
78 rb->remote_backlight_set_timeout_plugged(rb->global_settings->
79 remote_backlight_timeout_plugged);
80 #endif /* CONFIG_CHARGING */
82 #endif /* HAVE_REMOTE_LCD */
84 #ifdef HAVE_BUTTON_LIGHT
85 /* Force the buttonlight on */
86 void buttonlight_force_on(void)
88 if (rb->global_settings->buttonlight_timeout > 0)
89 rb->buttonlight_set_timeout(0);
92 /* Reset buttonlight operation to its settings */
93 void buttonlight_use_settings(void)
95 rb->buttonlight_set_timeout(rb->global_settings->buttonlight_timeout);
97 #endif /* HAVE_BUTTON_LIGHT */
99 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
100 void backlight_brightness_set(int brightness)
102 rb->backlight_set_brightness(brightness);
105 void backlight_brightness_use_setting(void)
107 rb->backlight_set_brightness(rb->global_settings->brightness);
109 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */