summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config-iaudiox5.h5
-rw-r--r--firmware/powermgmt.c2
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c17
3 files changed, 17 insertions, 7 deletions
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 21fa636f0c..ae48eb6dbe 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -22,6 +22,7 @@
22#define LCD_HEIGHT 128 22#define LCD_HEIGHT 128
23#define LCD_DEPTH 16 /* pseudo 262.144 colors */ 23#define LCD_DEPTH 16 /* pseudo 262.144 colors */
24#define LCD_PIXELFORMAT RGB565 /* rgb565 */ 24#define LCD_PIXELFORMAT RGB565 /* rgb565 */
25#define HAVE_LCD_CONTRAST
25 26
26/* remote LCD */ 27/* remote LCD */
27#define LCD_REMOTE_WIDTH 128 28#define LCD_REMOTE_WIDTH 128
@@ -40,6 +41,10 @@
40 41
41#define CONFIG_LCD LCD_X5 42#define CONFIG_LCD LCD_X5
42 43
44#define MIN_CONTRAST_SETTING 1
45#define MAX_CONTRAST_SETTING 30
46#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
47
43/* Define this for LCD backlight available */ 48/* Define this for LCD backlight available */
44#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */ 49#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled !?!? */
45#define HAVE_BACKLIGHT_BRIGHTNESS 50#define HAVE_BACKLIGHT_BRIGHTNESS
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index ee01fd862d..4bccd4e211 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -1045,7 +1045,9 @@ void shutdown_hw(void)
1045 lcd_update(); 1045 lcd_update();
1046 sleep(HZ/16); 1046 sleep(HZ/16);
1047#endif 1047#endif
1048#ifndef IAUDIO_X5
1048 lcd_set_contrast(0); 1049 lcd_set_contrast(0);
1050#endif
1049#ifdef HAVE_REMOTE_LCD 1051#ifdef HAVE_REMOTE_LCD
1050 remote_backlight_off(); 1052 remote_backlight_off();
1051 lcd_remote_set_contrast(0); 1053 lcd_remote_set_contrast(0);
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 7c155eac8f..c06521ef54 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -139,17 +139,20 @@ inline void lcd_write_data(const unsigned short* p_bytes, int count)
139 139
140int lcd_default_contrast(void) 140int lcd_default_contrast(void)
141{ 141{
142 return 16; 142 return DEFAULT_CONTRAST_SETTING;
143} 143}
144 144
145void lcd_set_contrast(int val) 145void lcd_set_contrast(int val)
146{ 146{
147 if (val >= 15) // val must'nt be 15 or 31 147 /* Clamp val in range 0-14, 16-30 */
148 ++val; 148 if (val < 1)
149 if (val > 30) 149 val = 0;
150 return; 150 else if (val <= 15)
151 151 --val;
152 lcd_write_reg(0x0e, 0x201e + (val << 8)); 152 else if (val > 30)
153 val = 30;
154
155 lcd_write_reg(0x0e, 0x2018 + (val << 8));
153} 156}
154 157
155void lcd_set_invert_display(bool yesno) 158void lcd_set_invert_display(bool yesno)