summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c')
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
index bfa02e796d..640f6694c9 100644
--- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
@@ -159,22 +159,43 @@ void lcd_set_flip(bool yesno)
159 } 159 }
160} 160}
161 161
162#ifdef HAVE_LCD_ENABLE
163static void (*lcd_activation_hook)(void) = NULL;
164
165void lcd_activation_set_hook(void (*func)(void))
166{
167 lcd_activation_hook = func;
168}
169
170void lcd_activation_call_hook(void)
171{
172 void (*func)(void) = lcd_activation_hook;
173
174 if (func != NULL)
175 func();
176}
177
178
162void lcd_enable(bool enable) 179void lcd_enable(bool enable)
163{ 180{
164 if(display_on == enable) 181 if(display_on == enable)
165 return; 182 return;
166 183
167 if( (display_on = enable) ) /* simple '=' is not a typo ! */ 184 if( (display_on = enable) ) /* simple '=' is not a typo ! */
185 {
168 lcd_write_command(LCD_SET_DISPLAY_ON); 186 lcd_write_command(LCD_SET_DISPLAY_ON);
187 lcd_activation_call_hook();
188 }
169 else 189 else
170 lcd_write_command(LCD_SET_DISPLAY_OFF); 190 lcd_write_command(LCD_SET_DISPLAY_OFF);
171} 191}
172 192
173bool lcd_enabled(void) 193bool lcd_active(void)
174{ 194{
175 return display_on; 195 return display_on;
176} 196}
177 197
198#endif
178 199
179/* LCD init, largely based on what OF does */ 200/* LCD init, largely based on what OF does */
180void lcd_init_device(void) 201void lcd_init_device(void)