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.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c
index 9538d277af..131b52da96 100644
--- a/firmware/target/arm/ipod/lcd-gray.c
+++ b/firmware/target/arm/ipod/lcd-gray.c
@@ -126,10 +126,9 @@ void lcd_init_device(void)
126 lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48); 126 lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48);
127 /* C waveform, no EOR, 9 lines inversion */ 127 /* C waveform, no EOR, 9 lines inversion */
128 lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); 128 lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc);
129 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
129#ifdef HAVE_BACKLIGHT_INVERSION 130#ifdef HAVE_BACKLIGHT_INVERSION
130 invert_display(); 131 invert_display();
131#else
132 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
133#endif 132#endif
134 lcd_set_flip(false); 133 lcd_set_flip(false);
135 lcd_cmd_and_data(R_ENTRY_MODE, 0x0000); 134 lcd_cmd_and_data(R_ENTRY_MODE, 0x0000);
@@ -162,10 +161,16 @@ void lcd_set_contrast(int val)
162#ifdef HAVE_BACKLIGHT_INVERSION 161#ifdef HAVE_BACKLIGHT_INVERSION
163static void invert_display(void) 162static void invert_display(void)
164{ 163{
165 if (lcd_inverted ^ lcd_backlit) 164 static bool last_invert = false;
166 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0017); 165 bool new_invert = lcd_inverted ^ lcd_backlit;
167 else 166
168 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015); 167 if (new_invert != last_invert)
168 {
169 int oldlevel = disable_irq_save();
170 lcd_cmd_and_data(R_DISPLAY_CONTROL, new_invert? 0x0017 : 0x0015);
171 restore_irq(oldlevel);
172 last_invert = new_invert;
173 }
169} 174}
170 175
171void lcd_set_invert_display(bool yesno) 176void lcd_set_invert_display(bool yesno)
@@ -182,10 +187,7 @@ void lcd_set_backlight_inversion(bool yesno)
182#else 187#else
183void lcd_set_invert_display(bool yesno) 188void lcd_set_invert_display(bool yesno)
184{ 189{
185 if (yesno) 190 lcd_cmd_and_data(R_DISPLAY_CONTROL, yesno ? 0x0017 : 0x0015);
186 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0017);
187 else
188 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
189} 191}
190#endif 192#endif
191 193