1
0
Fork 0
forked from len0rd/rockbox

Accepted FS #5772 by Michael Sevakis

1. X5 lcd sleep
2. #define HAVE_LCD_ENABLE
3. add "backlight (on hold switch)" setting, adapted from FS #5735

Note that the while(1) yield ==> asm("halt") part is NOT commited here,
I prefer it would be discussed separately.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10489 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rani Hod 2006-08-08 22:03:56 +00:00
parent f8866a3a9c
commit c9f59e6f75
17 changed files with 644 additions and 211 deletions

View file

@ -8805,6 +8805,62 @@
</dest>
<voice>
*: "(Vol- : Re-enable)"
<phrase>
id: LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL
desc: in lcd settings
user:
<source>
*: "Normal"
</source>
<dest>
*: "Normal"
</dest>
<voice>
*: "Normal"
</voice>
</phrase>
<phrase>
id: LANG_BACKLIGHT_ON_BUTTON_HOLD
desc: in lcd settings
user:
<source>
*: "Backlight (On Hold Key)"
</source>
<dest>
*: "Backlight (On Hold Key)"
</dest>
<voice>
*: "Backlight on hold key"
</voice>
</phrase>
<phrase>
id: LANG_NEVER
desc: in lcd settings
user:
<source>
*: "Never"
</source>
<dest>
*: "Never"
</dest>
<voice>
*: "Never"
</voice>
</phrase>
<phrase>
id: LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF
desc: In display settings, time to switch LCD chip into power saving state
user:
<source>
*: "Sleep (After Backlight Off)"
</source>
<dest>
*: "Sleep (After Backlight Off)"
</dest>
<voice>
*: "Sleep after backlight off"
</voice>
</phrase>
</voice>
</phrase>
<phrase>

View file

@ -491,6 +491,9 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
{
FOR_NB_SCREENS(i)
screens[i].clear_display();
#ifdef X5_BACKLIGHT_SHUTDOWN
x5_backlight_shutdown();
#endif
gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN));
if (!tagcache_prepare_shutdown())

View file

