Skip to content

Commit 04e2bbc

Browse files
committed
Update TFT configuration to 9342C
1 parent e8085b0 commit 04e2bbc

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

src/utility/ILI9342C_Init.h

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
// // This is the command sequence that initialises the ILI9341 driver
3+
// //
4+
// // This setup information uses simple 8 bit SPI writecommand() and writedata() functions
5+
// //
6+
// // See ST7735_Setup.h file for an alternative format
7+
8+
{
9+
writecommand(0xC8);
10+
writedata(0xFF);
11+
writedata(0x93);
12+
writedata(0x42);
13+
14+
writecommand(ILI9341_PWCTR1);
15+
writedata(0x12);
16+
writedata(0x12);
17+
18+
writecommand(ILI9341_PWCTR2);
19+
writedata(0x03);
20+
21+
writecommand(0xB0);
22+
writedata(0xE0);
23+
24+
writecommand(0xF6);
25+
writedata(0x00);
26+
writedata(0x01);
27+
writedata(0x01);
28+
29+
writecommand(ILI9341_MADCTL); // Memory Access Control
30+
#ifdef M5STACK
31+
writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); // Rotation 0 (portrait mode)
32+
#else
33+
writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); // Rotation 0 (portrait mode)
34+
#endif
35+
36+
writecommand(ILI9341_PIXFMT);
37+
writedata(0x55);
38+
39+
writecommand(ILI9341_DFUNCTR); // Display Function Control
40+
writedata(0x08);
41+
writedata(0x82);
42+
writedata(0x27);
43+
44+
writecommand(ILI9341_GMCTRP1); //Set Gamma
45+
writedata(0x00);
46+
writedata(0x0C);
47+
writedata(0x11);
48+
writedata(0x04);
49+
writedata(0x11);
50+
writedata(0x08);
51+
writedata(0x37);
52+
writedata(0x89);
53+
writedata(0x4C);
54+
writedata(0x06);
55+
writedata(0x0C);
56+
writedata(0x0A);
57+
writedata(0x2E);
58+
writedata(0x34);
59+
writedata(0x0F);
60+
61+
writecommand(ILI9341_GMCTRN1); //Set Gamma
62+
writedata(0x00);
63+
writedata(0x0B);
64+
writedata(0x11);
65+
writedata(0x05);
66+
writedata(0x13);
67+
writedata(0x09);
68+
writedata(0x33);
69+
writedata(0x67);
70+
writedata(0x48);
71+
writedata(0x07);
72+
writedata(0x0E);
73+
writedata(0x0B);
74+
writedata(0x2E);
75+
writedata(0x33);
76+
writedata(0x0F);
77+
78+
writecommand(ILI9341_SLPOUT); //Exit Sleep
79+
80+
spi_end();
81+
delay(120);
82+
spi_begin();
83+
84+
writecommand(ILI9341_DISPON); //Display on
85+
86+
}

src/utility/In_eSPI.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,12 @@ void TFT_eSPI::init(uint8_t tc)
389389

390390
// This loads the driver specific initialisation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
391391
#if defined (ILI9341_DRIVER)
392+
if (lcd_version) {
393+
#include "ILI9342C_Init.h"
394+
395+
} else {
392396
#include "ILI9341_Init.h"
397+
}
393398

394399
#elif defined (ST7735_DRIVER)
395400
tabcolor = tc;

0 commit comments

Comments
 (0)