New option: Invert display. Patch by Mark Hillebrand.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3355 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2003-02-27 14:22:30 +00:00
parent 8856b86519
commit b1079200d3
6 changed files with 38 additions and 6 deletions

View file

@ -1404,3 +1404,8 @@ id: LANG_SOKOBAN_ON
desc: how to undo move desc: how to undo move
eng: "[ON] To Undo" eng: "[ON] To Undo"
new: new:
id: LANG_INVERT
desc: in settings_menu
eng: "Invert"
new:

View file

@ -82,7 +82,7 @@ offset abs
0x07 0x1b <treble byte> 0x07 0x1b <treble byte>
0x08 0x1c <loudness byte> 0x08 0x1c <loudness byte>
0x09 0x1d <bass boost byte> 0x09 0x1d <bass boost byte>
0x0a 0x1e <contrast byte> 0x0a 0x1e <contrast (bit 0-5), invert bit (bit 6)>
0x0b 0x1f <backlight_on_when_charging, backlight_timeout> 0x0b 0x1f <backlight_on_when_charging, backlight_timeout>
0x0c 0x20 <poweroff timer byte> 0x0c 0x20 <poweroff timer byte>
0x0d 0x21 <resume settings byte> 0x0d 0x21 <resume settings byte>
@ -297,7 +297,9 @@ int settings_save( void )
config_block[0x8] = (unsigned char)global_settings.loudness; config_block[0x8] = (unsigned char)global_settings.loudness;
config_block[0x9] = (unsigned char)global_settings.bass_boost; config_block[0x9] = (unsigned char)global_settings.bass_boost;
config_block[0xa] = (unsigned char)global_settings.contrast; config_block[0xa] = (unsigned char)
((global_settings.contrast & 0x3f) |
(global_settings.invert ? 0x40 : 0));
config_block[0xb] = (unsigned char) config_block[0xb] = (unsigned char)
((global_settings.backlight_on_when_charging?0x40:0) | ((global_settings.backlight_on_when_charging?0x40:0) |
@ -482,6 +484,7 @@ void settings_apply(void)
set_battery_capacity(global_settings.battery_capacity); set_battery_capacity(global_settings.battery_capacity);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
lcd_set_invert_display(global_settings.invert);
settings_apply_pm_range(); settings_apply_pm_range();
peak_meter_init_times( peak_meter_init_times(
global_settings.peak_meter_release, global_settings.peak_meter_hold, global_settings.peak_meter_release, global_settings.peak_meter_hold,
@ -550,7 +553,9 @@ void settings_load(void)
global_settings.bass_boost = config_block[0x9]; global_settings.bass_boost = config_block[0x9];
if (config_block[0xa] != 0xFF) { if (config_block[0xa] != 0xFF) {
global_settings.contrast = config_block[0xa]; global_settings.contrast = config_block[0xa] & 0x3f;
global_settings.invert =
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_SETTING; global_settings.contrast = DEFAULT_CONTRAST_SETTING;
} }
@ -1066,6 +1071,7 @@ void settings_reset(void) {
global_settings.rec_right_gain = 2; /* 0dB */ global_settings.rec_right_gain = 2; /* 0dB */
global_settings.resume = RESUME_ASK; global_settings.resume = RESUME_ASK;
global_settings.contrast = DEFAULT_CONTRAST_SETTING; global_settings.contrast = DEFAULT_CONTRAST_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;
global_settings.backlight_on_when_charging = global_settings.backlight_on_when_charging =
@ -1132,8 +1138,9 @@ void settings_display(void)
global_settings.loudness, global_settings.loudness,
global_settings.bass_boost ); global_settings.bass_boost );
DEBUGF( "contrast:\t%d\npoweroff:\t%d\nbacklight_timeout:\t%d\n", DEBUGF( "contrast:\t%d\ninvert:\t%d\npoweroff:\t%d\nbacklight_timeout:\t%d\n",
global_settings.contrast, global_settings.contrast,
global_settings.invert,
global_settings.poweroff, global_settings.poweroff,
global_settings.backlight_timeout ); global_settings.backlight_timeout );
#endif #endif

View file

@ -77,7 +77,8 @@ struct user_settings
/* device settings */ /* device settings */
int contrast; /* lcd contrast: 0-100 0=low 100=high */ int contrast; /* lcd contrast: 0-63 0=low 63=high */
bool invert; /* invert display */
int poweroff; /* power off timer */ int poweroff; /* power off timer */
int backlight_timeout; /* backlight off timeout: 0-18 0=never, int backlight_timeout; /* backlight off timeout: 0-18 0=never,
1=always, 1=always,
@ -189,6 +190,7 @@ extern char rockboxdir[];
#define DEFAULT_CONTRAST_SETTING 38 #define DEFAULT_CONTRAST_SETTING 38
#endif #endif
#define MIN_CONTRAST_SETTING 5 #define MIN_CONTRAST_SETTING 5
#define DEFAULT_INVERT_SETTING false
#define DEFAULT_POWEROFF_SETTING 0 #define DEFAULT_POWEROFF_SETTING 0
#define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5 #define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5
#define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0 #define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0

View file

@ -51,6 +51,15 @@ static bool contrast(void)
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
static bool invert(void)
{
char* names[] = { str(LANG_SET_BOOL_NO),
str(LANG_SET_BOOL_YES) };
return set_option( str(LANG_INVERT), &global_settings.invert,
names, 2, lcd_set_invert_display );
}
/** /**
* Menu to configure the battery display on status bar * Menu to configure the battery display on status bar
*/ */
@ -724,6 +733,7 @@ static bool display_settings_menu(void)
{ str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, { str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
{ str(LANG_CONTRAST), contrast }, { str(LANG_CONTRAST), contrast },
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
{ str(LANG_INVERT), invert },
{ str(LANG_PM_MENU), peak_meter_menu }, { str(LANG_PM_MENU), peak_meter_menu },
{ str(LANG_VOLUME_DISPLAY), volume_type }, { str(LANG_VOLUME_DISPLAY), volume_type },
{ str(LANG_BATTERY_DISPLAY), battery_type }, { str(LANG_BATTERY_DISPLAY), battery_type },

View file

@ -194,6 +194,14 @@ void lcd_set_contrast(int val)
lcd_write(true, val); lcd_write(true, val);
} }
void lcd_set_invert_display(bool yesno)
{
if (yesno)
lcd_write(true, LCD_SET_REVERSE_DISPLAY);
else
lcd_write(true, LCD_SET_NORMAL_DISPLAY);
}
/** /**
* Rolls up the lcd display by the specified amount of lines. * Rolls up the lcd display by the specified amount of lines.
* Lines that are rolled out over the top of the screen are * Lines that are rolled out over the top of the screen are

View file

@ -122,7 +122,7 @@ extern void lcd_drawpixel(int x, int y);
extern void lcd_clearpixel(int x, int y); extern void lcd_clearpixel(int x, int y);
extern void lcd_invertpixel(int x, int y); extern void lcd_invertpixel(int x, int y);
extern void lcd_roll(int pixels); extern void lcd_roll(int pixels);
extern void lcd_set_invert_display(bool yesno);
extern void lcd_bidir_scroll(int threshold); extern void lcd_bidir_scroll(int threshold);
extern void lcd_scroll_step(int pixels); extern void lcd_scroll_step(int pixels);
extern void lcd_setfont(int font); extern void lcd_setfont(int font);