FreeCalypso > hg > fc-tourmaline
diff src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c @ 277:0196b6bf633c
R2D: LCD hardware suspend implemented for Luna
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 07 Sep 2021 22:18:20 +0000 |
parents | 6541e43f88e5 |
children | 75758d7a9be3 |
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c Tue Sep 07 21:05:38 2021 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c Tue Sep 07 22:18:20 2021 +0000 @@ -2,15 +2,36 @@ #include "main/sys_types.h" #include "armio.h" +static void lcd_suspend(void) +{ + if (r2d_lcd_hw_suspend) + return; /* already in suspend */ + r2d_lcd_hw_suspend = 1; + LCD_REG_WR(0x0007, 0); /* display off */ + rvf_delay(RVF_MS_TO_TICKS(50)); + LCD_REG_WR(0x0010, 1); /* suspend mode */ +} + +static void lcd_resume(void) +{ + if (!r2d_lcd_hw_suspend) + return; /* already on */ + LCD_REG_WR(0x0010, 0); /* out of suspend */ + rvf_delay(RVF_MS_TO_TICKS(50)); + LCD_REG_WR(0x0007, 0x1017); /* display on */ + r2d_lcd_hw_suspend = 0; + r2d_refresh(); +} + static void r2d_onoff_action(enum blrr_display_state set_state) { UBYTE on_off; /* * PWL control: on our current Luna setups (Caramel2 or iWOW DSK) - * PWL is only an indicator LED for developers, but the Mother's - * plan for the dream FreeCalypso handset includes having PWL - * regulate the backlight intensity. + * PWL is only an indicator LED for developers. We use this PWL + * indicator to show the state of "virtual dimming", as there is + * no physical LCD backlight dimming control on Luna. */ switch (set_state) { case BLRR_DISPLAY_OFF: @@ -36,10 +57,12 @@ default: return; /* error, but we are a void function */ } - /* physical backlight on/off */ - if (on_off) + /* physical LCD and backlight on/off */ + if (on_off) { + lcd_resume(); AI_SetBit(9); - else + } else { AI_ResetBit(9); - /* TFT on/off control remains to be implemented */ + lcd_suspend(); + } }