Applied FS#5734 by Michael Sevakis (X5 LCD contrast bugfix and
some #define fixup). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10388 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
14313485f7
commit
cc839a2671
6 changed files with 35 additions and 18 deletions
|
@ -240,8 +240,8 @@ static const struct bit_entry rtc_bits[] =
|
||||||
{32 | SIGNED, S_O(resume_seed), -1, NULL, NULL },
|
{32 | SIGNED, S_O(resume_seed), -1, NULL, NULL },
|
||||||
{3, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one,shuffle,ab" },
|
{3, S_O(repeat_mode), REPEAT_ALL, "repeat", "off,all,one,shuffle,ab" },
|
||||||
/* LCD */
|
/* LCD */
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
{6, S_O(contrast), 40, "contrast", NULL },
|
{6, S_O(contrast), DEFAULT_CONTRAST_SETTING, "contrast", NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BACKLIGHT
|
#ifdef CONFIG_BACKLIGHT
|
||||||
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
|
{5, S_O(backlight_timeout), 5, "backlight timeout", backlight_times_conf },
|
||||||
|
@ -1017,7 +1017,7 @@ void settings_apply(void)
|
||||||
|
|
||||||
audio_set_buffer_margin(global_settings.buffer_margin);
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
||||||
|
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
lcd_set_contrast(global_settings.contrast);
|
lcd_set_contrast(global_settings.contrast);
|
||||||
#endif
|
#endif
|
||||||
lcd_scroll_speed(global_settings.scroll_speed);
|
lcd_scroll_speed(global_settings.scroll_speed);
|
||||||
|
@ -1263,7 +1263,7 @@ void settings_load(int which)
|
||||||
RTC_BLOCK_SIZE*8);
|
RTC_BLOCK_SIZE*8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
|
||||||
global_settings.contrast = lcd_default_contrast();
|
global_settings.contrast = lcd_default_contrast();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1728,7 +1728,7 @@ void settings_reset(void) {
|
||||||
global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE);
|
global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE);
|
||||||
global_settings.superbass = sound_default(SOUND_SUPERBASS);
|
global_settings.superbass = sound_default(SOUND_SUPERBASS);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
global_settings.contrast = lcd_default_contrast();
|
global_settings.contrast = lcd_default_contrast();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_REMOTE
|
#ifdef HAVE_LCD_REMOTE
|
||||||
|
|
|
@ -200,6 +200,13 @@ extern unsigned char vp_dummy[VIRT_SIZE];
|
||||||
/* get the string ID from a virtual pointer, -1 if not virtual */
|
/* get the string ID from a virtual pointer, -1 if not virtual */
|
||||||
#define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1)
|
#define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1)
|
||||||
|
|
||||||
|
/* !defined(HAVE_LCD_COLOR) implies HAVE_LCD_CONTRAST with default 40.
|
||||||
|
Explicitly define HAVE_LCD_CONTRAST in config file for newer ports for
|
||||||
|
simplicity. */
|
||||||
|
#if !defined(HAVE_LCD_COLOR)
|
||||||
|
#define HAVE_LCD_CONTRAST
|
||||||
|
#define DEFAULT_CONTRAST_SETTING 40
|
||||||
|
#endif
|
||||||
|
|
||||||
struct user_settings
|
struct user_settings
|
||||||
{
|
{
|
||||||
|
@ -274,7 +281,7 @@ struct user_settings
|
||||||
|
|
||||||
/* device settings */
|
/* device settings */
|
||||||
|
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
int contrast; /* lcd contrast */
|
int contrast; /* lcd contrast */
|
||||||
#endif
|
#endif
|
||||||
bool invert; /* invert display */
|
bool invert; /* invert display */
|
||||||
|
@ -571,10 +578,10 @@ extern long lasttime;
|
||||||
extern const char rec_base_directory[];
|
extern const char rec_base_directory[];
|
||||||
|
|
||||||
/* system defines */
|
/* system defines */
|
||||||
|
|
||||||
#ifdef IAUDIO_X5
|
#ifdef IAUDIO_X5
|
||||||
#define MIN_CONTRAST_SETTING 0
|
#define MIN_CONTRAST_SETTING 1
|
||||||
#define MAX_CONTRAST_SETTING 29
|
#define MAX_CONTRAST_SETTING 30
|
||||||
|
#define DEFAULT_CONTRAST_SETTING 19
|
||||||
#elif defined HAVE_LCD_CHARCELLS
|
#elif defined HAVE_LCD_CHARCELLS
|
||||||
#define MIN_CONTRAST_SETTING 5
|
#define MIN_CONTRAST_SETTING 5
|
||||||
#define MAX_CONTRAST_SETTING 31
|
#define MAX_CONTRAST_SETTING 31
|
||||||
|
|
|
@ -266,7 +266,7 @@ static bool remote_caption_backlight(void)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_REMOTE_LCD */
|
#endif /* HAVE_REMOTE_LCD */
|
||||||
|
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
static bool contrast(void)
|
static bool contrast(void)
|
||||||
{
|
{
|
||||||
return set_int( str(LANG_CONTRAST), "", UNIT_INT,
|
return set_int( str(LANG_CONTRAST), "", UNIT_INT,
|
||||||
|
@ -274,7 +274,7 @@ static bool contrast(void)
|
||||||
lcd_set_contrast, 1, MIN_CONTRAST_SETTING,
|
lcd_set_contrast, 1, MIN_CONTRAST_SETTING,
|
||||||
MAX_CONTRAST_SETTING, NULL );
|
MAX_CONTRAST_SETTING, NULL );
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LCD_COLOR */
|
#endif /* HAVE_LCD_CONTRAST */
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#ifndef HAVE_LCD_COLOR
|
#ifndef HAVE_LCD_COLOR
|
||||||
|
@ -1781,7 +1781,7 @@ static bool lcd_settings_menu(void)
|
||||||
{ ID2P(LANG_BRIGHTNESS), brightness },
|
{ ID2P(LANG_BRIGHTNESS), brightness },
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_BACKLIGHT */
|
#endif /* CONFIG_BACKLIGHT */
|
||||||
#if !defined(HAVE_LCD_COLOR) || defined(IAUDIO_X5)
|
#ifdef HAVE_LCD_CONTRAST
|
||||||
{ ID2P(LANG_CONTRAST), contrast },
|
{ ID2P(LANG_CONTRAST), contrast },
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define LCD_HEIGHT 128
|
#define LCD_HEIGHT 128
|
||||||
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
||||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||||
|
#define HAVE_LCD_CONTRAST
|
||||||
|
|
||||||
/* remote LCD */
|
/* remote LCD */
|
||||||
#define LCD_REMOTE_WIDTH 128
|
#define LCD_REMOTE_WIDTH 128
|
||||||
|
@ -40,6 +41,10 @@
|
||||||
|
|
||||||
#define CONFIG_LCD LCD_X5
|
#define CONFIG_LCD LCD_X5
|
||||||
|
|
||||||
|
#define MIN_CONTRAST_SETTING 1
|
||||||
|
#define MAX_CONTRAST_SETTING 30
|
||||||
|
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||||
|
|
||||||
/* Define this for LCD backlight available */
|
/* Define this for LCD backlight available */
|
||||||
#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */
|
#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */
|
||||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
|
|
|
@ -1045,7 +1045,9 @@ void shutdown_hw(void)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
sleep(HZ/16);
|
sleep(HZ/16);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef IAUDIO_X5
|
||||||
lcd_set_contrast(0);
|
lcd_set_contrast(0);
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
remote_backlight_off();
|
remote_backlight_off();
|
||||||
lcd_remote_set_contrast(0);
|
lcd_remote_set_contrast(0);
|
||||||
|
|
|
@ -139,17 +139,20 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
|
||||||
|
|
||||||
int lcd_default_contrast(void)
|
int lcd_default_contrast(void)
|
||||||
{
|
{
|
||||||
return 16;
|
return DEFAULT_CONTRAST_SETTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_contrast(int val)
|
void lcd_set_contrast(int val)
|
||||||
{
|
{
|
||||||
if (val >= 15) // val must'nt be 15 or 31
|
/* Clamp val in range 0-14, 16-30 */
|
||||||
++val;
|
if (val < 1)
|
||||||
if (val > 30)
|
val = 0;
|
||||||
return;
|
else if (val <= 15)
|
||||||
|
--val;
|
||||||
|
else if (val > 30)
|
||||||
|
val = 30;
|
||||||
|
|
||||||
lcd_write_reg(0x0e, 0x201e + (val << 8));
|
lcd_write_reg(0x0e, 0x2018 + (val << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_set_invert_display(bool yesno)
|
void lcd_set_invert_display(bool yesno)
|
||||||
|
|
Loading…
Reference in a new issue