# HG changeset patch # User Mychaela Falconia # Date 1629259214 0 # Node ID a66095c7f35f922102c4e231caab4cb59187f260 # Parent 6c306705f5036adb4d4395fed1c6a206f884476b lunadrv: add suspend and resume commands diff -r 6c306705f503 -r a66095c7f35f target-utils/lunadrv/Makefile --- a/target-utils/lunadrv/Makefile Tue Aug 10 02:31:38 2021 +0000 +++ b/target-utils/lunadrv/Makefile Wed Aug 18 04:00:14 2021 +0000 @@ -7,7 +7,8 @@ INSTDIR=/opt/freecalypso/target-bin PROG= lunadrv -OBJS= crt0.o backlight.o cmdtab.o formike.o haoran.o lcdout.o main.o regcmd.o +OBJS= crt0.o backlight.o cmdtab.o formike.o haoran.o lcdout.o main.o regcmd.o\ + sleep.o LIBS= ../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \ ../libc/libc.a LIBGCC= `${CC} -print-file-name=libgcc.a` diff -r 6c306705f503 -r a66095c7f35f target-utils/lunadrv/cmdtab.c --- a/target-utils/lunadrv/cmdtab.c Tue Aug 10 02:31:38 2021 +0000 +++ b/target-utils/lunadrv/cmdtab.c Wed Aug 18 04:00:14 2021 +0000 @@ -12,6 +12,8 @@ extern void cmd_r32(); extern void cmd_rd(); extern void cmd_rect(); +extern void cmd_resume(); +extern void cmd_suspend(); extern void cmd_w8(); extern void cmd_w16(); extern void cmd_w32(); @@ -44,6 +46,8 @@ {"r32", cmd_r32}, {"rd", cmd_rd}, {"rect", cmd_rect}, + {"resume", cmd_resume}, + {"suspend", cmd_suspend}, {"w8", cmd_w8}, {"w16", cmd_w16}, {"w32", cmd_w32}, diff -r 6c306705f503 -r a66095c7f35f target-utils/lunadrv/sleep.c --- /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 */ +}