diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2010-07-22 15:31:24 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2010-07-22 15:31:24 +0000 |
commit | 55a4520f076ffa5190aac1f24f584e759ffc62cf (patch) | |
tree | a7a78f2192dfd05082d8909608be6c029e6627a4 /firmware/target/arm/as3525/lcd-ssd1303.c | |
parent | 10e79de27c6c71360bfe4e740098cb7e6ff64c2a (diff) | |
download | rockbox-55a4520f076ffa5190aac1f24f584e759ffc62cf.tar.gz rockbox-55a4520f076ffa5190aac1f24f584e759ffc62cf.zip |
Sansa clip+: fix display brightness for players with newer OLED controller type (and reorganise the variant detection a bit in the process)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27522 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/lcd-ssd1303.c')
-rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index e0e0715311..213f12a424 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) | 44 | #define LCD_SET_REVERSE_DISPLAY ((char)0xA7) |
45 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) | 45 | #define LCD_SET_MULTIPLEX_RATIO ((char)0xA8) |
46 | #define LCD_SET_DC_DC ((char)0xAD) | 46 | #define LCD_SET_DC_DC ((char)0xAD) |
47 | #define LCD_SET_DC_DC_PART2 ((char)0x8A) | ||
48 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) | 47 | #define LCD_SET_DISPLAY_OFF ((char)0xAE) |
49 | #define LCD_SET_DISPLAY_ON ((char)0xAF) | 48 | #define LCD_SET_DISPLAY_ON ((char)0xAF) |
50 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) | 49 | #define LCD_SET_PAGE_ADDRESS ((char)0xB0) |
@@ -68,6 +67,13 @@ | |||
68 | /** globals **/ | 67 | /** globals **/ |
69 | 68 | ||
70 | static bool display_on; /* used by lcd_enable */ | 69 | static bool display_on; /* used by lcd_enable */ |
70 | |||
71 | /* Display variant, always 0 in clipv1, clipv2, can be 0 or 1 in clip+ | ||
72 | * variant 0: has 132 pixel wide framebuffer, max brightness about 50 | ||
73 | * variant 1: has 128 pixel wide framebuffer, max brightness about 128 | ||
74 | */ | ||
75 | static int variant; | ||
76 | |||
71 | static int offset; /* column offset */ | 77 | static int offset; /* column offset */ |
72 | 78 | ||
73 | /*** hardware configuration ***/ | 79 | /*** hardware configuration ***/ |
@@ -80,6 +86,9 @@ int lcd_default_contrast(void) | |||
80 | void lcd_set_contrast(int val) | 86 | void lcd_set_contrast(int val) |
81 | { | 87 | { |
82 | lcd_write_command(LCD_CNTL_CONTRAST); | 88 | lcd_write_command(LCD_CNTL_CONTRAST); |
89 | if (variant == 1) { | ||
90 | val = val * 5 / 2; | ||
91 | } | ||
83 | lcd_write_command(val); | 92 | lcd_write_command(val); |
84 | } | 93 | } |
85 | 94 | ||
@@ -137,7 +146,8 @@ void lcd_init_device(void) | |||
137 | { | 146 | { |
138 | int i; | 147 | int i; |
139 | 148 | ||
140 | lcd_hw_init(&offset); | 149 | variant = lcd_hw_init(); |
150 | offset = (variant == 0) ? 2 : 0; | ||
141 | 151 | ||
142 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ | 152 | /* Set display clock (divide ratio = 1) and oscillator frequency (1) */ |
143 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); | 153 | lcd_write_command(LCD_SET_DISPLAY_CLOCK_AND_OSC_FREQ); |
@@ -154,9 +164,9 @@ void lcd_init_device(void) | |||
154 | /* Set contrast register to 12% */ | 164 | /* Set contrast register to 12% */ |
155 | lcd_set_contrast(lcd_default_contrast()); | 165 | lcd_set_contrast(lcd_default_contrast()); |
156 | 166 | ||
157 | /* Disable DC-DC */ | 167 | /* Configure DC-DC */ |
158 | lcd_write_command(LCD_SET_DC_DC); | 168 | lcd_write_command(LCD_SET_DC_DC); |
159 | lcd_write_command(LCD_SET_DC_DC_PART2/*|0*/); | 169 | lcd_write_command((variant == 0) ? 0x8A : 0x10); |
160 | 170 | ||
161 | /* Set starting line as 0 */ | 171 | /* Set starting line as 0 */ |
162 | lcd_write_command(LCD_SET_DISPLAY_START_LINE /*|(0 & 0x3f)*/); | 172 | lcd_write_command(LCD_SET_DISPLAY_START_LINE /*|(0 & 0x3f)*/); |