36#pragma GCC optimize ("O2")
45#define ST7789_SWRST 0x01
46#define ST7789_RDDCOLMOD 0x0C
47#define ST7789_SLPOUT 0x11
48#define ST7789_PTLON 0x12
49#define ST7789_NORON 0x13
50#define ST7789_INVOFF 0x20
51#define ST7789_INVON 0x21
52#define ST7789_DISPON 0x29
53#define ST7789_PTLAR 0x30
54#define ST7789_COLMOD 0x3A
55#define ST7789_WRDISBV 0x51
56#define ST7789_WRCTRLD 0x53
57#define ST7789_WRCACE 0x55
58#define ST7789_WRCABCMB 0x5E
59#define ST7789_RAMCTRL 0xB0
60#define ST7789_PORCTRL 0xB2
61#define ST7789_GCTRL 0xB7
62#define ST7789_VCOMS 0xBB
63#define ST7789_LCMCTRL 0xC0
64#define ST7789_VDVVRHEN 0xC2
65#define ST7789_VRHS 0xC3
66#define ST7789_VDVS 0xC4
67#define ST7789_FRCTRL2 0xC6
68#define ST7789_PWCTRL1 0xD0
69#define ST7789_PVGAMCTRL 0xE0
70#define ST7789_NVGAMCTRL 0xE1
73void ST7789Controller::softReset()
77 writeCommand(ST7789_SWRST);
79 vTaskDelay(150 / portTICK_PERIOD_MS);
84 writeCommand(ST7789_SLPOUT);
85 vTaskDelay(120 / portTICK_PERIOD_MS);
88 writeCommand(ST7789_NORON);
93 writeCommand(ST7789_COLMOD);
95 vTaskDelay(10 / portTICK_PERIOD_MS);
98 writeCommand(ST7789_PORCTRL);
108 writeCommand(ST7789_GCTRL);
113 writeCommand(ST7789_VCOMS);
118 writeCommand(ST7789_LCMCTRL);
123 writeCommand(ST7789_VDVVRHEN);
130 writeCommand(ST7789_VRHS);
135 writeCommand(ST7789_VDVS);
141 writeCommand(ST7789_FRCTRL2);
148 writeCommand(ST7789_PWCTRL1);
153 writeCommand(ST7789_PVGAMCTRL);
170 writeCommand(ST7789_NVGAMCTRL);
187 writeCommand(ST7789_INVON);
190 writeCommand(ST7789_DISPON);
202#define ILI9341_SWRESET 0x01
203#define ILI9341_SLEEPOUT 0x11
204#define ILI9341_NORON 0x13
205#define ILI9341_GAMMASET 0x26
206#define ILI9341_DISPON 0x29
207#define ILI9341_PIXELFORMATSET 0x3A
208#define ILI9341_FRAMERATECTRL1 0xB1
209#define ILI9341_DISPLAYFUNCCTRL 0xB6
210#define ILI9341_POWERCTR1 0xC0
211#define ILI9341_POWERCTR2 0xC1
212#define ILI9341_VCOMCTR1 0xC5
213#define ILI9341_VCOMCTR2 0xC7
214#define ILI9341_POWERCTRLA 0xCB
215#define ILI9341_POWERCTRLB 0xCF
216#define ILI9341_POSGAMMACORR 0xE0
217#define ILI9341_NEGGAMMACORR 0xE1
218#define ILI9341_DRIVERTIMINGCTRLA 0xE8
219#define ILI9341_DRIVERTIMINGCTRLB 0xEA
220#define ILI9341_POWERONSEQCTRL 0xED
221#define ILI9341_DEVICECODE 0xEF
222#define ILI9341_ENABLE3G 0xF2
223#define ILI9341_PUMPRATIOCTRL 0xF7
227void ILI9341Controller::softReset()
229 m_reverseHorizontal =
true;
233 writeCommand(ILI9341_SWRESET);
235 vTaskDelay(150 / portTICK_PERIOD_MS);
240 writeCommand(ILI9341_DEVICECODE);
246 writeCommand(ILI9341_POWERCTRLB);
252 writeCommand(ILI9341_POWERONSEQCTRL);
259 writeCommand(ILI9341_DRIVERTIMINGCTRLA);
265 writeCommand(ILI9341_POWERCTRLA);
273 writeCommand(ILI9341_PUMPRATIOCTRL);
277 writeCommand(ILI9341_DRIVERTIMINGCTRLB);
282 writeCommand(ILI9341_POWERCTR1);
286 writeCommand(ILI9341_POWERCTR2);
290 writeCommand(ILI9341_VCOMCTR1);
295 writeCommand(ILI9341_VCOMCTR2);
301 writeCommand(ILI9341_PIXELFORMATSET);
305 writeCommand(ILI9341_FRAMERATECTRL1);
310 writeCommand(ILI9341_DISPLAYFUNCCTRL);
316 writeCommand(ILI9341_ENABLE3G);
320 writeCommand(ILI9341_GAMMASET);
324 writeCommand(ILI9341_POSGAMMACORR);
342 writeCommand(ILI9341_NEGGAMMACORR);
360 writeCommand(ILI9341_SLEEPOUT);
363 writeCommand(ILI9341_NORON);
367 vTaskDelay(120 / portTICK_PERIOD_MS);
372 writeCommand(ILI9341_DISPON);
This file contains TFT controllers definitions.
This file contains some utility classes and functions.