1
0
Fork 0
forked from len0rd/rockbox

Contrast setting cleanup: * Only include contrast setting for targets where it's used. * Make lcd_default_contrast() a stub for simulators.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10317 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-07-25 11:15:50 +00:00
parent 7136fd9bb6
commit 9051afa8a0
9 changed files with 43 additions and 41 deletions

View file

@ -240,7 +240,9 @@ static const struct bit_entry rtc_bits[] =
{32 | SIGNED, S_O(resume_seed), -1, NULL, NULL },
{3, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one,shuffle,ab" },
/* LCD */
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
{6, S_O(contrast), 40, "contrast", NULL },
#endif
#ifdef CONFIG_BACKLIGHT
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
#ifdef CONFIG_CHARGING
@ -1015,7 +1017,9 @@ void settings_apply(void)
audio_set_buffer_margin(global_settings.buffer_margin);
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
lcd_set_contrast(global_settings.contrast);
#endif
lcd_scroll_speed(global_settings.scroll_speed);
#ifdef HAVE_REMOTE_LCD
lcd_remote_set_contrast(global_settings.remote_contrast);
@ -1259,8 +1263,10 @@ void settings_load(int which)
RTC_BLOCK_SIZE*8);
}
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
global_settings.contrast = lcd_default_contrast();
#endif
i = 0xb8;
strncpy((char *)global_settings.wps_file, (char *)&config_block[i],
@ -1722,7 +1728,9 @@ void settings_reset(void) {
global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE);
global_settings.superbass = sound_default(SOUND_SUPERBASS);
#endif
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
global_settings.contrast = lcd_default_contrast();
#endif
#ifdef HAVE_LCD_REMOTE
global_settings.remote_contrast = lcd_remote_default_contrast();
#endif

View file

@ -274,7 +274,9 @@ struct user_settings
/* device settings */
int contrast; /* lcd contrast: 0-63 0=low 63=high */
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
int contrast; /* lcd contrast */
#endif
bool invert; /* invert display */
bool invert_cursor; /* invert the current file in dir browser and menu
instead of using the default cursor */
@ -573,16 +575,13 @@ extern const char rec_base_directory[];
#ifdef IAUDIO_X5
#define MIN_CONTRAST_SETTING 0
#define MAX_CONTRAST_SETTING 29
#else
#ifdef HAVE_LCD_CHARCELLS
#define MAX_CONTRAST_SETTING 31
#define DEFAULT_CONTRAST_SETTING 30
#else
#define MAX_CONTRAST_SETTING 63
#define DEFAULT_CONTRAST_SETTING 38
#endif
#elif defined HAVE_LCD_CHARCELLS
#define MIN_CONTRAST_SETTING 5
#endif // X5
#define MAX_CONTRAST_SETTING 31
#else
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
#endif
/* argument bits for settings_load() */
#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */

View file

@ -72,14 +72,6 @@ static const char scroll_tick_table[16] = {
100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3
};
#ifndef TARGET_TREE
/* probably just a dummy */
int lcd_default_contrast(void)
{
return 28;
}
#endif
/* LCD init */
void lcd_init(void)
{

View file

@ -79,15 +79,6 @@ void lcd_init(void)
sizeof(scroll_stack), scroll_name);
}
int lcd_default_contrast(void)
{
#if defined(IPOD_MINI) || defined(IPOD_MINI2G)
return 42;
#else
return 35;
#endif
}
/*** parameter handling ***/
void lcd_set_drawmode(int mode)

View file

@ -102,13 +102,13 @@ static const char scroll_tick_table[16] = {
/*** hardware configuration ***/
#ifndef SIMULATOR
int lcd_default_contrast(void)
{
return 28;
}
#ifndef SIMULATOR
void lcd_set_contrast(int val)
{
lcd_write_command_ex(LCD_CNTL_ELECTRONIC_VOLUME, val, -1);

View file

@ -146,6 +146,15 @@ void lcd_init_device(void)
/*** hardware configuration ***/
int lcd_default_contrast(void)
{
#if defined(IPOD_MINI) || defined(IPOD_MINI2G)
return 42;
#else
return 35;
#endif
}
/* Rockbox stores the contrast as 0..63 - we add 64 to it */
void lcd_set_contrast(int val)
{

View file

@ -274,11 +274,6 @@ bool lcdx_putc(int x, int y, unsigned short ch)
return false;
}
int lcd_default_contrast(void)
{
return 30;
}
void lcd_clear_display(void)
{
int i;
@ -483,6 +478,11 @@ void lcd_icon(int icon, bool enable)
lcd_write_data(&icon_mirror[pos], 1);
}
int lcd_default_contrast(void)
{
return 30;
}
void lcd_set_contrast(int val)
{
lcd_data_byte = (unsigned char) (31 - val);

View file

@ -157,11 +157,11 @@ void lcd_write_data( const unsigned char* data, int count )
/*** hardware configuration ***/
#ifndef SIMULATOR
int lcd_default_contrast(void)
{
#ifdef SIMULATOR
return 30;
#elif CONFIG_LCD == LCD_GMINI100
#if CONFIG_LCD == LCD_GMINI100
return 31;
#elif CONFIG_LCD == LCD_IFP7XX
return 45;
@ -170,8 +170,6 @@ int lcd_default_contrast(void)
#endif
}
#ifndef SIMULATOR
void lcd_set_contrast(int val)
{
lcd_write_command(LCD_CNTL_CONTRAST);

View file

@ -53,9 +53,9 @@ void lcd_set_invert_display(bool invert)
(void)invert;
}
void lcd_remote_set_invert_display(bool invert)
int lcd_default_contrast(void)
{
(void)invert;
return 28;
}
#ifdef HAVE_REMOTE_LCD
@ -76,4 +76,9 @@ void lcd_remote_set_flip(bool yesno)
{
(void)yesno;
}
void lcd_remote_set_invert_display(bool invert)
{
(void)invert;
}
#endif