Rename _buttonlight_timeout and use a function call instead of extern'ing buttonlight_timeout to be more inline with backlight, and use a #define instead of a const variable for !HAVE_LCD_SLEEP_SETTING (no functional changes)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20784 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-04-25 18:15:50 +00:00
parent 67fb5415f7
commit 0017dfbe82
3 changed files with 14 additions and 9 deletions

View file

@ -49,9 +49,6 @@
#define BACKLIGHT_FULL_INIT #define BACKLIGHT_FULL_INIT
#endif #endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
int backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
#endif
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \ #if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG) || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
@ -135,6 +132,9 @@ static struct event_queue backlight_queue;
static unsigned int backlight_thread_id = 0; static unsigned int backlight_thread_id = 0;
#endif #endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
int backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
#endif
static int backlight_timer SHAREDBSS_ATTR; static int backlight_timer SHAREDBSS_ATTR;
static int backlight_timeout SHAREDBSS_ATTR; static int backlight_timeout SHAREDBSS_ATTR;
static int backlight_timeout_normal = 5*HZ; static int backlight_timeout_normal = 5*HZ;
@ -147,12 +147,12 @@ static int backlight_on_button_hold = 0;
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
static int buttonlight_timer; static int buttonlight_timer;
int _buttonlight_timeout = 5*HZ; static int buttonlight_timeout = 5*HZ;
/* Update state of buttonlight according to timeout setting */ /* Update state of buttonlight according to timeout setting */
static void buttonlight_update_state(void) static void buttonlight_update_state(void)
{ {
buttonlight_timer = _buttonlight_timeout; buttonlight_timer = buttonlight_timeout;
/* Buttonlight == OFF in the setting? */ /* Buttonlight == OFF in the setting? */
if (buttonlight_timer < 0) if (buttonlight_timer < 0)
@ -178,10 +178,15 @@ void buttonlight_off(void)
void buttonlight_set_timeout(int value) void buttonlight_set_timeout(int value)
{ {
_buttonlight_timeout = HZ * value; buttonlight_timeout = HZ * value;
queue_post(&backlight_queue, BUTTON_LIGHT_TMO_CHANGED, 0); queue_post(&backlight_queue, BUTTON_LIGHT_TMO_CHANGED, 0);
} }
int buttonlight_get_current_timeout(void)
{
return buttonlight_timeout;
}
#endif /* HAVE_BUTTON_LIGHT */ #endif /* HAVE_BUTTON_LIGHT */
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
@ -205,7 +210,7 @@ const signed char lcd_sleep_timeout_value[10] =
static int lcd_sleep_timeout = 10*HZ; static int lcd_sleep_timeout = 10*HZ;
#else #else
/* Target defines needed value */ /* Target defines needed value */
static const int lcd_sleep_timeout = LCD_SLEEP_TIMEOUT; #define lcd_sleep_timeout LCD_SLEEP_TIMEOUT
#endif #endif
static int lcd_sleep_timer SHAREDDATA_ATTR = 0; static int lcd_sleep_timer SHAREDDATA_ATTR = 0;

View file

@ -95,7 +95,7 @@ void buttonlight_set_timeout(int value);
/* Private API for use in target tree backlight code only */ /* Private API for use in target tree backlight code only */
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
extern int _buttonlight_timeout; int buttonlight_get_current_timeout(void);
#endif #endif
#endif /* BACKLIGHT_H */ #endif /* BACKLIGHT_H */

View file

@ -388,7 +388,7 @@ void _buttonlight_on(void)
void _buttonlight_off(void) void _buttonlight_off(void)
{ {
#ifndef BOOTLOADER #ifndef BOOTLOADER
if(_buttonlight_timeout>0) if(buttonlight_get_current_timeout() > 0)
__buttonlight_dim(true); __buttonlight_dim(true);
else else
#endif #endif