FreeCalypso > hg > freecalypso-hwlab
annotate lcdtest/haoran.c @ 26:225556110fa6
lcdtest: beginning of reorg for adding lcdphone program
| author | Mychaela Falconia <falcon@freecalypso.org> | 
|---|---|
| date | Sun, 27 May 2018 21:36:07 +0000 | 
| parents | 0a44549a64c8 | 
| children | 
| rev | line source | 
|---|---|
| 25 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 1 #include <unistd.h> | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 2 | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 3 /* | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 4 * ILI9225G register init for HaoRan HT020K1QC36S LCD. | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 5 */ | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 6 | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 7 static void | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 8 init_data(addr, data) | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 9 { | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 10 write_ir(addr); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 11 write_dr(data); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 12 } | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 13 | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 14 init_haoran() | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 15 { | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 16 init_data(0x0001, 0x011c); // set SS and NL bit | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 17 init_data(0x0002, 0x0100); // set 1 line inversion | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 18 init_data(0x0003, 0x1030); // set GRAM write direction and BGR=1. | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 19 init_data(0x0008, 0x0808); // set BP and FP | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 20 init_data(0x000F, 0x0901); // Set frame rate | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 21 usleep(10000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 22 init_data(0x0010, 0x0000); // Set SAP,DSTB,STB | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 23 init_data(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 24 usleep(50000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 25 init_data(0x0012, 0x200E); // Internal reference voltage= Vci; | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 26 init_data(0x0013, 0x0052); // Set GVDD | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 27 init_data(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 28 //------------- Set GRAM area ------------------// | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 29 init_data(0x0030, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 30 init_data(0x0031, 0x00DB); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 31 init_data(0x0032, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 32 init_data(0x0033, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 33 init_data(0x0034, 0x00DB); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 34 init_data(0x0035, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 35 init_data(0x0036, 0x00AF); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 36 init_data(0x0037, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 37 init_data(0x0038, 0x00DB); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 38 init_data(0x0039, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 39 // ----------- Adjust the Gamma Curve ----------// | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 40 init_data(0x0050, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 41 init_data(0x0051, 0x0705); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 42 init_data(0x0052, 0x0C0A); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 43 init_data(0x0053, 0x0401); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 44 init_data(0x0054, 0x040C); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 45 init_data(0x0055, 0x0608); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 46 init_data(0x0056, 0x0000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 47 init_data(0x0057, 0x0104); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 48 init_data(0x0058, 0x0E06); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 49 init_data(0x0059, 0x060E); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 50 usleep(50000); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 51 init_data(0x0007, 0x1017); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 52 return(0); | 
| 
0a44549a64c8
lcdtest: implemented ILI9225G register init for HT020K1QC36S
 Mychaela Falconia <falcon@freecalypso.org> parents: diff
changeset | 53 } | 
