ESPHome  2024.9.2
ili9xxx_defines.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace esphome {
4 namespace ili9xxx {
5 
6 // Color definitions
7 // clang-format off
8 static const uint8_t MADCTL_MY = 0x80;
9 static const uint8_t MADCTL_MX = 0x40;
10 static const uint8_t MADCTL_MV = 0x20;
11 static const uint8_t MADCTL_ML = 0x10;
12 static const uint8_t MADCTL_RGB = 0x00;
13 static const uint8_t MADCTL_BGR = 0x08;
14 static const uint8_t MADCTL_MH = 0x04;
15 // clang-format on
16 
17 // All ILI9XXX specific commands some are used by init()
18 static const uint8_t ILI9XXX_NOP = 0x00;
19 static const uint8_t ILI9XXX_SWRESET = 0x01;
20 static const uint8_t ILI9XXX_RDDID = 0x04;
21 static const uint8_t ILI9XXX_RDDST = 0x09;
22 
23 static const uint8_t ILI9XXX_SLPIN = 0x10;
24 static const uint8_t ILI9XXX_SLPOUT = 0x11;
25 static const uint8_t ILI9XXX_PTLON = 0x12;
26 static const uint8_t ILI9XXX_NORON = 0x13;
27 
28 static const uint8_t ILI9XXX_RDMODE = 0x0A;
29 static const uint8_t ILI9XXX_RDMADCTL = 0x0B;
30 static const uint8_t ILI9XXX_RDPIXFMT = 0x0C;
31 static const uint8_t ILI9XXX_RDIMGFMT = 0x0D;
32 static const uint8_t ILI9XXX_RDSELFDIAG = 0x0F;
33 
34 static const uint8_t ILI9XXX_INVOFF = 0x20;
35 static const uint8_t ILI9XXX_INVON = 0x21;
36 static const uint8_t ILI9XXX_GAMMASET = 0x26;
37 static const uint8_t ILI9XXX_DISPOFF = 0x28;
38 static const uint8_t ILI9XXX_DISPON = 0x29;
39 
40 static const uint8_t ILI9XXX_CASET = 0x2A;
41 static const uint8_t ILI9XXX_PASET = 0x2B;
42 static const uint8_t ILI9XXX_RAMWR = 0x2C;
43 static const uint8_t ILI9XXX_RAMRD = 0x2E;
44 
45 static const uint8_t ILI9XXX_PTLAR = 0x30;
46 static const uint8_t ILI9XXX_VSCRDEF = 0x33;
47 static const uint8_t ILI9XXX_MADCTL = 0x36;
48 static const uint8_t ILI9XXX_VSCRSADD = 0x37;
49 static const uint8_t ILI9XXX_IDMOFF = 0x38;
50 static const uint8_t ILI9XXX_IDMON = 0x39;
51 static const uint8_t ILI9XXX_PIXFMT = 0x3A;
52 static const uint8_t ILI9XXX_COLMOD = 0x3A;
53 
54 static const uint8_t ILI9XXX_GETSCANLINE = 0x45;
55 
56 static const uint8_t ILI9XXX_WRDISBV = 0x51;
57 static const uint8_t ILI9XXX_RDDISBV = 0x52;
58 static const uint8_t ILI9XXX_WRCTRLD = 0x53;
59 
60 static const uint8_t ILI9XXX_IFMODE = 0xB0;
61 static const uint8_t ILI9XXX_FRMCTR1 = 0xB1;
62 static const uint8_t ILI9XXX_FRMCTR2 = 0xB2;
63 static const uint8_t ILI9XXX_FRMCTR3 = 0xB3;
64 static const uint8_t ILI9XXX_INVCTR = 0xB4;
65 static const uint8_t ILI9XXX_DFUNCTR = 0xB6;
66 static const uint8_t ILI9XXX_ETMOD = 0xB7;
67 
68 static const uint8_t ILI9XXX_PWCTR1 = 0xC0;
69 static const uint8_t ILI9XXX_PWCTR2 = 0xC1;
70 static const uint8_t ILI9XXX_PWCTR3 = 0xC2;
71 static const uint8_t ILI9XXX_PWCTR4 = 0xC3;
72 static const uint8_t ILI9XXX_PWCTR5 = 0xC4;
73 static const uint8_t ILI9XXX_PWCTR6 = 0xF6;
74 static const uint8_t ILI9XXX_VMCTR1 = 0xC5;
75 static const uint8_t ILI9XXX_IFCTR = 0xC6;
76 static const uint8_t ILI9XXX_VMCTR2 = 0xC7;
77 static const uint8_t ILI9XXX_GMCTR = 0xC8;
78 static const uint8_t ILI9XXX_SETEXTC = 0xC8;
79 
80 static const uint8_t ILI9XXX_PWSET = 0xD0;
81 static const uint8_t ILI9XXX_VMCTR = 0xD1;
82 static const uint8_t ILI9XXX_PWSETN = 0xD2;
83 static const uint8_t ILI9XXX_RDID4 = 0xD3;
84 static const uint8_t ILI9XXX_RDINDEX = 0xD9;
85 static const uint8_t ILI9XXX_RDID1 = 0xDA;
86 static const uint8_t ILI9XXX_RDID2 = 0xDB;
87 static const uint8_t ILI9XXX_RDID3 = 0xDC;
88 static const uint8_t ILI9XXX_RDIDX = 0xDD; // TBC
89 
90 static const uint8_t ILI9XXX_GMCTRP1 = 0xE0;
91 static const uint8_t ILI9XXX_GMCTRN1 = 0xE1;
92 
93 static const uint8_t ILI9XXX_CSCON = 0xF0;
94 static const uint8_t ILI9XXX_ADJCTL3 = 0xF7;
95 static const uint8_t ILI9XXX_DELAY_FLAG = 0xFF;
96 // special marker for delay - command byte reprents ms, length byte is an impossible value
97 #define ILI9XXX_DELAY(ms) ((uint8_t) ((ms) | 0x80)), ILI9XXX_DELAY_FLAG
98 
99 } // namespace ili9xxx
100 } // namespace esphome
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7