summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ipod/lcd-gray.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ipod/lcd-gray.c')
-rw-r--r--firmware/target/arm/ipod/lcd-gray.c32
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 */
73static bool lcd_inverted = false;
74static bool lcd_backlit = false;
75#endif
76
71/* needed for flip */ 77/* needed for flip */
72static int addr_offset; 78static 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
147int lcd_default_contrast(void) 153int 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
174static 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
182void lcd_set_invert_display(bool yesno)
183{
184 lcd_inverted = yesno;
185 invert_display();
186}
187
188void lcd_set_backlight_inversion(bool yesno)
189{
190 lcd_backlit = yesno;
191 invert_display();
192}
193#else
165void lcd_set_invert_display(bool yesno) 194void 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) */
174void lcd_set_flip(bool yesno) 204void lcd_set_flip(bool yesno)