diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-07-27 12:05:54 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-07-27 12:05:54 +0000 |
commit | 021c0868dd6a9ac01f01db36a7b08cf7ad6737df (patch) | |
tree | 635d37509ce564e05b2065511912e7a436163510 /firmware/target/arm/ipod/lcd-gray.c | |
parent | b701322fea42c809092f50e252f45ddfc38293c3 (diff) | |
download | rockbox-021c0868dd6a9ac01f01db36a7b08cf7ad6737df.tar.gz rockbox-021c0868dd6a9ac01f01db36a7b08cf7ad6737df.zip |
iPod 2nd gen: * Fake battery voltage of 4.00V so rockbox doesn't shutdown (ADC is not yet implemented). * Fix button hold polarity for main rockbox. * Implement backlight inversion (the 1st/2nd gen backlight works in a way that makes the LCD look inverted when active). * Fix default contrast and clean up target tree.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14022 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ipod/lcd-gray.c')
-rw-r--r-- | firmware/target/arm/ipod/lcd-gray.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index 0a3a4ae797..7a60eb6470 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c | |||
@@ -68,6 +68,12 @@ static inline bool timer_check(int clock_start, int usecs) | |||
68 | #define R_RAM_ADDR_SET 0x11 | 68 | #define R_RAM_ADDR_SET 0x11 |
69 | #define R_RAM_DATA 0x12 | 69 | #define R_RAM_DATA 0x12 |
70 | 70 | ||
71 | #ifdef HAVE_BACKLIGHT_INVERSION | ||
72 | /* The backlight makes the LCD appear negative on the 1st/2nd gen */ | ||
73 | static bool lcd_inverted = false; | ||
74 | static bool lcd_backlit = false; | ||
75 | #endif | ||
76 | |||
71 | /* needed for flip */ | 77 | /* needed for flip */ |
72 | static int addr_offset; | 78 | static int addr_offset; |
73 | #if defined(IPOD_MINI) || defined(IPOD_MINI2G) | 79 | #if defined(IPOD_MINI) || defined(IPOD_MINI2G) |
@@ -146,7 +152,9 @@ void lcd_init_device(void) | |||
146 | 152 | ||
147 | int lcd_default_contrast(void) | 153 | int lcd_default_contrast(void) |
148 | { | 154 | { |
149 | #if defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G) | 155 | #ifdef IPOD_1G2G |
156 | return 28; | ||
157 | #elif defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G) | ||
150 | return 42; | 158 | return 42; |
151 | #else | 159 | #else |
152 | return 35; | 160 | return 35; |
@@ -162,6 +170,27 @@ void lcd_set_contrast(int val) | |||
162 | lcd_cmd_and_data(R_CONTRAST_CONTROL, 0x400 | (val + 64)); | 170 | lcd_cmd_and_data(R_CONTRAST_CONTROL, 0x400 | (val + 64)); |
163 | } | 171 | } |
164 | 172 | ||
173 | #ifdef HAVE_BACKLIGHT_INVERSION | ||
174 | static void invert_display(void) | ||
175 | { | ||
176 | if (lcd_inverted ^ lcd_backlit) | ||
177 | lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0023); | ||
178 | else | ||
179 | lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009); | ||
180 | } | ||
181 | |||
182 | void lcd_set_invert_display(bool yesno) | ||
183 | { | ||
184 | lcd_inverted = yesno; | ||
185 | invert_display(); | ||
186 | } | ||
187 | |||
188 | void lcd_set_backlight_inversion(bool yesno) | ||
189 | { | ||
190 | lcd_backlit = yesno; | ||
191 | invert_display(); | ||
192 | } | ||
193 | #else | ||
165 | void lcd_set_invert_display(bool yesno) | 194 | void lcd_set_invert_display(bool yesno) |
166 | { | 195 | { |
167 | if (yesno) | 196 | if (yesno) |
@@ -169,6 +198,7 @@ void lcd_set_invert_display(bool yesno) | |||
169 | else | 198 | else |
170 | lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009); | 199 | lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009); |
171 | } | 200 | } |
201 | #endif | ||
172 | 202 | ||
173 | /* turn the display upside down (call lcd_update() afterwards) */ | 203 | /* turn the display upside down (call lcd_update() afterwards) */ |
174 | void lcd_set_flip(bool yesno) | 204 | void lcd_set_flip(bool yesno) |