diff target-utils/lunadrv/sleep.c @ 849:a66095c7f35f

lunadrv: add suspend and resume commands
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 18 Aug 2021 04:00:14 +0000
parents
children 57f7db8c4f45
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/lunadrv/sleep.c	Wed Aug 18 04:00:14 2021 +0000
@@ -0,0 +1,27 @@
+/*
+ * This module implements suspend and resume commands for entering
+ * and exiting ILI9225G sleep mode.  These commands are expected
+ * to work the same on both HaoRan and Formike LCDs, but the
+ * current measurement resistor that allows one to see the actual
+ * power supply current drawn by the LCD is present only on lunalcd2
+ * boards.
+ */
+
+#include "types.h"
+#include "luna.h"
+
+void
+cmd_suspend()
+{
+	LCD_REG_WR(0x0007, 0);			/* display off */
+	wait_ARM_cycles(DELAY_1MS * 50);
+	LCD_REG_WR(0x0010, 1);			/* suspend mode */
+}
+
+void
+cmd_resume()
+{
+	LCD_REG_WR(0x0010, 0);			/* out of suspend */
+	wait_ARM_cycles(DELAY_1MS * 50);
+	LCD_REG_WR(0x0007, 0x1017);		/* display on */
+}