@ -24,11 +24,11 @@
#include "config.h"
#include "kernel.h"
#include "thread.h"
#include "button.h"
#include "settings.h"
#include "disk.h"
#include "panic.h"
#include "debug.h"
#include "button.h"
#include "usb.h"
#include "backlight.h"
#include "lcd.h"
@ -40,7 +40,6 @@
#include "ata.h"
#include "fat.h"
#include "power.h"
#include "backlight.h"
#include "powermgmt.h"
#include "status.h"
#include "atoi.h"
@ -244,7 +243,7 @@ static const struct bit_entry rtc_bits[] =
{6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL },
#endif
#ifdef CONFIG_BACKLIGHT
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
{5, S_O(backlight_timeout), 6, "backlight timeout", backlight_times_conf },
#ifdef CONFIG_CHARGING
{5, S_O(backlight_timeout_plugged), 11, "backlight timeout plugged",
backlight_times_conf },
@ -296,7 +295,7 @@ static const struct bit_entry rtc_bits[] =
{6, S_O(remote_contrast), 42, "remote contrast", NULL },
{1, S_O(remote_invert), false, "remote invert", off_on },
{1, S_O(remote_flip_display), false, "remote flip display", off_on },
{5, S_O(remote_backlight_timeout), 5, "remote backlight timeout",
{5, S_O(remote_backlight_timeout), 6, "remote backlight timeout",
backlight_times_conf },
#ifdef CONFIG_CHARGING
{5, S_O(remote_backlight_timeout_plugged), 11,
@ -319,8 +318,7 @@ static const struct bit_entry rtc_bits[] =
{1, S_O(remote_bl_filter_first_keypress), false,
"backlight filters first remote keypress", off_on },
#endif
#endif
#endif /* CONFIG_BACKLIGHT */
/* new stuff to be added here */
/* If values are just added to the end, no need to bump the version. */
@ -574,6 +572,20 @@ static const struct bit_entry hd_bits[] =
{1, S_O(warnon_erase_dynplaylist), false,
"warn when erasing dynamic playlist", off_on },
#ifdef CONFIG_BACKLIGHT
#ifdef HAS_BUTTON_HOLD
{2, S_O(backlight_on_button_hold), 0, "backlight on button hold",
"normal,off,on" },
#endif
#ifdef HAVE_LCD_SLEEP
{4, S_O(lcd_sleep_after_backlight_off), 3,
"lcd sleep after backlight off",
"always,never,5,10,15,20,30,45,60,90" },
#endif
#endif /* CONFIG_BACKLIGHT */
/* If values are just added to the end, no need to bump the version. */
/* new stuff to be added at the end */
@ -1183,7 +1195,13 @@ void settings_apply(void)
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
#ifdef HAVE_LCD_SLEEP
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* CONFIG_BACKLIGHT */
}

View file

@ -531,7 +531,13 @@ struct user_settings
#ifdef HAVE_REMOTE_LCD
bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
#endif
#ifdef HAS_BUTTON_HOLD
int backlight_on_button_hold;
#endif
#ifdef HAVE_LCD_SLEEP
int lcd_sleep_after_backlight_off;
#endif
#endif /* CONFIG_BACKLIGHT */
#ifdef HAVE_LCD_BITMAP
unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */

View file

@ -196,6 +196,21 @@ static bool backlight_timer(void)
backlight_set_timeout );
}
#ifdef HAS_BUTTON_HOLD
static bool backlight_on_button_hold(void)
{
static const struct opt_items names[3] = {
{ STR(LANG_BACKLIGHT_ON_BUTTON_HOLD_NORMAL) },
{ STR(LANG_OFF) },
{ STR(LANG_ON) },
};
return set_option(str(LANG_BACKLIGHT_ON_BUTTON_HOLD),
&global_settings.backlight_on_button_hold,
INT, names, 3,
backlight_set_on_button_hold);
}
#endif /* HAS_BUTTON_HOLD */
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
static bool backlight_fade_in(void)
{
@ -227,6 +242,29 @@ static bool backlight_fade_out(void)
INT, names, 8, backlight_set_fade_out );
}
#endif
#ifdef HAVE_LCD_SLEEP
static bool lcd_sleep_after_backlight_off(void)
{
static const struct opt_items names[] = {
{ STR(LANG_ALWAYS) },
{ STR(LANG_NEVER) },
{ (unsigned char *)"5s", TALK_ID(5, UNIT_SEC) },
{ (unsigned char *)"10s", TALK_ID(10, UNIT_SEC) },
{ (unsigned char *)"15s", TALK_ID(15, UNIT_SEC) },
{ (unsigned char *)"20s", TALK_ID(20, UNIT_SEC) },
{ (unsigned char *)"30s", TALK_ID(30, UNIT_SEC) },
{ (unsigned char *)"45s", TALK_ID(45, UNIT_SEC) },
{ (unsigned char *)"60s", TALK_ID(60, UNIT_SEC) },
{ (unsigned char *)"90s", TALK_ID(90, UNIT_SEC) },
};
return set_option(str(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF),
&global_settings.lcd_sleep_after_backlight_off,
INT, names, 10,
lcd_set_sleep_after_backlight_off );
}
#endif /* HAVE_LCD_SLEEP */
#endif /* CONFIG_BACKLIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
@ -257,7 +295,7 @@ static bool remote_backlight_timer_plugged(void)
INT, backlight_timeouts, 19,
remote_backlight_set_timeout_plugged );
}
#endif
#endif /* HAVE_REMOTE_LCD */
static bool remote_caption_backlight(void)
{
@ -1770,6 +1808,9 @@ static bool lcd_settings_menu(void)
{ ID2P(LANG_BACKLIGHT), backlight_timer },
#ifdef CONFIG_CHARGING
{ ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_timer_plugged },
#endif
#ifdef HAS_BUTTON_HOLD
{ ID2P(LANG_BACKLIGHT_ON_BUTTON_HOLD), backlight_on_button_hold },
#endif
{ ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
@ -1777,6 +1818,9 @@ static bool lcd_settings_menu(void)
{ ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
#endif
{ ID2P(LANG_BACKLIGHT_FILTER_FIRST_KEYPRESS), set_bl_filter_first_keypress },
#ifdef HAVE_LCD_SLEEP
{ ID2P(LANG_LCD_SLEEP_AFTER_BACKLIGHT_OFF), lcd_sleep_after_backlight_off },
#endif
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
{ ID2P(LANG_BRIGHTNESS), brightness },
#endif