FreeCalypso > hg > freecalypso-hwlab
annotate lunalcd/haoran.c @ 163:5f9dd4056420
vbat-adc/crude-cal-test: an experiment to prove VBAT MADC linearity
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 04 Jun 2021 03:02:18 +0000 |
parents | 286289d551ee |
children |
rev | line source |
---|---|
67
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * ILI9225G register init for HaoRan HT020K1QC36S LCD. |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 static void |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 init_data(addr, data) |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 { |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 write_ir(addr); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 write_dr(data); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 } |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 lcd_init_seq() |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 { |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 init_data(0x0001, 0x011c); // set SS and NL bit |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 init_data(0x0002, 0x0100); // set 1 line inversion |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 init_data(0x0003, 0x1030); // set GRAM write direction and BGR=1. |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 init_data(0x0008, 0x0808); // set BP and FP |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 init_data(0x000F, 0x0901); // Set frame rate |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* usleep(10000); */ |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 init_data(0x0010, 0x0000); // Set SAP,DSTB,STB |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 init_data(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 /* usleep(50000); */ |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 init_data(0x0012, 0x200E); // Internal reference voltage= Vci; |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 init_data(0x0013, 0x0052); // Set GVDD |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 init_data(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 //------------- Set GRAM area ------------------// |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 init_data(0x0030, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 init_data(0x0031, 0x00DB); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 init_data(0x0032, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 init_data(0x0033, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 init_data(0x0034, 0x00DB); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 init_data(0x0035, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 init_data(0x0036, 0x00AF); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 init_data(0x0037, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 init_data(0x0038, 0x00DB); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 init_data(0x0039, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 // ----------- Adjust the Gamma Curve ----------// |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 init_data(0x0050, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 init_data(0x0051, 0x0705); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 init_data(0x0052, 0x0C0A); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 init_data(0x0053, 0x0401); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 init_data(0x0054, 0x040C); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 init_data(0x0055, 0x0608); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 init_data(0x0056, 0x0000); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 init_data(0x0057, 0x0104); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 init_data(0x0058, 0x0E06); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 init_data(0x0059, 0x060E); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 /* usleep(50000); */ |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 init_data(0x0007, 0x1017); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(0); |
286289d551ee
lunalcd: gen-ht-init added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |