forked from len0rd/rockbox
Moved lcd default contrast knowledge from settings.c to lcd driver. Now lcd_init sets default contrast until settings are read.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3824 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0ef911d43c
commit
067262dbf0
4 changed files with 34 additions and 32 deletions
|
@ -542,19 +542,6 @@ void settings_apply(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int default_contrast(void)
|
|
||||||
{
|
|
||||||
#ifdef SIMULATOR
|
|
||||||
return 30;
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
return 30;
|
|
||||||
#else
|
|
||||||
return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load settings from disk or RTC RAM
|
* load settings from disk or RTC RAM
|
||||||
*/
|
*/
|
||||||
|
@ -587,7 +574,7 @@ void settings_load(void)
|
||||||
global_settings.invert =
|
global_settings.invert =
|
||||||
config_block[0xa] & 0x40 ? true : false;
|
config_block[0xa] & 0x40 ? true : false;
|
||||||
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
||||||
global_settings.contrast = default_contrast();
|
global_settings.contrast = lcd_default_contrast();
|
||||||
global_settings.show_icons =
|
global_settings.show_icons =
|
||||||
config_block[0xa] & 0x80 ? true : false;
|
config_block[0xa] & 0x80 ? true : false;
|
||||||
}
|
}
|
||||||
|
@ -1414,7 +1401,7 @@ void settings_reset(void) {
|
||||||
global_settings.rec_right_gain = 2; /* 0dB */
|
global_settings.rec_right_gain = 2; /* 0dB */
|
||||||
global_settings.rec_editable = false;
|
global_settings.rec_editable = false;
|
||||||
global_settings.resume = RESUME_ASK;
|
global_settings.resume = RESUME_ASK;
|
||||||
global_settings.contrast = default_contrast();
|
global_settings.contrast = lcd_default_contrast();
|
||||||
global_settings.invert = DEFAULT_INVERT_SETTING;
|
global_settings.invert = DEFAULT_INVERT_SETTING;
|
||||||
global_settings.poweroff = DEFAULT_POWEROFF_SETTING;
|
global_settings.poweroff = DEFAULT_POWEROFF_SETTING;
|
||||||
global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
|
global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING;
|
||||||
|
|
|
@ -278,6 +278,11 @@ bool lcdx_putc(int x, int y, unsigned short ch)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lcd_default_contrast(void)
|
||||||
|
{
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
void lcd_clear_display(void)
|
void lcd_clear_display(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -497,6 +502,8 @@ void lcd_init (void)
|
||||||
pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */
|
pattern_size=3; /* Last pattern, 3 for old LCD, 7 for new LCD */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lcd_set_contrast(lcd_default_contrast());
|
||||||
|
|
||||||
create_thread(scroll_thread, scroll_stack,
|
create_thread(scroll_thread, scroll_stack,
|
||||||
sizeof(scroll_stack), scroll_name);
|
sizeof(scroll_stack), scroll_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "hwcompat.h"
|
||||||
|
|
||||||
/*** definitions ***/
|
/*** definitions ***/
|
||||||
|
|
||||||
|
@ -113,6 +114,15 @@ static unsigned char zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff,
|
static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff};
|
0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
|
int lcd_default_contrast(void)
|
||||||
|
{
|
||||||
|
#ifdef SIMULATOR
|
||||||
|
return 30;
|
||||||
|
#else
|
||||||
|
return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
|
||||||
void lcd_init(void)
|
void lcd_init(void)
|
||||||
|
@ -142,10 +152,7 @@ void lcd_init (void)
|
||||||
lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */
|
lcd_write(true, LCD_SET_SEGMENT_REMAP + 1); /* mirror horizontal: 1 */
|
||||||
lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */
|
lcd_write(true, LCD_SET_COM_OUTPUT_SCAN_DIRECTION + 8); /* mirror vertical: 1 */
|
||||||
lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0);
|
lcd_write(true, LCD_SET_DISPLAY_START_LINE + 0);
|
||||||
#if 0 /* done later, depending on h/w mask bit and settings */
|
lcd_set_contrast(lcd_default_contrast());
|
||||||
lcd_write(true, LCD_SET_CONTRAST_CONTROL_REGISTER);
|
|
||||||
lcd_write(true, 0xF1); /* contrast set to 49/64 */
|
|
||||||
#endif
|
|
||||||
lcd_write(true, LCD_SET_PAGE_ADDRESS);
|
lcd_write(true, LCD_SET_PAGE_ADDRESS);
|
||||||
lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0);
|
lcd_write(true, LCD_SET_LOWER_COLUMN_ADDRESS + 0);
|
||||||
lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0);
|
lcd_write(true, LCD_SET_HIGHER_COLUMN_ADDRESS + 0);
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern void lcd_scroll_speed( int speed );
|
||||||
extern void lcd_scroll_delay( int ms );
|
extern void lcd_scroll_delay( int ms );
|
||||||
extern void lcd_set_contrast(int val);
|
extern void lcd_set_contrast(int val);
|
||||||
extern void lcd_write( bool command, int byte );
|
extern void lcd_write( bool command, int byte );
|
||||||
|
extern int lcd_default_contrast(void);
|
||||||
|
|
||||||
#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
|
#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
|
||||||
extern void lcd_update(void);
|
extern void lcd_update(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue