acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

Arduino_RGB_Display.h (29411B)

      1 #include "../Arduino_DataBus.h"
      2 
      3 #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)
      4 
      5 #ifndef _ARDUINO_RGB_DISPLAY_H_
      6 #define _ARDUINO_RGB_DISPLAY_H_
      7 
      8 #include "../Arduino_GFX.h"
      9 #include "../databus/Arduino_ESP32RGBPanel.h"
     10 
     11 static const uint8_t gc9503v_type1_init_operations[] = {
     12     BEGIN_WRITE,
     13     WRITE_COMMAND_8, 0xF0,
     14     WRITE_BYTES, 5, 0x55, 0xAA, 0x52, 0x08, 0x00,
     15 
     16     WRITE_C8_D16, 0xF6, 0x5A, 0x87,
     17 
     18     WRITE_C8_D8, 0xC1, 0x3F,
     19     WRITE_C8_D8, 0xC2, 0x0E,
     20     WRITE_C8_D8, 0xC6, 0xF8,
     21     WRITE_C8_D8, 0xC9, 0x10,
     22     WRITE_C8_D8, 0xCD, 0x25,
     23     WRITE_C8_D8, 0xF8, 0x8A,
     24     WRITE_C8_D8, 0xAC, 0x45,
     25     WRITE_C8_D8, 0xA0, 0xDD,
     26     WRITE_C8_D8, 0xA7, 0x47,
     27 
     28     WRITE_COMMAND_8, 0xFA,
     29     WRITE_BYTES, 4, 0x00, 0x00, 0x00, 0x04,
     30 
     31     WRITE_C8_D8, 0xA3, 0xEE,
     32 
     33     WRITE_COMMAND_8, 0xFD,
     34     WRITE_BYTES, 3, 0x28, 0x28, 0x00,
     35 
     36     WRITE_C8_D8, 0x71, 0x48,
     37     WRITE_C8_D8, 0x72, 0x48,
     38     WRITE_C8_D16, 0x73, 0x00, 0x44,
     39     WRITE_C8_D8, 0x97, 0xEE,
     40     WRITE_C8_D8, 0x83, 0x93,
     41     WRITE_C8_D8, 0x9A, 0x72,
     42     WRITE_C8_D8, 0x9B, 0x5a,
     43     WRITE_C8_D16, 0x82, 0x2c, 0x2c,
     44     WRITE_C8_D8, 0xB1, 0x10,
     45 
     46     WRITE_COMMAND_8, 0x6D,
     47     WRITE_BYTES, 32,
     48     0x00, 0x1F, 0x19, 0x1A,
     49     0x10, 0x0e, 0x0c, 0x0a,
     50     0x02, 0x07, 0x1E, 0x1E,
     51     0x1E, 0x1E, 0x1E, 0x1E,
     52     0x1E, 0x1E, 0x1E, 0x1E,
     53     0x1E, 0x1E, 0x08, 0x01,
     54     0x09, 0x0b, 0x0D, 0x0F,
     55     0x1a, 0x19, 0x1f, 0x00,
     56 
     57     WRITE_COMMAND_8, 0x64,
     58     WRITE_BYTES, 16,
     59     0x38, 0x05, 0x01, 0xdb,
     60     0x03, 0x03, 0x38, 0x04,
     61     0x01, 0xdc, 0x03, 0x03,
     62     0x7A, 0x7A, 0x7A, 0x7A,
     63 
     64     WRITE_COMMAND_8, 0x65,
     65     WRITE_BYTES, 16,
     66     0x38, 0x03, 0x01, 0xdd,
     67     0x03, 0x03, 0x38, 0x02,
     68     0x01, 0xde, 0x03, 0x03,
     69     0x7A, 0x7A, 0x7A, 0x7A,
     70 
     71     WRITE_COMMAND_8, 0x66,
     72     WRITE_BYTES, 16,
     73     0x38, 0x01, 0x01, 0xdf,
     74     0x03, 0x03, 0x38, 0x00,
     75     0x01, 0xe0, 0x03, 0x03,
     76     0x7A, 0x7A, 0x7A, 0x7A,
     77 
     78     WRITE_COMMAND_8, 0x67,
     79     WRITE_BYTES, 16,
     80     0x30, 0x01, 0x01, 0xe1,
     81     0x03, 0x03, 0x30, 0x02,
     82     0x01, 0xe2, 0x03, 0x03,
     83     0x7A, 0x7A, 0x7A, 0x7A,
     84 
     85     WRITE_COMMAND_8, 0x68,
     86     WRITE_BYTES, 13,
     87     0x00, 0x08, 0x15, 0x08,
     88     0x15, 0x7A, 0x7A, 0x08,
     89     0x15, 0x08, 0x15, 0x7A,
     90     0x7A,
     91 
     92     WRITE_COMMAND_8, 0x60,
     93     WRITE_BYTES, 8,
     94     0x38, 0x08, 0x7A, 0x7A,
     95     0x38, 0x09, 0x7A, 0x7A,
     96 
     97     WRITE_COMMAND_8, 0x63,
     98     WRITE_BYTES, 8,
     99     0x31, 0xe4, 0x7A, 0x7A,
    100     0x31, 0xe5, 0x7A, 0x7A,
    101 
    102     WRITE_C8_D8, 0x6B, 0x07,
    103 
    104     WRITE_C8_D16, 0x7A, 0x08, 0x13,
    105 
    106     WRITE_C8_D16, 0x7B, 0x08, 0x13,
    107 
    108     WRITE_COMMAND_8, 0xD1,
    109     WRITE_BYTES, 52,
    110     0x00, 0x00, 0x00, 0x04,
    111     0x00, 0x12, 0x00, 0x18,
    112     0x00, 0x21, 0x00, 0x2a,
    113     0x00, 0x35, 0x00, 0x47,
    114     0x00, 0x56, 0x00, 0x90,
    115     0x00, 0xe5, 0x01, 0x68,
    116     0x01, 0xd5, 0x01, 0xd7,
    117     0x02, 0x36, 0x02, 0xa6,
    118     0x02, 0xee, 0x03, 0x48,
    119     0x03, 0xa0, 0x03, 0xba,
    120     0x03, 0xc5, 0x03, 0xd0,
    121     0x03, 0xE0, 0x03, 0xea,
    122     0x03, 0xFa, 0x03, 0xFF,
    123 
    124     WRITE_COMMAND_8, 0xD2,
    125     WRITE_BYTES, 52,
    126     0x00, 0x00, 0x00, 0x04,
    127     0x00, 0x12, 0x00, 0x18,
    128     0x00, 0x21, 0x00, 0x2a,
    129     0x00, 0x35, 0x00, 0x47,
    130     0x00, 0x56, 0x00, 0x90,
    131     0x00, 0xe5, 0x01, 0x68,
    132     0x01, 0xd5, 0x01, 0xd7,
    133     0x02, 0x36, 0x02, 0xa6,
    134     0x02, 0xee, 0x03, 0x48,
    135     0x03, 0xa0, 0x03, 0xba,
    136     0x03, 0xc5, 0x03, 0xd0,
    137     0x03, 0xE0, 0x03, 0xea,
    138     0x03, 0xFa, 0x03, 0xFF,
    139 
    140     WRITE_COMMAND_8, 0xD3,
    141     WRITE_BYTES, 52,
    142     0x00, 0x00, 0x00, 0x04,
    143     0x00, 0x12, 0x00, 0x18,
    144     0x00, 0x21, 0x00, 0x2a,
    145     0x00, 0x35, 0x00, 0x47,
    146     0x00, 0x56, 0x00, 0x90,
    147     0x00, 0xe5, 0x01, 0x68,
    148     0x01, 0xd5, 0x01, 0xd7,
    149     0x02, 0x36, 0x02, 0xa6,
    150     0x02, 0xee, 0x03, 0x48,
    151     0x03, 0xa0, 0x03, 0xba,
    152     0x03, 0xc5, 0x03, 0xd0,
    153     0x03, 0xE0, 0x03, 0xea,
    154     0x03, 0xFa, 0x03, 0xFF,
    155 
    156     WRITE_COMMAND_8, 0xD4,
    157     WRITE_BYTES, 52,
    158     0x00, 0x00, 0x00, 0x04,
    159     0x00, 0x12, 0x00, 0x18,
    160     0x00, 0x21, 0x00, 0x2a,
    161     0x00, 0x35, 0x00, 0x47,
    162     0x00, 0x56, 0x00, 0x90,
    163     0x00, 0xe5, 0x01, 0x68,
    164     0x01, 0xd5, 0x01, 0xd7,
    165     0x02, 0x36, 0x02, 0xa6,
    166     0x02, 0xee, 0x03, 0x48,
    167     0x03, 0xa0, 0x03, 0xba,
    168     0x03, 0xc5, 0x03, 0xd0,
    169     0x03, 0xE0, 0x03, 0xea,
    170     0x03, 0xFa, 0x03, 0xFF,
    171 
    172     WRITE_COMMAND_8, 0xD5,
    173     WRITE_BYTES, 52,
    174     0x00, 0x00, 0x00, 0x04,
    175     0x00, 0x12, 0x00, 0x18,
    176     0x00, 0x21, 0x00, 0x2a,
    177     0x00, 0x35, 0x00, 0x47,
    178     0x00, 0x56, 0x00, 0x90,
    179     0x00, 0xe5, 0x01, 0x68,
    180     0x01, 0xd5, 0x01, 0xd7,
    181     0x02, 0x36, 0x02, 0xa6,
    182     0x02, 0xee, 0x03, 0x48,
    183     0x03, 0xa0, 0x03, 0xba,
    184     0x03, 0xc5, 0x03, 0xd0,
    185     0x03, 0xE0, 0x03, 0xea,
    186     0x03, 0xFa, 0x03, 0xFF,
    187 
    188     WRITE_COMMAND_8, 0xD6,
    189     WRITE_BYTES, 52,
    190     0x00, 0x00, 0x00, 0x04,
    191     0x00, 0x12, 0x00, 0x18,
    192     0x00, 0x21, 0x00, 0x2a,
    193     0x00, 0x35, 0x00, 0x47,
    194     0x00, 0x56, 0x00, 0x90,
    195     0x00, 0xe5, 0x01, 0x68,
    196     0x01, 0xd5, 0x01, 0xd7,
    197     0x02, 0x36, 0x02, 0xa6,
    198     0x02, 0xee, 0x03, 0x48,
    199     0x03, 0xa0, 0x03, 0xba,
    200     0x03, 0xc5, 0x03, 0xd0,
    201     0x03, 0xE0, 0x03, 0xea,
    202     0x03, 0xFa, 0x03, 0xFF,
    203 
    204     WRITE_C8_D8, 0x3a, 0x66,
    205 
    206     WRITE_COMMAND_8, 0x11,
    207     END_WRITE,
    208 
    209     DELAY, 200,
    210 
    211     BEGIN_WRITE,
    212     WRITE_COMMAND_8, 0x29,
    213     END_WRITE};
    214 
    215 static const uint8_t st7701_type1_init_operations[] = {
    216     BEGIN_WRITE,
    217     WRITE_COMMAND_8, 0xFF,
    218     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    219 
    220     WRITE_C8_D16, 0xC0, 0x3B, 0x00,
    221     WRITE_C8_D16, 0xC1, 0x0D, 0x02,
    222     WRITE_C8_D16, 0xC2, 0x31, 0x05,
    223     WRITE_C8_D8, 0xCD, 0x08,
    224 
    225     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    226     WRITE_BYTES, 16,
    227     0x00, 0x11, 0x18, 0x0E,
    228     0x11, 0x06, 0x07, 0x08,
    229     0x07, 0x22, 0x04, 0x12,
    230     0x0F, 0xAA, 0x31, 0x18,
    231 
    232     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    233     WRITE_BYTES, 16,
    234     0x00, 0x11, 0x19, 0x0E,
    235     0x12, 0x07, 0x08, 0x08,
    236     0x08, 0x22, 0x04, 0x11,
    237     0x11, 0xA9, 0x32, 0x18,
    238 
    239     // PAGE1
    240     WRITE_COMMAND_8, 0xFF,
    241     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    242 
    243     WRITE_C8_D8, 0xB0, 0x60, // Vop=4.7375v
    244     WRITE_C8_D8, 0xB1, 0x32, // VCOM=32
    245     WRITE_C8_D8, 0xB2, 0x07, // VGH=15v
    246     WRITE_C8_D8, 0xB3, 0x80,
    247     WRITE_C8_D8, 0xB5, 0x49, // VGL=-10.17v
    248     WRITE_C8_D8, 0xB7, 0x85,
    249     WRITE_C8_D8, 0xB8, 0x21, // AVDD=6.6 & AVCL=-4.6
    250     WRITE_C8_D8, 0xC1, 0x78,
    251     WRITE_C8_D8, 0xC2, 0x78,
    252 
    253     WRITE_COMMAND_8, 0xE0,
    254     WRITE_BYTES, 3, 0x00, 0x1B, 0x02,
    255 
    256     WRITE_COMMAND_8, 0xE1,
    257     WRITE_BYTES, 11,
    258     0x08, 0xA0, 0x00, 0x00,
    259     0x07, 0xA0, 0x00, 0x00,
    260     0x00, 0x44, 0x44,
    261 
    262     WRITE_COMMAND_8, 0xE2,
    263     WRITE_BYTES, 12,
    264     0x11, 0x11, 0x44, 0x44,
    265     0xED, 0xA0, 0x00, 0x00,
    266     0xEC, 0xA0, 0x00, 0x00,
    267 
    268     WRITE_COMMAND_8, 0xE3,
    269     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
    270 
    271     WRITE_C8_D16, 0xE4, 0x44, 0x44,
    272 
    273     WRITE_COMMAND_8, 0xE5,
    274     WRITE_BYTES, 16,
    275     0x0A, 0xE9, 0xD8, 0xA0,
    276     0x0C, 0xEB, 0xD8, 0xA0,
    277     0x0E, 0xED, 0xD8, 0xA0,
    278     0x10, 0xEF, 0xD8, 0xA0,
    279 
    280     WRITE_COMMAND_8, 0xE6,
    281     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
    282 
    283     WRITE_C8_D16, 0xE7, 0x44, 0x44,
    284 
    285     WRITE_COMMAND_8, 0xE8,
    286     WRITE_BYTES, 16,
    287     0x09, 0xE8, 0xD8, 0xA0,
    288     0x0B, 0xEA, 0xD8, 0xA0,
    289     0x0D, 0xEC, 0xD8, 0xA0,
    290     0x0F, 0xEE, 0xD8, 0xA0,
    291 
    292     WRITE_COMMAND_8, 0xEB,
    293     WRITE_BYTES, 7,
    294     0x02, 0x00, 0xE4, 0xE4,
    295     0x88, 0x00, 0x40,
    296 
    297     WRITE_C8_D16, 0xEC, 0x3C, 0x00,
    298 
    299     WRITE_COMMAND_8, 0xED,
    300     WRITE_BYTES, 16,
    301     0xAB, 0x89, 0x76, 0x54,
    302     0x02, 0xFF, 0xFF, 0xFF,
    303     0xFF, 0xFF, 0xFF, 0x20,
    304     0x45, 0x67, 0x98, 0xBA,
    305 
    306     //-----------VAP & VAN---------------
    307     WRITE_COMMAND_8, 0xFF,
    308     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
    309 
    310     WRITE_C8_D8, 0xE5, 0xE4,
    311 
    312     WRITE_COMMAND_8, 0xFF,
    313     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    314 
    315     WRITE_COMMAND_8, 0x21,   // 0x20 normal, 0x21 IPS
    316     WRITE_C8_D8, 0x3A, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
    317 
    318     WRITE_COMMAND_8, 0x11, // Sleep Out
    319     END_WRITE,
    320 
    321     DELAY, 120,
    322 
    323     BEGIN_WRITE,
    324     WRITE_COMMAND_8, 0x29, // Display On
    325     END_WRITE};
    326 
    327 static const uint8_t st7701_type2_init_operations[] = {
    328     BEGIN_WRITE,
    329     WRITE_COMMAND_8, 0xFF,
    330     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    331 
    332     WRITE_C8_D16, 0xC0, 0xE9, 0x03,
    333     WRITE_C8_D16, 0xC1, 0x11, 0x02,
    334     WRITE_C8_D16, 0xC2, 0x31, 0x08,
    335 
    336     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    337     WRITE_BYTES, 16,
    338     0x00, 0x0D, 0x14, 0x0D,
    339     0x10, 0x05, 0x02, 0x08,
    340     0x08, 0x1E, 0x05, 0x13,
    341     0x11, 0xA3, 0x29, 0x18,
    342 
    343     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    344     WRITE_BYTES, 16,
    345     0x00, 0x0C, 0x14, 0x0C,
    346     0x10, 0x05, 0x03, 0x08,
    347     0x07, 0x20, 0x05, 0x13,
    348     0x11, 0xA4, 0x29, 0x18,
    349 
    350     // PAGE1
    351     WRITE_COMMAND_8, 0xFF,
    352     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    353 
    354     WRITE_C8_D8, 0xB0, 0x6C,
    355     WRITE_C8_D8, 0xB1, 0x43,
    356     WRITE_C8_D8, 0xB2, 0x07,
    357     WRITE_C8_D8, 0xB3, 0x80,
    358     WRITE_C8_D8, 0xB5, 0x47,
    359     WRITE_C8_D8, 0xB7, 0x8A,
    360     WRITE_C8_D8, 0xB8, 0x20,
    361     WRITE_C8_D8, 0xC1, 0x78,
    362     WRITE_C8_D8, 0xC2, 0x78,
    363 
    364     WRITE_C8_D8, 0xD0, 0x88,
    365 
    366     WRITE_COMMAND_8, 0xE0,
    367     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    368 
    369     WRITE_COMMAND_8, 0xE1,
    370     WRITE_BYTES, 11,
    371     0x08, 0x00, 0x0A, 0x00,
    372     0x07, 0x00, 0x09, 0x00,
    373     0x00, 0x33, 0x33,
    374 
    375     WRITE_COMMAND_8, 0xE2,
    376     WRITE_BYTES, 12,
    377     0x00, 0x00, 0x00, 0x00,
    378     0x00, 0x00, 0x00, 0x00,
    379     0x00, 0x00, 0x00, 0x00,
    380 
    381     WRITE_COMMAND_8, 0xE3,
    382     WRITE_BYTES, 4, 0x00, 0x00, 0x33, 0x33,
    383 
    384     WRITE_C8_D16, 0xE4, 0x44, 0x44,
    385 
    386     WRITE_COMMAND_8, 0xE5,
    387     WRITE_BYTES, 16,
    388     0x0E, 0x60, 0xA0, 0xA0,
    389     0x10, 0x60, 0xA0, 0xA0,
    390     0x0A, 0x60, 0xA0, 0xA0,
    391     0x0C, 0x60, 0xA0, 0xA0,
    392 
    393     WRITE_COMMAND_8, 0xE6,
    394     WRITE_BYTES, 4, 0x00, 0x00, 0x33, 0x33,
    395 
    396     WRITE_C8_D16, 0xE7, 0x44, 0x44,
    397 
    398     WRITE_COMMAND_8, 0xE8,
    399     WRITE_BYTES, 16,
    400     0x0D, 0x60, 0xA0, 0xA0,
    401     0x0F, 0x60, 0xA0, 0xA0,
    402     0x09, 0x60, 0xA0, 0xA0,
    403     0x0B, 0x60, 0xA0, 0xA0,
    404 
    405     WRITE_COMMAND_8, 0xEB,
    406     WRITE_BYTES, 7,
    407     0x02, 0x01, 0xE4, 0xE4,
    408     0x44, 0x00, 0x40,
    409 
    410     WRITE_C8_D16, 0xEC, 0x02, 0x01,
    411 
    412     WRITE_COMMAND_8, 0xED,
    413     WRITE_BYTES, 16,
    414     0xAB, 0x89, 0x76, 0x54,
    415     0x01, 0xFF, 0xFF, 0xFF,
    416     0xFF, 0xFF, 0xFF, 0x10,
    417     0x45, 0x67, 0x98, 0xBA,
    418 
    419     //-----------------------------------------End GIP Setting-----------------------------------------//
    420     //--------------------------- Power Control Registers Initial End------------------------------//
    421     //-------------------------------------Bank1 Setting------------------------------------------------//
    422     WRITE_COMMAND_8, 0xFF,
    423     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    424 
    425     WRITE_COMMAND_8, 0x21,   // 0x20 normal, 0x21 IPS
    426     WRITE_C8_D8, 0x3A, 0x77, // RGB 24bits D[23:0]
    427 
    428     WRITE_COMMAND_8, 0x11, // Sleep Out
    429     END_WRITE,
    430 
    431     DELAY, 100,
    432 
    433     BEGIN_WRITE,
    434     WRITE_COMMAND_8, 0x29, // Display On
    435     END_WRITE};
    436 
    437 static const uint8_t st7701_type3_init_operations[] = {
    438     BEGIN_WRITE,
    439     WRITE_COMMAND_8, 0xFF,
    440     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    441 
    442     WRITE_C8_D16, 0xC0, 0x3B, 0x00,
    443     WRITE_C8_D16, 0xC1, 0x0B, 0x02, // VBP
    444     WRITE_C8_D16, 0xC2, 0x00, 0x02,
    445     WRITE_C8_D8, 0xCC, 0x10,
    446     WRITE_C8_D8, 0xCD, 0x08,
    447 
    448     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    449     WRITE_BYTES, 16,
    450     0x02, 0x13, 0x1B, 0x0D,
    451     0x10, 0x05, 0x08, 0x07,
    452     0x07, 0x24, 0x04, 0x11,
    453     0x0E, 0x2C, 0x33, 0x1D,
    454 
    455     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    456     WRITE_BYTES, 16,
    457     0x05, 0x13, 0x1B, 0x0D,
    458     0x11, 0x05, 0x08, 0x07,
    459     0x07, 0x24, 0x04, 0x11,
    460     0x0E, 0x2C, 0x33, 0x1D,
    461 
    462     // PAGE1
    463     WRITE_COMMAND_8, 0xFF,
    464     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    465 
    466     WRITE_C8_D8, 0xB0, 0x5d, // 5d
    467     WRITE_C8_D8, 0xB1, 0x43, // VCOM amplitude setting
    468     WRITE_C8_D8, 0xB2, 0x81, // VGH Voltage setting, 12V
    469     WRITE_C8_D8, 0xB3, 0x80,
    470     WRITE_C8_D8, 0xB5, 0x43, // VGL Voltage setting, -8.3V
    471     WRITE_C8_D8, 0xB7, 0x85,
    472     WRITE_C8_D8, 0xB8, 0x20,
    473 
    474     WRITE_C8_D8, 0xC1, 0x78,
    475     WRITE_C8_D8, 0xC2, 0x78,
    476 
    477     WRITE_C8_D8, 0xD0, 0x88,
    478 
    479     WRITE_COMMAND_8, 0xE0,
    480     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    481 
    482     WRITE_COMMAND_8, 0xE1,
    483     WRITE_BYTES, 11,
    484     0x03, 0xA0, 0x00, 0x00,
    485     0x04, 0xA0, 0x00, 0x00,
    486     0x00, 0x20, 0x20,
    487 
    488     WRITE_COMMAND_8, 0xE2,
    489     WRITE_BYTES, 12,
    490     0x00, 0x00, 0x00, 0x00,
    491     0x00, 0x00, 0x00, 0x00,
    492     0x00, 0x00, 0x00, 0x00,
    493 
    494     WRITE_COMMAND_8, 0xE3,
    495     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    496 
    497     WRITE_C8_D16, 0xE4, 0x22, 0x00,
    498 
    499     WRITE_COMMAND_8, 0xE5,
    500     WRITE_BYTES, 16,
    501     0x05, 0xEC, 0xA0, 0xA0,
    502     0x07, 0xEE, 0xA0, 0xA0,
    503     0x00, 0x00, 0x00, 0x00,
    504     0x00, 0x00, 0x00, 0x00,
    505 
    506     WRITE_COMMAND_8, 0xE6,
    507     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    508 
    509     WRITE_C8_D16, 0xE7, 0x22, 0x00,
    510 
    511     WRITE_COMMAND_8, 0xE8,
    512     WRITE_BYTES, 16,
    513     0x06, 0xED, 0xA0, 0xA0,
    514     0x08, 0xEF, 0xA0, 0xA0,
    515     0x00, 0x00, 0x00, 0x00,
    516     0x00, 0x00, 0x00, 0x00,
    517 
    518     WRITE_COMMAND_8, 0xEB,
    519     WRITE_BYTES, 7,
    520     0x00, 0x00, 0x40, 0x40,
    521     0x00, 0x00, 0x00,
    522 
    523     WRITE_COMMAND_8, 0xED,
    524     WRITE_BYTES, 16,
    525     0xFF, 0xFF, 0xFF, 0xBA,
    526     0x0A, 0xBF, 0x45, 0xFF,
    527     0xFF, 0x54, 0xFB, 0xA0,
    528     0xAB, 0xFF, 0xFF, 0xFF,
    529 
    530     WRITE_COMMAND_8, 0xEF,
    531     WRITE_BYTES, 6,
    532     0x10, 0x0D, 0x04, 0x08,
    533     0x3F, 0x1F,
    534 
    535     WRITE_COMMAND_8, 0xFF,
    536     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
    537 
    538     WRITE_C8_D8, 0xEF, 0x08,
    539 
    540     WRITE_COMMAND_8, 0xFF,
    541     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    542 
    543     WRITE_COMMAND_8, 0x11, // Sleep Out
    544     END_WRITE,
    545 
    546     DELAY, 120,
    547 
    548     BEGIN_WRITE,
    549     WRITE_COMMAND_8, 0x29,   // Display On
    550     WRITE_COMMAND_8, 0x21,   // 0x20 normal, 0x21 IPS
    551     WRITE_C8_D8, 0x36, 0x00, // Display data access control
    552     WRITE_C8_D8, 0x3A, 0x60, // 0x60 18bit   0x50 16bit
    553     END_WRITE};
    554 
    555 static const uint8_t st7701_type4_init_operations[] = {
    556     BEGIN_WRITE,
    557 
    558     WRITE_COMMAND_8, 0xFF,
    559     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    560 
    561     WRITE_C8_D16, 0xC0, 0x3b, 0x00,
    562     WRITE_C8_D16, 0xC1, 0x0b, 0x02,
    563     WRITE_C8_D16, 0xC2, 0x07, 0x02,
    564     WRITE_C8_D8, 0xCC, 0x10,
    565     WRITE_C8_D8, 0xCD, 0x08,
    566 
    567     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    568     WRITE_BYTES, 16,
    569     0x00, 0x11, 0x16, 0x0e,
    570     0x11, 0x06, 0x05, 0x09,
    571     0x08, 0x21, 0x06, 0x13,
    572     0x10, 0x29, 0x31, 0x18,
    573 
    574     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    575     WRITE_BYTES, 16,
    576     0x00, 0x11, 0x16, 0x0e,
    577     0x11, 0x07, 0x05, 0x09,
    578     0x09, 0x21, 0x05, 0x13,
    579     0x11, 0x2a, 0x31, 0x18,
    580 
    581     WRITE_COMMAND_8, 0xFF,
    582     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    583 
    584     WRITE_C8_D8, 0xb0, 0x6d,
    585     WRITE_C8_D8, 0xb1, 0x37,
    586     WRITE_C8_D8, 0xb2, 0x81,
    587     WRITE_C8_D8, 0xb3, 0x80,
    588     WRITE_C8_D8, 0xb5, 0x43,
    589     WRITE_C8_D8, 0xb7, 0x85,
    590     WRITE_C8_D8, 0xb8, 0x20,
    591 
    592     WRITE_C8_D8, 0xc1, 0x78,
    593     WRITE_C8_D8, 0xc2, 0x78,
    594     WRITE_C8_D8, 0xc3, 0x8c,
    595 
    596     WRITE_C8_D8, 0xd0, 0x88,
    597 
    598     WRITE_COMMAND_8, 0xe0,
    599     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    600     WRITE_COMMAND_8, 0xe1,
    601     WRITE_BYTES, 11,
    602     0x03, 0xa0, 0x00, 0x00,
    603     0x04, 0xa0, 0x00, 0x00,
    604     0x00, 0x20, 0x20,
    605     WRITE_COMMAND_8, 0xe2,
    606     WRITE_BYTES, 13,
    607     0x00, 0x00, 0x00, 0x00,
    608     0x00, 0x00, 0x00, 0x00,
    609     0x00, 0x00, 0x00, 0x00,
    610     0x00,
    611     WRITE_COMMAND_8, 0xe3,
    612     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    613     WRITE_C8_D16, 0xe4, 0x22, 0x00,
    614     WRITE_COMMAND_8, 0xe5,
    615     WRITE_BYTES, 16,
    616     0x05, 0xec, 0xa0, 0xa0,
    617     0x07, 0xee, 0xa0, 0xa0,
    618     0x00, 0x00, 0x00, 0x00,
    619     0x00, 0x00, 0x00, 0x00,
    620     WRITE_COMMAND_8, 0xe6,
    621     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    622     WRITE_C8_D16, 0xe7, 0x22, 0x00,
    623     WRITE_COMMAND_8, 0xe8,
    624     WRITE_BYTES, 16,
    625     0x06, 0xed, 0xa0, 0xa0,
    626     0x08, 0xef, 0xa0, 0xa0,
    627     0x00, 0x00, 0x00, 0x00,
    628     0x00, 0x00, 0x00, 0x00,
    629     WRITE_COMMAND_8, 0xeb,
    630     WRITE_BYTES, 7,
    631     0x00, 0x00, 0x40, 0x40,
    632     0x00, 0x00, 0x00,
    633     WRITE_COMMAND_8, 0xed,
    634     WRITE_BYTES, 16,
    635     0xff, 0xff, 0xff, 0xba,
    636     0x0a, 0xbf, 0x45, 0xff,
    637     0xff, 0x54, 0xfb, 0xa0,
    638     0xab, 0xff, 0xff, 0xff,
    639     WRITE_COMMAND_8, 0xef,
    640     WRITE_BYTES, 6,
    641     0x10, 0x0d, 0x04, 0x08,
    642     0x3f, 0x1f,
    643     WRITE_COMMAND_8, 0xff,
    644     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
    645     WRITE_C8_D8, 0xef, 0x08,
    646     WRITE_COMMAND_8, 0xff,
    647     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    648     WRITE_C8_D8, 0x36, 0x08,
    649     WRITE_C8_D8, 0x3a, 0x66,
    650     WRITE_C8_D8, 0x11, 0x00,
    651     WRITE_C8_D8, 0x29, 0x00,
    652 
    653     WRITE_COMMAND_8, 0x11, // Sleep Out
    654     END_WRITE,
    655 
    656     DELAY, 120,
    657 
    658     BEGIN_WRITE,
    659     WRITE_COMMAND_8, 0x29,   // Display On
    660     WRITE_C8_D8, 0x36, 0x08, // Display data access control
    661     WRITE_C8_D8, 0x3A, 0x60, // 0x60 18bit   0x50 16bit
    662     END_WRITE};
    663 
    664 static const uint8_t st7701_type5_init_operations[] = {
    665     BEGIN_WRITE,
    666     WRITE_COMMAND_8, 0xFF,
    667     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    668 
    669     WRITE_C8_D16, 0xC0, 0x3B, 0x00,
    670     WRITE_C8_D16, 0xC1, 0x0B, 0x02, // VBP
    671     WRITE_C8_D16, 0xC2, 0x00, 0x02,
    672 
    673     WRITE_C8_D8, 0xCC, 0x10,
    674     WRITE_C8_D8, 0xCD, 0x08,
    675 
    676     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    677     WRITE_BYTES, 16,
    678     0x02, 0x13, 0x1B, 0x0D,
    679     0x10, 0x05, 0x08, 0x07,
    680     0x07, 0x24, 0x04, 0x11,
    681     0x0E, 0x2C, 0x33, 0x1D,
    682 
    683     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    684     WRITE_BYTES, 16,
    685     0x05, 0x13, 0x1B, 0x0D,
    686     0x11, 0x05, 0x08, 0x07,
    687     0x07, 0x24, 0x04, 0x11,
    688     0x0E, 0x2C, 0x33, 0x1D,
    689 
    690     WRITE_COMMAND_8, 0xFF,
    691     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    692 
    693     WRITE_C8_D8, 0xB0, 0x5d, // 5d
    694     WRITE_C8_D8, 0xB1, 0x43, // VCOM amplitude setting
    695     WRITE_C8_D8, 0xB2, 0x81, // VGH Voltage setting, 12V
    696     WRITE_C8_D8, 0xB3, 0x80,
    697 
    698     WRITE_C8_D8, 0xB5, 0x43, // VGL Voltage setting, -8.3V
    699 
    700     WRITE_C8_D8, 0xB7, 0x85,
    701     WRITE_C8_D8, 0xB8, 0x20,
    702 
    703     WRITE_C8_D8, 0xC1, 0x78,
    704     WRITE_C8_D8, 0xC2, 0x78,
    705 
    706     WRITE_C8_D8, 0xD0, 0x88,
    707 
    708     WRITE_COMMAND_8, 0xE0,
    709     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    710 
    711     WRITE_COMMAND_8, 0xE1,
    712     WRITE_BYTES, 11,
    713     0x03, 0xA0, 0x00, 0x00,
    714     0x04, 0xA0, 0x00, 0x00,
    715     0x00, 0x20, 0x20,
    716 
    717     WRITE_COMMAND_8, 0xE2,
    718     WRITE_BYTES, 13,
    719     0x00, 0x00, 0x00, 0x00,
    720     0x00, 0x00, 0x00, 0x00,
    721     0x00, 0x00, 0x00, 0x00,
    722     0x00,
    723 
    724     WRITE_COMMAND_8, 0xE3,
    725     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    726 
    727     WRITE_C8_D16, 0xE4, 0x22, 0x00,
    728 
    729     WRITE_COMMAND_8, 0xE5,
    730     WRITE_BYTES, 16,
    731     0x05, 0xEC, 0xA0, 0xA0,
    732     0x07, 0xEE, 0xA0, 0xA0,
    733     0x00, 0x00, 0x00, 0x00,
    734     0x00, 0x00, 0x00, 0x00,
    735 
    736     WRITE_COMMAND_8, 0xE6,
    737     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    738 
    739     WRITE_C8_D16, 0xE7, 0x22, 0x00,
    740 
    741     WRITE_COMMAND_8, 0xE8,
    742     WRITE_BYTES, 16,
    743     0x06, 0xED, 0xA0, 0xA0,
    744     0x08, 0xEF, 0xA0, 0xA0,
    745     0x00, 0x00, 0x00, 0x00,
    746     0x00, 0x00, 0x00, 0x00,
    747 
    748     WRITE_COMMAND_8, 0xEB,
    749     WRITE_BYTES, 7,
    750     0x00, 0x00, 0x40, 0x40,
    751     0x00, 0x00, 0x00,
    752 
    753     WRITE_COMMAND_8, 0xED,
    754     WRITE_BYTES, 16,
    755     0xFF, 0xFF, 0xFF, 0xBA,
    756     0x0A, 0xBF, 0x45, 0xFF,
    757     0xFF, 0x54, 0xFB, 0xA0,
    758     0xAB, 0xFF, 0xFF, 0xFF,
    759 
    760     WRITE_COMMAND_8, 0xEF,
    761     WRITE_BYTES, 6,
    762     0x10, 0x0D, 0x04, 0x08,
    763     0x3F, 0x1F,
    764 
    765     WRITE_COMMAND_8, 0xFF,
    766     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
    767 
    768     WRITE_C8_D8, 0xEF, 0x08,
    769 
    770     WRITE_COMMAND_8, 0xFF,
    771     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    772 
    773     WRITE_C8_D8, 0x36, 0x08,
    774     WRITE_C8_D8, 0x3A, 0x60, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
    775 
    776     WRITE_COMMAND_8, 0x11, // Sleep Out
    777     END_WRITE,
    778 
    779     DELAY, 100,
    780 
    781     BEGIN_WRITE,
    782     WRITE_COMMAND_8, 0x29, // Display On
    783     END_WRITE,
    784 
    785     DELAY, 50};
    786 
    787 static const uint8_t st7701_type6_init_operations[] = {
    788     BEGIN_WRITE,
    789     WRITE_COMMAND_8, 0xFF,
    790     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
    791     WRITE_C8_D8, 0xEF, 0x08,
    792 
    793     WRITE_COMMAND_8, 0xFF,
    794     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    795 
    796     WRITE_C8_D16, 0xC0, 0x3B, 0x00,
    797 
    798     WRITE_C8_D16, 0xC1, 0x10, 0x0C,
    799 
    800     WRITE_C8_D16, 0xC2, 0x07, 0x0A,
    801 
    802     WRITE_C8_D8, 0xC7, 0x00,
    803 
    804     WRITE_C8_D8, 0xCC, 0x10,
    805 
    806     WRITE_COMMAND_8, 0xB0,
    807     WRITE_BYTES, 16,
    808     0x05, 0x12, 0x98, 0x0E,
    809     0x0F, 0x07, 0x07, 0x09,
    810     0x09, 0x23, 0x05, 0x52,
    811     0x0F, 0x67, 0x2C, 0x11,
    812 
    813     WRITE_COMMAND_8, 0xB1,
    814     WRITE_BYTES, 16,
    815     0x0B, 0x11, 0x97, 0x0C,
    816     0x12, 0x06, 0x06, 0x08,
    817     0x08, 0x22, 0x03, 0x51,
    818     0x11, 0x66, 0x2B, 0x0F,
    819 
    820     WRITE_COMMAND_8, 0xFF,
    821     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    822 
    823     WRITE_C8_D8, 0xB0, 0x5D,
    824     WRITE_C8_D8, 0xB1, 0x2D,
    825     WRITE_C8_D8, 0xB2, 0x81,
    826     WRITE_C8_D8, 0xB3, 0x80,
    827 
    828     WRITE_C8_D8, 0xB5, 0x4E,
    829 
    830     WRITE_C8_D8, 0xB7, 0x85,
    831     WRITE_C8_D8, 0xB8, 0x20,
    832 
    833     WRITE_C8_D8, 0xC1, 0x78,
    834     WRITE_C8_D8, 0xC2, 0x78,
    835 
    836     WRITE_C8_D8, 0xD0, 0x88,
    837 
    838     WRITE_COMMAND_8, 0xE0,
    839     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    840 
    841     WRITE_COMMAND_8, 0xE1,
    842     WRITE_BYTES, 11,
    843     0x06, 0x30, 0x08, 0x30,
    844     0x05, 0x30, 0x07, 0x30,
    845     0x00, 0x33, 0x33,
    846 
    847     WRITE_COMMAND_8, 0xE2,
    848     WRITE_BYTES, 12,
    849     0x11, 0x11, 0x33, 0x33,
    850     0xF4, 0x00, 0x00, 0x00,
    851     0xF4, 0x00, 0x00, 0x00,
    852 
    853     WRITE_COMMAND_8, 0xE3,
    854     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
    855 
    856     WRITE_C8_D16, 0xE4, 0x44, 0x44,
    857 
    858     WRITE_COMMAND_8, 0xE5,
    859     WRITE_BYTES, 16,
    860     0x0D, 0xF5, 0x30, 0xF0,
    861     0x0F, 0xF7, 0x30, 0xF0,
    862     0x09, 0xF1, 0x30, 0xF0,
    863     0x0B, 0xF3, 0x30, 0xF0,
    864 
    865     WRITE_COMMAND_8, 0xE6,
    866     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
    867 
    868     WRITE_C8_D16, 0xE7, 0x44, 0x44,
    869 
    870     WRITE_COMMAND_8, 0xE8,
    871     WRITE_BYTES, 16,
    872     0x0C, 0xF4, 0x30, 0xF0,
    873     0x0E, 0xF6, 0x30, 0xF0,
    874     0x08, 0xF0, 0x30, 0xF0,
    875     0x0A, 0xF2, 0x30, 0xF0,
    876 
    877     WRITE_C8_D16, 0xE9, 0x36, 0x01,
    878 
    879     WRITE_COMMAND_8, 0xEB,
    880     WRITE_BYTES, 7,
    881     0x00, 0x01, 0xE4, 0xE4,
    882     0x44, 0x88, 0x40,
    883 
    884     WRITE_COMMAND_8, 0xED,
    885     WRITE_BYTES, 16,
    886     0xFF, 0x10, 0xAF, 0x76,
    887     0x54, 0x2B, 0xCF, 0xFF,
    888     0xFF, 0xFC, 0xB2, 0x45,
    889     0x67, 0xFA, 0x01, 0xFF,
    890 
    891     WRITE_COMMAND_8, 0xEF,
    892     WRITE_BYTES, 6,
    893     0x08, 0x08, 0x08, 0x45,
    894     0x3F, 0x54,
    895 
    896     WRITE_COMMAND_8, 0xFF,
    897     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
    898 
    899     WRITE_COMMAND_8, 0x11,
    900     END_WRITE,
    901 
    902     DELAY, 120, // ms
    903 
    904     BEGIN_WRITE,
    905     WRITE_C8_D8, 0x3A, 0x66,
    906 
    907     WRITE_C8_D8, 0x36, 0x00,
    908 
    909     WRITE_C8_D8, 0x35, 0x00,
    910 
    911     WRITE_COMMAND_8, 0x29, // Display On
    912     END_WRITE};
    913 
    914 static const uint8_t st7701_type7_init_operations[] = {
    915     BEGIN_WRITE,
    916 
    917     WRITE_COMMAND_8, 0xFF,
    918     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
    919 
    920     WRITE_C8_D16, 0xC0, 0x3b, 0x00,
    921     WRITE_C8_D16, 0xC1, 0x0b, 0x02,
    922     WRITE_C8_D16, 0xC2, 0x07, 0x02,
    923     WRITE_C8_D8, 0xCC, 0x10,
    924     WRITE_C8_D8, 0xCD, 0x08,
    925 
    926     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
    927     WRITE_BYTES, 16,
    928     0x00, 0x11, 0x16, 0x0e,
    929     0x11, 0x06, 0x05, 0x09,
    930     0x08, 0x21, 0x06, 0x13,
    931     0x10, 0x29, 0x31, 0x18,
    932 
    933     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
    934     WRITE_BYTES, 16,
    935     0x00, 0x11, 0x16, 0x0e,
    936     0x11, 0x07, 0x05, 0x09,
    937     0x09, 0x21, 0x05, 0x13,
    938     0x11, 0x2a, 0x31, 0x18,
    939 
    940     WRITE_COMMAND_8, 0xFF,
    941     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
    942 
    943     WRITE_C8_D8, 0xb0, 0x6d,
    944     WRITE_C8_D8, 0xb1, 0x37,
    945     WRITE_C8_D8, 0xb2, 0x81,
    946     WRITE_C8_D8, 0xb3, 0x80,
    947     WRITE_C8_D8, 0xb5, 0x43,
    948     WRITE_C8_D8, 0xb7, 0x85,
    949     WRITE_C8_D8, 0xb8, 0x20,
    950 
    951     WRITE_C8_D8, 0xc1, 0x78,
    952     WRITE_C8_D8, 0xc2, 0x78,
    953 
    954     WRITE_C8_D8, 0xd0, 0x88,
    955 
    956     WRITE_COMMAND_8, 0xe0,
    957     WRITE_BYTES, 3, 0x00, 0x00, 0x02,
    958     WRITE_COMMAND_8, 0xe1,
    959     WRITE_BYTES, 11,
    960     0x03, 0xa0, 0x00, 0x00,
    961     0x04, 0xa0, 0x00, 0x00,
    962     0x00, 0x20, 0x20,
    963     WRITE_COMMAND_8, 0xe2,
    964     WRITE_BYTES, 13,
    965     0x00, 0x00, 0x00, 0x00,
    966     0x00, 0x00, 0x00, 0x00,
    967     0x00, 0x00, 0x00, 0x00,
    968     0x00,
    969     WRITE_COMMAND_8, 0xe3,
    970     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    971     WRITE_C8_D16, 0xe4, 0x22, 0x00,
    972     WRITE_COMMAND_8, 0xe5,
    973     WRITE_BYTES, 16,
    974     0x05, 0xec, 0xa0, 0xa0,
    975     0x07, 0xee, 0xa0, 0xa0,
    976     0x00, 0x00, 0x00, 0x00,
    977     0x00, 0x00, 0x00, 0x00,
    978     WRITE_COMMAND_8, 0xe6,
    979     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x00,
    980     WRITE_C8_D16, 0xe7, 0x22, 0x00,
    981     WRITE_COMMAND_8, 0xe8,
    982     WRITE_BYTES, 16,
    983     0x06, 0xed, 0xa0, 0xa0,
    984     0x08, 0xef, 0xa0, 0xa0,
    985     0x00, 0x00, 0x00, 0x00,
    986     0x00, 0x00, 0x00, 0x00,
    987     WRITE_COMMAND_8, 0xeb,
    988     WRITE_BYTES, 7,
    989     0x00, 0x00, 0x40, 0x40,
    990     0x00, 0x00, 0x00,
    991     WRITE_COMMAND_8, 0xed,
    992     WRITE_BYTES, 16,
    993     0xff, 0xff, 0xff, 0xba,
    994     0x0a, 0xbf, 0x45, 0xff,
    995     0xff, 0x54, 0xfb, 0xa0,
    996     0xab, 0xff, 0xff, 0xff,
    997     WRITE_COMMAND_8, 0xef,
    998     WRITE_BYTES, 6,
    999     0x10, 0x0d, 0x04, 0x08,
   1000     0x3f, 0x1f,
   1001     WRITE_COMMAND_8, 0xff,
   1002     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
   1003     WRITE_C8_D8, 0xef, 0x08,
   1004     WRITE_COMMAND_8, 0xff,
   1005     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
   1006     WRITE_C8_D8, 0x36, 0x00,
   1007     WRITE_C8_D8, 0x3a, 0x66,
   1008     WRITE_C8_D8, 0x11, 0x00,
   1009 
   1010     WRITE_COMMAND_8, 0x11, // Sleep Out
   1011     END_WRITE,
   1012 
   1013     DELAY, 120,
   1014 
   1015     BEGIN_WRITE,
   1016     WRITE_COMMAND_8, 0x29, // Display On
   1017     END_WRITE};
   1018 
   1019 static const uint8_t st7701_type8_init_operations[] = {
   1020     BEGIN_WRITE,
   1021 
   1022     WRITE_COMMAND_8, 0xFF,
   1023     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
   1024 
   1025     WRITE_C8_D8, 0xEF, 0x08,
   1026 
   1027     WRITE_COMMAND_8, 0xFF,
   1028     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x10,
   1029 
   1030     WRITE_C8_D16, 0xC0, 0x2C, 0x00,
   1031     WRITE_C8_D16, 0xC1, 0x0D, 0x02,
   1032     WRITE_C8_D16, 0xC2, 0x31, 0x05,
   1033     WRITE_C8_D8, 0xCC, 0x10,
   1034 
   1035     WRITE_COMMAND_8, 0xB0, // Positive Voltage Gamma Control
   1036     WRITE_BYTES, 16,
   1037     0x0A, 0x14, 0x1B, 0x0D,
   1038     0x10, 0x05, 0x07, 0x08,
   1039     0x06, 0x22, 0x03, 0x11,
   1040     0x10, 0xAD, 0x31, 0x1B,
   1041 
   1042     WRITE_COMMAND_8, 0xB1, // Negative Voltage Gamma Control
   1043     WRITE_BYTES, 16,
   1044     0x0A, 0x14, 0x1B, 0x0D,
   1045     0x10, 0x05, 0x07, 0x08,
   1046     0x06, 0x22, 0x03, 0x11,
   1047     0x10, 0xAD, 0x31, 0x1B,
   1048 
   1049     WRITE_COMMAND_8, 0xFF,
   1050     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x11,
   1051 
   1052     WRITE_C8_D8, 0xB0, 0x50,
   1053     WRITE_C8_D8, 0xB1, 0x5E,
   1054     WRITE_C8_D8, 0xB2, 0x87,
   1055     WRITE_C8_D8, 0xB3, 0x80,
   1056     WRITE_C8_D8, 0xB5, 0x47,
   1057     WRITE_C8_D8, 0xB7, 0x85,
   1058     WRITE_C8_D8, 0xB8, 0x21,
   1059 
   1060     WRITE_C8_D8, 0xC1, 0x78,
   1061     WRITE_C8_D8, 0xC2, 0x78,
   1062 
   1063     WRITE_C8_D8, 0xD0, 0x88,
   1064 
   1065     WRITE_C8_D8, 0xE0, 0x00,
   1066 
   1067     WRITE_C8_D8, 0x1B, 0x02,
   1068 
   1069     WRITE_COMMAND_8, 0xE1,
   1070     WRITE_BYTES, 11,
   1071     0x08, 0xA0, 0x00, 0x00,
   1072     0x07, 0xA0, 0x00, 0x00,
   1073     0x00, 0x44, 0x44,
   1074 
   1075     WRITE_COMMAND_8, 0xE2,
   1076     WRITE_BYTES, 12,
   1077     0x11, 0x11, 0x44, 0x44,
   1078     0x75, 0xA0, 0x00, 0x00,
   1079     0x74, 0xA0, 0x00, 0x00,
   1080 
   1081     WRITE_COMMAND_8, 0xE3,
   1082     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
   1083 
   1084     WRITE_C8_D16, 0xE4, 0x44, 0x44,
   1085 
   1086     WRITE_COMMAND_8, 0xE5,
   1087     WRITE_BYTES, 16,
   1088     0x0A, 0x71, 0xD8, 0xA0,
   1089     0x0C, 0x73, 0xD8, 0xA0,
   1090     0x0E, 0x75, 0xD8, 0xA0,
   1091     0x10, 0x77, 0xD8, 0xA0,
   1092 
   1093     WRITE_COMMAND_8, 0xE6,
   1094     WRITE_BYTES, 4, 0x00, 0x00, 0x11, 0x11,
   1095 
   1096     WRITE_C8_D16, 0xE7, 0x44, 0x44,
   1097 
   1098     WRITE_COMMAND_8, 0xE8,
   1099     WRITE_BYTES, 16,
   1100     0x09, 0x70, 0xD8, 0xA0,
   1101     0x0B, 0x72, 0xD8, 0xA0,
   1102     0x0D, 0x74, 0xD8, 0xA0,
   1103     0x0F, 0x76, 0xD8, 0xA0,
   1104 
   1105     WRITE_COMMAND_8, 0xEB,
   1106     WRITE_BYTES, 7,
   1107     0x02, 0x00, 0xE4, 0xE4,
   1108     0x88, 0x00, 0x40,
   1109 
   1110     WRITE_C8_D16, 0xEC, 0x3C, 0x00,
   1111 
   1112     WRITE_COMMAND_8, 0xED,
   1113     WRITE_BYTES, 16,
   1114     0xAB, 0x89, 0x76, 0x54,
   1115     0x02, 0xFF, 0xFF, 0xFF,
   1116     0xFF, 0xFF, 0xFF, 0x20,
   1117     0x45, 0x67, 0x98, 0xBA,
   1118 
   1119     WRITE_COMMAND_8, 0xEF,
   1120     WRITE_BYTES, 6,
   1121     0x08, 0x08, 0x08, 0x45,
   1122     0x3F, 0x54,
   1123 
   1124     WRITE_COMMAND_8, 0xFF,
   1125     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x13,
   1126 
   1127     WRITE_C8_D16, 0xE8, 0x00, 0x0E,
   1128 
   1129     WRITE_COMMAND_8, 0x20,   // 0x20 normal, 0x21 IPS
   1130     WRITE_C8_D8, 0x3A, 0x50, // 0x70 RGB888, 0x60 RGB666, 0x50 RGB565
   1131 
   1132     WRITE_COMMAND_8, 0x11, // Sleep Out
   1133     END_WRITE,
   1134 
   1135     DELAY, 150,
   1136 
   1137     BEGIN_WRITE,
   1138     WRITE_C8_D16, 0xE8, 0x00, 0x0C,
   1139     END_WRITE,
   1140 
   1141     DELAY, 100,
   1142 
   1143     BEGIN_WRITE,
   1144     WRITE_C8_D16, 0xE8, 0x00, 0x00,
   1145 
   1146     WRITE_COMMAND_8, 0xFF,
   1147     WRITE_BYTES, 5, 0x77, 0x01, 0x00, 0x00, 0x00,
   1148 
   1149     WRITE_COMMAND_8, 0x29, // Display On
   1150     END_WRITE,
   1151     DELAY, 20};
   1152 
   1153 class Arduino_RGB_Display : public Arduino_GFX
   1154 {
   1155 public:
   1156   Arduino_RGB_Display(
   1157       int16_t w, int16_t h, Arduino_ESP32RGBPanel *rgbpanel, uint8_t r = 0, bool auto_flush = true,
   1158       Arduino_DataBus *bus = NULL, int8_t rst = GFX_NOT_DEFINED, const uint8_t *init_operations = NULL, size_t init_operations_len = GFX_NOT_DEFINED);
   1159 
   1160   bool begin(int32_t speed = GFX_NOT_DEFINED) override;
   1161   void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
   1162   void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
   1163   void writeFastVLineCore(int16_t x, int16_t y, int16_t h, uint16_t color);
   1164   void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
   1165   void writeFastHLineCore(int16_t x, int16_t y, int16_t w, uint16_t color);
   1166   void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override;
   1167   void drawIndexedBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint16_t *color_index, int16_t w, int16_t h);
   1168   void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
   1169   void draw16bitBeRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) override;
   1170   void flush(void) override;
   1171 
   1172   uint16_t *getFramebuffer();
   1173 
   1174 protected:
   1175   uint16_t *_framebuffer;
   1176   size_t _framebuffer_size;
   1177   Arduino_ESP32RGBPanel *_rgbpanel;
   1178   bool _auto_flush;
   1179   Arduino_DataBus *_bus;
   1180   int8_t _rst;
   1181   const uint8_t *_init_operations;
   1182   size_t _init_operations_len;
   1183   int16_t MAX_X, MAX_Y;
   1184 
   1185 private:
   1186 };
   1187 
   1188 #endif // _ARDUINO_RGB_DISPLAY_H_
   1189 
   1190 #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)