FreeCalypso > hg > freecalypso-hwlab
changeset 20:2e4f27ea7067
lcdtest: init-st command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 10 Apr 2018 23:55:42 +0000 |
parents | f3671d3ad953 |
children | 1d8c499711f1 |
files | lcdtest/Makefile lcdtest/dispatch.c lcdtest/init.c |
diffstat | 3 files changed, 52 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lcdtest/Makefile Tue Apr 10 23:37:19 2018 +0000 +++ b/lcdtest/Makefile Tue Apr 10 23:55:42 2018 +0000 @@ -1,7 +1,7 @@ CC= gcc CFLAGS= -O2 PROG= lcdtest -OBJS= busops.o commands.o dispatch.o main.o readops.o showppm.o +OBJS= busops.o commands.o dispatch.o init.o main.o readops.o showppm.o all: ${PROG}
--- a/lcdtest/dispatch.c Tue Apr 10 23:37:19 2018 +0000 +++ b/lcdtest/dispatch.c Tue Apr 10 23:55:42 2018 +0000 @@ -7,6 +7,7 @@ extern int cmd_cd(); extern int cmd_fc(); extern int cmd_fr(); +extern int cmd_init_st(); extern int cmd_rd(); extern int cmd_ri(); extern int cmd_show(); @@ -31,6 +32,7 @@ {"exit", 0, 0, cmd_exit}, {"fc", 1, 16, cmd_fc}, {"fr", 1, 1, cmd_fr}, + {"init-st", 0, 0, cmd_init_st}, {"quit", 0, 0, cmd_exit}, {"rd", 0, 0, cmd_rd}, {"reset", 0, 0, reset_pulse},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lcdtest/init.c Tue Apr 10 23:55:42 2018 +0000 @@ -0,0 +1,49 @@ +/* + * ST7775R register init, same for Crystalfontz CFAF176220U-020T + * and Startek KD020C-2A. + */ + +cmd_init_st() +{ + /* basic settings */ + write_ir(0x01); + write_dr(0x011C); + write_ir(0x02); + write_dr(0x0100); + write_ir(0x03); + write_dr(0x1030); + write_ir(0x0F); + write_dr(0x0001); + write_ir(0x10); + write_dr(0x0000); + write_ir(0x11); + write_dr(0x1000); + /* gamma control registers */ + write_ir(0x50); + write_dr(0x0203); + write_ir(0x51); + write_dr(0x0A09); + write_ir(0x52); + write_dr(0x0005); + write_ir(0x53); + write_dr(0x1021); + write_ir(0x54); + write_dr(0x0602); + write_ir(0x55); + write_dr(0x0003); + write_ir(0x56); + write_dr(0x0703); + write_ir(0x57); + write_dr(0x0507); + write_ir(0x58); + write_dr(0x1021); + write_ir(0x59); + write_dr(0x0703); + /* VCOM */ + write_ir(0xB0); + write_dr(0x2501); + /* turn it on! */ + write_ir(0x07); + write_dr(0x1017); + return(0); +}