8static const uint8_t ST_CMD_DELAY = 0x80;
10static const uint8_t ST77XX_NOP = 0x00;
11static const uint8_t ST77XX_SWRESET = 0x01;
12static const uint8_t ST77XX_RDDID = 0x04;
13static const uint8_t ST77XX_RDDST = 0x09;
15static const uint8_t ST77XX_SLPIN = 0x10;
16static const uint8_t ST77XX_SLPOUT = 0x11;
17static const uint8_t ST77XX_PTLON = 0x12;
18static const uint8_t ST77XX_NORON = 0x13;
20static const uint8_t ST77XX_INVOFF = 0x20;
21static const uint8_t ST77XX_INVON = 0x21;
22static const uint8_t ST77XX_DISPOFF = 0x28;
23static const uint8_t ST77XX_DISPON = 0x29;
24static const uint8_t ST77XX_CASET = 0x2A;
25static const uint8_t ST77XX_RASET = 0x2B;
26static const uint8_t ST77XX_RAMWR = 0x2C;
27static const uint8_t ST77XX_RAMRD = 0x2E;
29static const uint8_t ST77XX_PTLAR = 0x30;
30static const uint8_t ST77XX_TEOFF = 0x34;
31static const uint8_t ST77XX_TEON = 0x35;
32static const uint8_t ST77XX_MADCTL = 0x36;
33static const uint8_t ST77XX_COLMOD = 0x3A;
35static const uint8_t ST77XX_MADCTL_MY = 0x80;
36static const uint8_t ST77XX_MADCTL_MX = 0x40;
37static const uint8_t ST77XX_MADCTL_MV = 0x20;
38static const uint8_t ST77XX_MADCTL_ML = 0x10;
39static const uint8_t ST77XX_MADCTL_RGB = 0x00;
41static const uint8_t ST77XX_RDID1 = 0xDA;
42static const uint8_t ST77XX_RDID2 = 0xDB;
43static const uint8_t ST77XX_RDID3 = 0xDC;
44static const uint8_t ST77XX_RDID4 = 0xDD;
47static const uint8_t ST7735_MADCTL_BGR = 0x08;
49static const uint8_t ST7735_MADCTL_MH = 0x04;
51static const uint8_t ST7735_FRMCTR1 = 0xB1;
52static const uint8_t ST7735_FRMCTR2 = 0xB2;
53static const uint8_t ST7735_FRMCTR3 = 0xB3;
54static const uint8_t ST7735_INVCTR = 0xB4;
55static const uint8_t ST7735_DISSET5 = 0xB6;
57static const uint8_t ST7735_PWCTR1 = 0xC0;
58static const uint8_t ST7735_PWCTR2 = 0xC1;
59static const uint8_t ST7735_PWCTR3 = 0xC2;
60static const uint8_t ST7735_PWCTR4 = 0xC3;
61static const uint8_t ST7735_PWCTR5 = 0xC4;
62static const uint8_t ST7735_VMCTR1 = 0xC5;
64static const uint8_t ST7735_PWCTR6 = 0xFC;
66static const uint8_t ST7735_GMCTRP1 = 0xE0;
67static const uint8_t ST7735_GMCTRN1 = 0xE1;
73 ST77XX_SWRESET, ST_CMD_DELAY,
75 ST77XX_SLPOUT, ST_CMD_DELAY,
77 ST77XX_COLMOD, 1+ST_CMD_DELAY,
80 ST7735_FRMCTR1, 3+ST_CMD_DELAY,
93 ST7735_PWCTR1, 2+ST_CMD_DELAY,
102 ST7735_VMCTR1, 2+ST_CMD_DELAY,
109 0x09, 0x16, 0x09, 0x20,
110 0x21, 0x1B, 0x13, 0x19,
111 0x17, 0x15, 0x1E, 0x2B,
112 0x04, 0x05, 0x02, 0x0E,
113 ST7735_GMCTRN1,16+ST_CMD_DELAY,
114 0x0B, 0x14, 0x08, 0x1E,
115 0x22, 0x1D, 0x18, 0x1E,
116 0x1B, 0x1A, 0x24, 0x2B,
117 0x06, 0x06, 0x02, 0x0F,
125 ST77XX_NORON, ST_CMD_DELAY,
127 ST77XX_DISPON, ST_CMD_DELAY,
132 ST77XX_SWRESET, ST_CMD_DELAY,
134 ST77XX_SLPOUT, ST_CMD_DELAY,
194 RCMD2GREEN160X80[] = {
206 0x02, 0x1c, 0x07, 0x12,
207 0x37, 0x32, 0x29, 0x2d,
208 0x29, 0x25, 0x2B, 0x39,
209 0x00, 0x01, 0x03, 0x10,
211 0x03, 0x1d, 0x07, 0x06,
212 0x2E, 0x2C, 0x29, 0x2D,
213 0x2E, 0x2E, 0x37, 0x3F,
214 0x00, 0x00, 0x02, 0x10,
215 ST77XX_NORON, ST_CMD_DELAY,
217 ST77XX_DISPON, ST_CMD_DELAY,
221static const char *
const TAG =
"st7735";
228 eightbitcolor_(eightbitcolor),
230 invert_colors_(invert_colors),
246 ESP_LOGD(TAG,
" START");
248 ESP_LOGD(TAG,
" END");
252 if (this->
model_ == INITR_GREENTAB) {
256 }
else if ((this->
model_ == INITR_144GREENTAB) || (this->
model_ == INITR_HALLOWING)) {
262 }
else if (this->
model_ == INITR_MINI_160X80) {
275 if (this->
model_ != INITR_HALLOWING) {
276 data = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY;
279 data = data | ST7735_MADCTL_BGR;
281 data = data | ST77XX_MADCTL_RGB;
319 this->
buffer_[pos++] = (color565 >> 8) & 0xff;
339 return "ST7735 GREENTAB";
341 return "ST7735 REDTAB";
343 return "ST7735 BLACKTAB";
344 case INITR_MINI_160X80:
345 return "ST7735 MINI160x80";
352 uint8_t num_commands, cmd, num_args;
356 while (num_commands--) {
359 ms = num_args & ST_CMD_DELAY;
360 num_args &= ~ST_CMD_DELAY;
374 LOG_DISPLAY(
"",
"ST7735",
this);
375 LOG_PIN(
" CS Pin: ", this->
cs_);
376 LOG_PIN(
" DC Pin: ", this->
dc_pin_);
380 " Buffer Size: %zu\n"
387 LOG_UPDATE_INTERVAL(
this);
407 this->
senddata_(data_bytes, num_data_bytes);
414 for (uint8_t i = 0; i < num_data_bytes; i++) {
425 uint16_t x1 = offsetx;
427 uint16_t y1 = offsety;
469 byte[0] = (addr1 >> 8) & 0xFF;
470 byte[1] = addr1 & 0xFF;
471 byte[2] = (addr2 >> 8) & 0xFF;
472 byte[3] = addr2 & 0xFF;