changeset 25:0a44549a64c8

lcdtest: implemented ILI9225G register init for HT020K1QC36S
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 May 2018 02:41:30 +0000
parents 94521a02c33d
children 225556110fa6
files lcdtest/Makefile lcdtest/dispatch.c lcdtest/haoran.c
diffstat 3 files changed, 57 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lcdtest/Makefile	Sat Apr 14 06:43:23 2018 +0000
+++ b/lcdtest/Makefile	Fri May 25 02:41:30 2018 +0000
@@ -1,7 +1,8 @@
 CC=	gcc
 CFLAGS=	-O2
 PROG=	lcdtest
-OBJS=	busops.o commands.o dispatch.o main.o readops.o showppm.o startek.o
+OBJS=	busops.o commands.o dispatch.o haoran.o main.o readops.o showppm.o \
+	startek.o
 
 all:	${PROG}
 
--- a/lcdtest/dispatch.c	Sat Apr 14 06:43:23 2018 +0000
+++ b/lcdtest/dispatch.c	Fri May 25 02:41:30 2018 +0000
@@ -15,6 +15,7 @@
 extern int cmd_wr();
 
 extern int reset_pulse();
+extern int init_haoran();
 extern int init_startek();
 
 cmd_exit()
@@ -32,6 +33,7 @@
 	{"exit", 0, 0, cmd_exit},
 	{"fc", 1, 16, cmd_fc},
 	{"fr", 1, 1, cmd_fr},
+	{"init-ht", 0, 0, init_haoran},
 	{"init-st", 0, 0, init_startek},
 	{"quit", 0, 0, cmd_exit},
 	{"rd", 0, 0, cmd_rd},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lcdtest/haoran.c	Fri May 25 02:41:30 2018 +0000
@@ -0,0 +1,53 @@
+#include <unistd.h>
+
+/*
+ * ILI9225G register init for HaoRan HT020K1QC36S LCD.
+ */
+
+static void
+init_data(addr, data)
+{
+	write_ir(addr);
+	write_dr(data);
+}
+
+init_haoran()
+{
+	init_data(0x0001, 0x011c); // set SS and NL bit
+	init_data(0x0002, 0x0100); // set 1 line inversion
+	init_data(0x0003, 0x1030); // set GRAM write direction and BGR=1.
+	init_data(0x0008, 0x0808); // set BP and FP
+	init_data(0x000F, 0x0901); // Set frame rate
+	usleep(10000);
+	init_data(0x0010, 0x0000); // Set SAP,DSTB,STB
+	init_data(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC
+	usleep(50000);
+	init_data(0x0012, 0x200E); // Internal reference voltage= Vci;
+	init_data(0x0013, 0x0052); // Set GVDD
+	init_data(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage
+	//------------- Set GRAM area ------------------//
+	init_data(0x0030, 0x0000);
+	init_data(0x0031, 0x00DB);
+	init_data(0x0032, 0x0000);
+	init_data(0x0033, 0x0000);
+	init_data(0x0034, 0x00DB);
+	init_data(0x0035, 0x0000);
+	init_data(0x0036, 0x00AF);
+	init_data(0x0037, 0x0000);
+	init_data(0x0038, 0x00DB);
+	init_data(0x0039, 0x0000);
+	// ----------- Adjust the Gamma Curve ----------//
+	init_data(0x0050, 0x0000);
+	init_data(0x0051, 0x0705);
+	init_data(0x0052, 0x0C0A);
+	init_data(0x0053, 0x0401);
+	init_data(0x0054, 0x040C);
+	init_data(0x0055, 0x0608);
+	init_data(0x0056, 0x0000);
+	init_data(0x0057, 0x0104);
+	init_data(0x0058, 0x0E06);
+	init_data(0x0059, 0x060E);
+	usleep(50000);
+	init_data(0x0007, 0x1017);
+	return(0);
+}