From b1079200d34b197a9ea0ec649168b0a307ee9517 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 27 Feb 2003 14:22:30 +0000 Subject: New option: Invert display. Patch by Mark Hillebrand. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3355 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 5 +++++ apps/settings.c | 15 +++++++++++---- apps/settings.h | 4 +++- apps/settings_menu.c | 10 ++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index a3b98487ab..62cf492abc 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -1404,3 +1404,8 @@ id: LANG_SOKOBAN_ON desc: how to undo move eng: "[ON] To Undo" new: + +id: LANG_INVERT +desc: in settings_menu +eng: "Invert" +new: diff --git a/apps/settings.c b/apps/settings.c index 2bb2e97ab3..7019319fb3 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -82,7 +82,7 @@ offset abs 0x07 0x1b 0x08 0x1c 0x09 0x1d -0x0a 0x1e +0x0a 0x1e 0x0b 0x1f 0x0c 0x20 0x0d 0x21 @@ -297,7 +297,9 @@ int settings_save( void ) config_block[0x8] = (unsigned char)global_settings.loudness; 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) ((global_settings.backlight_on_when_charging?0x40:0) | @@ -482,6 +484,7 @@ void settings_apply(void) set_battery_capacity(global_settings.battery_capacity); #ifdef HAVE_LCD_BITMAP + lcd_set_invert_display(global_settings.invert); settings_apply_pm_range(); peak_meter_init_times( 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]; 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 ) global_settings.contrast = DEFAULT_CONTRAST_SETTING; } @@ -1066,6 +1071,7 @@ void settings_reset(void) { global_settings.rec_right_gain = 2; /* 0dB */ global_settings.resume = RESUME_ASK; global_settings.contrast = DEFAULT_CONTRAST_SETTING; + global_settings.invert = DEFAULT_INVERT_SETTING; global_settings.poweroff = DEFAULT_POWEROFF_SETTING; global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; global_settings.backlight_on_when_charging = @@ -1132,8 +1138,9 @@ void settings_display(void) global_settings.loudness, 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.invert, global_settings.poweroff, global_settings.backlight_timeout ); #endif diff --git a/apps/settings.h b/apps/settings.h index 6f127e05dc..6c383f9976 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -77,7 +77,8 @@ struct user_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 backlight_timeout; /* backlight off timeout: 0-18 0=never, 1=always, @@ -189,6 +190,7 @@ extern char rockboxdir[]; #define DEFAULT_CONTRAST_SETTING 38 #endif #define MIN_CONTRAST_SETTING 5 +#define DEFAULT_INVERT_SETTING false #define DEFAULT_POWEROFF_SETTING 0 #define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5 #define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0 diff --git a/apps/settings_menu.c b/apps/settings_menu.c index e931fe63bc..d82053caa9 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -51,6 +51,15 @@ static bool contrast(void) #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 */ @@ -724,6 +733,7 @@ static bool display_settings_menu(void) { str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, { str(LANG_CONTRAST), contrast }, #ifdef HAVE_LCD_BITMAP + { str(LANG_INVERT), invert }, { str(LANG_PM_MENU), peak_meter_menu }, { str(LANG_VOLUME_DISPLAY), volume_type }, { str(LANG_BATTERY_DISPLAY), battery_type }, -- cgit v1.2.3