acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

ILI9481_Init.h (16716B)

      1 
      2 // This is the command sequence that initialises the ILI9481 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 #define ILI9481_INIT_1 // Original default
      9 //#define ILI9481_INIT_2 // CPT29
     10 //#define ILI9481_INIT_3 // PVI35
     11 //#define ILI9481_INIT_4 // AUO317
     12 //#define ILI9481_INIT_5 // CMO35 *****
     13 //#define ILI9481_INIT_6 // RGB
     14 //#define ILI9481_INIT_7 // From #1774
     15 //#define ILI9481_INIT_8 // From #1774
     16 
     17 /////////////////////////////////////////////////////////////////////////////////////////
     18 #ifdef ILI9481_INIT_1
     19 // Configure ILI9481 display
     20 
     21     writecommand(TFT_SLPOUT);
     22     delay(20);
     23 
     24     writecommand(0xD0);
     25     writedata(0x07);
     26     writedata(0x42);
     27     writedata(0x18);
     28 
     29     writecommand(0xD1);
     30     writedata(0x00);
     31     writedata(0x07);
     32     writedata(0x10);
     33 
     34     writecommand(0xD2);
     35     writedata(0x01);
     36     writedata(0x02);
     37 
     38     writecommand(0xC0);
     39     writedata(0x10);
     40     writedata(0x3B);
     41     writedata(0x00);
     42     writedata(0x02);
     43     writedata(0x11);
     44 
     45     writecommand(0xC5);
     46     writedata(0x03);
     47 
     48     writecommand(0xC8);
     49     writedata(0x00);
     50     writedata(0x32);
     51     writedata(0x36);
     52     writedata(0x45);
     53     writedata(0x06);
     54     writedata(0x16);
     55     writedata(0x37);
     56     writedata(0x75);
     57     writedata(0x77);
     58     writedata(0x54);
     59     writedata(0x0C);
     60     writedata(0x00);
     61 
     62     writecommand(TFT_MADCTL);
     63     writedata(0x0A);
     64 
     65     writecommand(0x3A);
     66     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
     67       writedata(0x55);           // 16 bit colour interface
     68     #else
     69       writedata(0x66);           // 18 bit colour interface
     70     #endif
     71     
     72     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
     73       writecommand(TFT_INVON);
     74     #endif
     75 
     76     writecommand(TFT_CASET);
     77     writedata(0x00);
     78     writedata(0x00);
     79     writedata(0x01);
     80     writedata(0x3F);
     81 
     82     writecommand(TFT_PASET);
     83     writedata(0x00);
     84     writedata(0x00);
     85     writedata(0x01);
     86     writedata(0xDF);
     87 
     88     delay(120);
     89     writecommand(TFT_DISPON);
     90 
     91     delay(25);
     92 // End of ILI9481 display configuration
     93 /////////////////////////////////////////////////////////////////////////////////////////
     94 #elif defined (ILI9481_INIT_2)
     95 // Configure ILI9481 display
     96 
     97     writecommand(TFT_SLPOUT);
     98     delay(20);
     99 
    100     writecommand(0xD0);
    101     writedata(0x07);
    102     writedata(0x41);
    103     writedata(0x1D);
    104 
    105     writecommand(0xD1);
    106     writedata(0x00);
    107     writedata(0x2B);
    108     writedata(0x1F);
    109 
    110     writecommand(0xD2);
    111     writedata(0x01);
    112     writedata(0x11);
    113 
    114     writecommand(0xC0);
    115     writedata(0x10);
    116     writedata(0x3B);
    117     writedata(0x00);
    118     writedata(0x02);
    119     writedata(0x11);
    120 
    121     writecommand(0xC5);
    122     writedata(0x03);
    123 
    124     writecommand(0xC8);
    125     writedata(0x00);
    126     writedata(0x14);
    127     writedata(0x33);
    128     writedata(0x10);
    129     writedata(0x00);
    130     writedata(0x16);
    131     writedata(0x44);
    132     writedata(0x36);
    133     writedata(0x77);
    134     writedata(0x00);
    135     writedata(0x0F);
    136     writedata(0x00);
    137 
    138     writecommand(0xB0);
    139     writedata(0x00);
    140 
    141     writecommand(0xE4);
    142     writedata(0xA0);
    143     
    144     writecommand(0xF0);
    145     writedata(0x01);
    146 
    147     writecommand(0xF3);
    148     writedata(0x02);
    149     writedata(0x1A);
    150 
    151     writecommand(TFT_MADCTL);
    152     writedata(0x0A);
    153 
    154     writecommand(0x3A);
    155     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    156       writedata(0x55);           // 16 bit colour interface
    157     #else
    158       writedata(0x66);           // 18 bit colour interface
    159     #endif
    160     
    161     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    162       writecommand(TFT_INVON);
    163     #endif
    164 
    165     writecommand(TFT_CASET);
    166     writedata(0x00);
    167     writedata(0x00);
    168     writedata(0x01);
    169     writedata(0x3F);
    170 
    171     writecommand(TFT_PASET);
    172     writedata(0x00);
    173     writedata(0x00);
    174     writedata(0x01);
    175     writedata(0xDF);
    176 
    177     delay(120);
    178     writecommand(TFT_DISPON);
    179 
    180     delay(25);
    181 // End of ILI9481 display configuration
    182 /////////////////////////////////////////////////////////////////////////////////////////
    183 #elif defined (ILI9481_INIT_3)
    184 // Configure ILI9481 display
    185 
    186     writecommand(TFT_SLPOUT);
    187     delay(20);
    188 
    189     writecommand(0xD0);
    190     writedata(0x07);
    191     writedata(0x41);
    192     writedata(0x1D);
    193 
    194     writecommand(0xD1);
    195     writedata(0x00);
    196     writedata(0x2B);
    197     writedata(0x1F);
    198 
    199     writecommand(0xD2);
    200     writedata(0x01);
    201     writedata(0x11);
    202 
    203     writecommand(0xC0);
    204     writedata(0x10);
    205     writedata(0x3B);
    206     writedata(0x00);
    207     writedata(0x02);
    208     writedata(0x11);
    209 
    210     writecommand(0xC5);
    211     writedata(0x03);
    212 
    213     writecommand(0xC8);
    214     writedata(0x00);
    215     writedata(0x14);
    216     writedata(0x33);
    217     writedata(0x10);
    218     writedata(0x00);
    219     writedata(0x16);
    220     writedata(0x44);
    221     writedata(0x36);
    222     writedata(0x77);
    223     writedata(0x00);
    224     writedata(0x0F);
    225     writedata(0x00);
    226 
    227     writecommand(0xB0);
    228     writedata(0x00);
    229 
    230     writecommand(0xE4);
    231     writedata(0xA0);
    232     
    233     writecommand(0xF0);
    234     writedata(0x01);
    235 
    236     writecommand(0xF3);
    237     writedata(0x40);
    238     writedata(0x0A);
    239 
    240     writecommand(TFT_MADCTL);
    241     writedata(0x0A);
    242 
    243     writecommand(0x3A);
    244     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    245       writedata(0x55);           // 16 bit colour interface
    246     #else
    247       writedata(0x66);           // 18 bit colour interface
    248     #endif
    249     
    250     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    251       writecommand(TFT_INVON);
    252     #endif
    253 
    254     writecommand(TFT_CASET);
    255     writedata(0x00);
    256     writedata(0x00);
    257     writedata(0x01);
    258     writedata(0x3F);
    259 
    260     writecommand(TFT_PASET);
    261     writedata(0x00);
    262     writedata(0x00);
    263     writedata(0x01);
    264     writedata(0xDF);
    265 
    266     delay(120);
    267     writecommand(TFT_DISPON);
    268 
    269     delay(25);
    270 // End of ILI9481 display configuration
    271 /////////////////////////////////////////////////////////////////////////////////////////
    272 #elif defined (ILI9481_INIT_4)
    273 // Configure ILI9481 display
    274 
    275     writecommand(TFT_SLPOUT);
    276     delay(20);
    277 
    278     writecommand(0xD0);
    279     writedata(0x07);
    280     writedata(0x40);
    281     writedata(0x1D);
    282 
    283     writecommand(0xD1);
    284     writedata(0x00);
    285     writedata(0x18);
    286     writedata(0x13);
    287 
    288     writecommand(0xD2);
    289     writedata(0x01);
    290     writedata(0x11);
    291 
    292     writecommand(0xC0);
    293     writedata(0x10);
    294     writedata(0x3B);
    295     writedata(0x00);
    296     writedata(0x02);
    297     writedata(0x11);
    298 
    299     writecommand(0xC5);
    300     writedata(0x03);
    301 
    302     writecommand(0xC8);
    303     writedata(0x00);
    304     writedata(0x44);
    305     writedata(0x06);
    306     writedata(0x44);
    307     writedata(0x0A);
    308     writedata(0x08);
    309     writedata(0x17);
    310     writedata(0x33);
    311     writedata(0x77);
    312     writedata(0x44);
    313     writedata(0x08);
    314     writedata(0x0C);
    315 
    316     writecommand(0xB0);
    317     writedata(0x00);
    318 
    319     writecommand(0xE4);
    320     writedata(0xA0);
    321     
    322     writecommand(0xF0);
    323     writedata(0x01);
    324 
    325     writecommand(TFT_MADCTL);
    326     writedata(0x0A);
    327 
    328     writecommand(0x3A);
    329     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    330       writedata(0x55);           // 16 bit colour interface
    331     #else
    332       writedata(0x66);           // 18 bit colour interface
    333     #endif
    334     
    335     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    336       writecommand(TFT_INVON);
    337     #endif
    338 
    339     writecommand(TFT_CASET);
    340     writedata(0x00);
    341     writedata(0x00);
    342     writedata(0x01);
    343     writedata(0x3F);
    344 
    345     writecommand(TFT_PASET);
    346     writedata(0x00);
    347     writedata(0x00);
    348     writedata(0x01);
    349     writedata(0xDF);
    350 
    351     delay(120);
    352     writecommand(TFT_DISPON);
    353 
    354     delay(25);
    355 // End of ILI9481 display configuration
    356 /////////////////////////////////////////////////////////////////////////////////////////
    357 #elif defined (ILI9481_INIT_5)
    358 // Configure ILI9481 display
    359 
    360     writecommand(TFT_SLPOUT);
    361     delay(20);
    362 
    363     writecommand(0xD0);
    364     writedata(0x07);
    365     writedata(0x41);
    366     writedata(0x1D);
    367 
    368     writecommand(0xD1);
    369     writedata(0x00);
    370     writedata(0x1C);
    371     writedata(0x1F);
    372 
    373     writecommand(0xD2);
    374     writedata(0x01);
    375     writedata(0x11);
    376 
    377     writecommand(0xC0);
    378     writedata(0x10);
    379     writedata(0x3B);
    380     writedata(0x00);
    381     writedata(0x02);
    382     writedata(0x11);
    383 
    384     writecommand(0xC5);
    385     writedata(0x03);
    386 
    387     writecommand(0xC6);
    388     writedata(0x83);
    389 
    390     writecommand(0xC8);
    391     writedata(0x00);
    392     writedata(0x26);
    393     writedata(0x21);
    394     writedata(0x00);
    395     writedata(0x00);
    396     writedata(0x1F);
    397     writedata(0x65);
    398     writedata(0x23);
    399     writedata(0x77);
    400     writedata(0x00);
    401     writedata(0x0F);
    402     writedata(0x00);
    403 
    404     writecommand(0xB0);
    405     writedata(0x00);
    406 
    407     writecommand(0xE4);
    408     writedata(0xA0);
    409     
    410     writecommand(0xF0);
    411     writedata(0x01);
    412 
    413     writecommand(TFT_MADCTL);
    414     writedata(0x0A);
    415 
    416     writecommand(0x3A);
    417     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    418       writedata(0x55);           // 16 bit colour interface
    419     #else
    420       writedata(0x66);           // 18 bit colour interface
    421     #endif
    422     
    423     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    424       writecommand(TFT_INVON);
    425     #endif
    426 
    427     writecommand(TFT_CASET);
    428     writedata(0x00);
    429     writedata(0x00);
    430     writedata(0x01);
    431     writedata(0x3F);
    432 
    433     writecommand(TFT_PASET);
    434     writedata(0x00);
    435     writedata(0x00);
    436     writedata(0x01);
    437     writedata(0xDF);
    438 
    439     delay(120);
    440     writecommand(TFT_DISPON);
    441 
    442     delay(25);
    443 // End of ILI9481 display configuration
    444 /////////////////////////////////////////////////////////////////////////////////////////
    445 #elif defined (ILI9481_INIT_6)
    446 // Configure ILI9481 display
    447 
    448     writecommand(TFT_SLPOUT);
    449     delay(20);
    450 
    451     writecommand(0xD0);
    452     writedata(0x07);
    453     writedata(0x41);
    454     writedata(0x1D);
    455 
    456     writecommand(0xD1);
    457     writedata(0x00);
    458     writedata(0x2B);
    459     writedata(0x1F);
    460 
    461     writecommand(0xD2);
    462     writedata(0x01);
    463     writedata(0x11);
    464 
    465     writecommand(0xC0);
    466     writedata(0x10);
    467     writedata(0x3B);
    468     writedata(0x00);
    469     writedata(0x02);
    470     writedata(0x11);
    471     writedata(0x00);
    472 
    473     writecommand(0xC5);
    474     writedata(0x03);
    475 
    476     writecommand(0xC6);
    477     writedata(0x80);
    478 
    479     writecommand(0xC8);
    480     writedata(0x00);
    481     writedata(0x14);
    482     writedata(0x33);
    483     writedata(0x10);
    484     writedata(0x00);
    485     writedata(0x16);
    486     writedata(0x44);
    487     writedata(0x36);
    488     writedata(0x77);
    489     writedata(0x00);
    490     writedata(0x0F);
    491     writedata(0x00);
    492 
    493     writecommand(0xB0);
    494     writedata(0x00);
    495 
    496     writecommand(0xE4);
    497     writedata(0xA0);
    498     
    499     writecommand(0xF0);
    500     writedata(0x08);
    501 
    502     writecommand(0xF3);
    503     writedata(0x40);
    504     writedata(0x0A);
    505 
    506     writecommand(0xF6);
    507     writedata(0x84);
    508 
    509     writecommand(0xF7);
    510     writedata(0x80);
    511 
    512     writecommand(0xB3);
    513     writedata(0x00);
    514     writedata(0x01);
    515     writedata(0x06);
    516     writedata(0x30);
    517 
    518     writecommand(0xB4);
    519     writedata(0x00);
    520 
    521     writecommand(0x0C);
    522     writedata(0x00);
    523     writedata(0x55);
    524 
    525     writecommand(TFT_MADCTL);
    526     writedata(0x0A);
    527 
    528     writecommand(0x3A);
    529     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    530       writedata(0x55);           // 16 bit colour interface
    531     #else
    532       writedata(0x66);           // 18 bit colour interface
    533     #endif
    534     
    535     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    536       writecommand(TFT_INVON);
    537     #endif
    538 
    539     writecommand(TFT_CASET);
    540     writedata(0x00);
    541     writedata(0x00);
    542     writedata(0x01);
    543     writedata(0x3F);
    544 
    545     writecommand(TFT_PASET);
    546     writedata(0x00);
    547     writedata(0x00);
    548     writedata(0x01);
    549     writedata(0xDF);
    550 
    551     delay(120);
    552     writecommand(TFT_DISPON);
    553 
    554     delay(25);
    555 // End of ILI9481 display configuration
    556 /////////////////////////////////////////////////////////////////////////////////////////
    557 
    558 
    559 // From #1774
    560 #elif defined (ILI9481_INIT_7)
    561  ///ili9481+cmi3.5ips //效果不好
    562 					//************* Start Initial Sequence **********//
    563 					writecommand(0x11);
    564 					delay(20);
    565 					writecommand(0xD0);
    566 					writedata(0x07);
    567 					writedata(0x42);
    568 					writedata(0x1B);
    569 
    570 					writecommand(0xD1);
    571 					writedata(0x00);
    572 					writedata(0x14);
    573 					writedata(0x1B);
    574 
    575 					writecommand(0xD2);
    576 					writedata(0x01);
    577 					writedata(0x12);
    578 
    579 					writecommand(0xC0);
    580 					writedata(0x10);
    581 					writedata(0x3B);
    582 					writedata(0x00);
    583 					writedata(0x02);
    584 					writedata(0x01);
    585 
    586 					writecommand(0xC5);
    587 					writedata(0x03);
    588 
    589 					writecommand(0xC8);
    590 					writedata(0x00);
    591 					writedata(0x46);
    592 					writedata(0x44);
    593 					writedata(0x50);
    594 					writedata(0x04);
    595 					writedata(0x16);
    596 					writedata(0x33);
    597 					writedata(0x13);
    598 					writedata(0x77);
    599 					writedata(0x05);
    600 					writedata(0x0F);
    601 					writedata(0x00);
    602 
    603 					writecommand(0x36);
    604 					writedata(0x0A);
    605 
    606 					writecommand(0x3A);
    607     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    608           writedata(0x55);           // 16 bit colour interface
    609     #else
    610           writedata(0x66);           // 18 bit colour interface
    611     #endif
    612     
    613     #if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
    614       writecommand(TFT_INVON);
    615     #endif
    616 
    617 					writecommand(0x22);
    618 					writedata(0x00);
    619 					writedata(0x00);
    620 					writedata(0x01);
    621 					writedata(0x3F);
    622 
    623 					writecommand(0x2B);
    624 					writedata(0x00);
    625 					writedata(0x00);
    626 					writedata(0x01);
    627 					writedata(0xE0);
    628 					delay(120);
    629 					writecommand(0x29);
    630 
    631 #elif defined (ILI9481_INIT_8)
    632 
    633 					//3.5IPS ILI9481+CMI	
    634 					writecommand(0x01); //Soft_rese
    635 					delay(220);
    636 
    637 					writecommand(0x11);
    638 					delay(280);
    639 
    640 					writecommand(0xd0); //Power_Setting
    641 					writedata(0x07);//07  VC[2:0] Sets the ratio factor of Vci to generate the reference voltages Vci1
    642 					writedata(0x44);//41  BT[2:0] Sets the Step up factor and output voltage level from the reference voltages Vci1
    643 					writedata(0x1E);//1f  17   1C  VRH[3:0]: Sets the factor to generate VREG1OUT from VCILVL
    644 					delay(220);
    645 
    646 					writecommand(0xd1); //VCOM Control
    647 					writedata(0x00);//00
    648 					writedata(0x0C);//1A   VCM [6:0] is used to set factor to generate VCOMH voltage from the reference voltage VREG1OUT  15    09
    649 					writedata(0x1A);//1F   VDV[4:0] is used to set the VCOM alternating amplitude in the range of VREG1OUT x 0.70 to VREG1OUT   1F   18
    650 
    651 					writecommand(0xC5);  //Frame Rate
    652 					writedata(0x03); // 03   02
    653 
    654 					writecommand(0xd2);  //Power_Setting for Normal Mode 
    655 					writedata(0x01);  //01
    656 					writedata(0x11);  //11
    657 
    658 					writecommand(0xE4);  //?
    659 					writedata(0xa0);
    660 					writecommand(0xf3);
    661 					writedata(0x00);
    662 					writedata(0x2a);
    663 
    664 					//1  OK
    665 					writecommand(0xc8);
    666 					writedata(0x00);
    667 					writedata(0x26);
    668 					writedata(0x21);
    669 					writedata(0x00);
    670 					writedata(0x00);
    671 					writedata(0x1f);
    672 					writedata(0x65);
    673 					writedata(0x23);
    674 					writedata(0x77);
    675 					writedata(0x00);
    676 					writedata(0x0f);
    677 					writedata(0x00);
    678 					//GAMMA SETTING
    679 
    680 					writecommand(0xC0);	//Panel Driving Setting																          
    681 					writedata(0x00); //1//00  REV  SM  GS
    682 					writedata(0x3B); //2//NL[5:0]: Sets the number of lines to drive the LCD at an interval of 8 lines. 
    683 					writedata(0x00); //3//SCN[6:0]
    684 					writedata(0x02); //4//PTV: Sets the Vcom output in non-display area drive period
    685 					writedata(0x11); //5//NDL: Sets the source output level in non-display area.  PTG: Sets the scan mode in non-display area.
    686 
    687 					writecommand(0xc6); //Interface Control 
    688 					writedata(0x83);
    689 					//GAMMA SETTING 
    690 
    691 					writecommand(0xf0); //?
    692 					writedata(0x01);
    693 
    694 					writecommand(0xE4);//?
    695 					writedata(0xa0);
    696 
    697 					//////倒装设置   NG
    698 					writecommand(0x36);   
    699 					writedata(0x0A); //  8C:出来两行   CA:出来一个点
    700 
    701 					writecommand(0x3a);
    702     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
    703           writedata(0x55);           // 16 bit colour interface
    704     #else
    705           writedata(0x66);           // 18 bit colour interface
    706     #endif
    707     
    708     #if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT)
    709           writecommand(TFT_INVON);
    710     #endif
    711 
    712 					writecommand(0xb4);//Display Mode and Frame Memory Write Mode Setting
    713 					writedata(0x02);
    714 					writedata(0x00); //?
    715 					writedata(0x00);
    716 					writedata(0x01);
    717 
    718 					delay(280);
    719 
    720 					writecommand(0x2a);
    721 					writedata(0x00);
    722 					writedata(0x00);
    723 					writedata(0x01);
    724 					writedata(0x3F); //3F
    725 
    726 					writecommand(0x2b);
    727 					writedata(0x00);
    728 					writedata(0x00);
    729 					writedata(0x01);
    730 					writedata(0xDf); //DF
    731 
    732 					//writecommand(0x21);
    733 					writecommand(0x29);	
    734 					writecommand(0x2c);
    735 
    736 #endif