FreeCalypso > hg > fc-tourmaline
view src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c @ 296:a927f030a4e0
add AT@VIBR and AT@VIBS commands for testing VIBR SWE
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Mar 2022 00:43:11 +0000 |
parents | 75758d7a9be3 |
children |
line wrap: on
line source
#include "r2d/lcds/luna/r2d_luna_lcd.h" #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 */ ABB_sleep_allowed = 1; } static void lcd_resume(void) { if (!r2d_lcd_hw_suspend) return; /* already on */ ABB_sleep_allowed = 0; 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. 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: *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; *(volatile SYS_UWORD8 *)0xFFFE8001 = 0; on_off = 0; break; case BLRR_DISPLAY_ON: *(volatile SYS_UWORD8 *)0xFFFE8000 = 255; *(volatile SYS_UWORD8 *)0xFFFE8001 = 1; on_off = 1; break; case BLRR_DISPLAY_INCALL: *(volatile SYS_UWORD8 *)0xFFFE8000 = 16; *(volatile SYS_UWORD8 *)0xFFFE8001 = 1; on_off = 1; break; case BLRR_DISPLAY_CHG_BOOT: *(volatile SYS_UWORD8 *)0xFFFE8000 = 64; *(volatile SYS_UWORD8 *)0xFFFE8001 = 1; on_off = 1; break; default: return; /* error, but we are a void function */ } /* physical LCD and backlight on/off */ if (on_off) { lcd_resume(); AI_SetBit(9); } else { AI_ResetBit(9); lcd_suspend(); } }