forked from len0rd/rockbox
New backlight settings with always-off
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1766 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1330bfbb7c
commit
3ed34a6227
2 changed files with 26 additions and 8 deletions
|
|
@ -59,9 +59,13 @@ static void sort_case(void)
|
||||||
|
|
||||||
static void backlight_timer(void)
|
static void backlight_timer(void)
|
||||||
{
|
{
|
||||||
set_int( "[Backlight]", "s", &global_settings.backlight,
|
char* names[] = { "off", "on ",
|
||||||
backlight_time, 1, 0, 60 );
|
"1s ", "2s ", "3s ", "4s ", "5s ",
|
||||||
backlight_on();
|
"6s ", "7s ", "8s ", "9s ", "10s",
|
||||||
|
"15s", "20s", "25s", "30s", "45s",
|
||||||
|
"60s", "90s"};
|
||||||
|
set_option("[Backlight]", &global_settings.backlight, names, 19 );
|
||||||
|
backlight_time(global_settings.backlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scroll_speed(void)
|
static void scroll_speed(void)
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ static struct event_queue backlight_queue;
|
||||||
static int backlight_timer;
|
static int backlight_timer;
|
||||||
static int backlight_timeout = 5;
|
static int backlight_timeout = 5;
|
||||||
|
|
||||||
|
static char timeout_value[19] =
|
||||||
|
{
|
||||||
|
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 45, 60, 90
|
||||||
|
};
|
||||||
|
|
||||||
void backlight_thread(void)
|
void backlight_thread(void)
|
||||||
{
|
{
|
||||||
struct event ev;
|
struct event ev;
|
||||||
|
|
@ -47,8 +52,17 @@ void backlight_thread(void)
|
||||||
switch(ev.id)
|
switch(ev.id)
|
||||||
{
|
{
|
||||||
case BACKLIGHT_ON:
|
case BACKLIGHT_ON:
|
||||||
backlight_timer = HZ*backlight_timeout;
|
backlight_timer = HZ*timeout_value[backlight_timeout];
|
||||||
if(backlight_timer)
|
if(backlight_timer < 0)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_RTC
|
||||||
|
/* Disable square wave */
|
||||||
|
rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
|
||||||
|
#else
|
||||||
|
PADR |= 0x4000;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if(backlight_timer)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
/* Enable square wave */
|
/* Enable square wave */
|
||||||
|
|
@ -65,7 +79,7 @@ void backlight_thread(void)
|
||||||
rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
|
rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
|
||||||
#else
|
#else
|
||||||
PADR |= 0x4000;
|
PADR |= 0x4000;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYS_USB_CONNECTED:
|
case SYS_USB_CONNECTED:
|
||||||
|
|
@ -91,9 +105,9 @@ void backlight_off(void)
|
||||||
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
queue_post(&backlight_queue, BACKLIGHT_OFF, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_time(int seconds)
|
void backlight_time(int value)
|
||||||
{
|
{
|
||||||
backlight_timeout = seconds;
|
backlight_timeout = value;
|
||||||
backlight_on();
|
backlight_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue