diff src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c @ 217:6541e43f88e5

R2D display on/off control implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 24 Apr 2021 23:38:18 +0000
parents
children 0196b6bf633c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c	Sat Apr 24 23:38:18 2021 +0000
@@ -0,0 +1,45 @@
+#include "r2d/lcds/luna/r2d_luna_lcd.h"
+#include "main/sys_types.h"
+#include "armio.h"
+
+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.
+	 */
+	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 backlight on/off */
+	if (on_off)
+		AI_SetBit(9);
+	else
+		AI_ResetBit(9);
+	/* TFT on/off control remains to be implemented */
+}