acidportal

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

HX8357D_Init.h (2813B)

      1 
      2 // This is the command sequence that initialises the HX8357D 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 
      9 // Configure HX8357D display
     10 
     11     // setextc
     12     writecommand(HX8357D_SETC);
     13     writedata(0xFF);
     14     writedata(0x83);
     15     writedata(0x57);
     16     delay(300);
     17 
     18     // setRGB which also enables SDO
     19     writecommand(HX8357_SETRGB); 
     20     writedata(0x80);  //enable SDO pin!
     21 //  writedata(0x00);  //disable SDO pin!
     22     writedata(0x0);
     23     writedata(0x06);
     24     writedata(0x06);
     25 
     26     writecommand(HX8357D_SETCOM);
     27     writedata(0x25);  // -1.52V
     28     
     29     writecommand(HX8357_SETOSC);
     30     writedata(0x68);  // Normal mode 70Hz, Idle mode 55 Hz
     31     
     32     writecommand(HX8357_SETPANEL); //Set Panel
     33     writedata(0x05);  // BGR, Gate direction swapped
     34     
     35     writecommand(HX8357_SETPWR1);
     36     writedata(0x00);  // Not deep standby
     37     writedata(0x15);  //BT
     38     writedata(0x1C);  //VSPR
     39     writedata(0x1C);  //VSNR
     40     writedata(0x83);  //AP
     41     writedata(0xAA);  //FS
     42 
     43     writecommand(HX8357D_SETSTBA);  
     44     writedata(0x50);  //OPON normal
     45     writedata(0x50);  //OPON idle
     46     writedata(0x01);  //STBA
     47     writedata(0x3C);  //STBA
     48     writedata(0x1E);  //STBA
     49     writedata(0x08);  //GEN
     50     
     51     writecommand(HX8357D_SETCYC);  
     52     writedata(0x02);  //NW 0x02
     53     writedata(0x40);  //RTN
     54     writedata(0x00);  //DIV
     55     writedata(0x2A);  //DUM
     56     writedata(0x2A);  //DUM
     57     writedata(0x0D);  //GDON
     58     writedata(0x78);  //GDOFF
     59 
     60     writecommand(HX8357D_SETGAMMA); 
     61     writedata(0x02);
     62     writedata(0x0A);
     63     writedata(0x11);
     64     writedata(0x1d);
     65     writedata(0x23);
     66     writedata(0x35);
     67     writedata(0x41);
     68     writedata(0x4b);
     69     writedata(0x4b);
     70     writedata(0x42);
     71     writedata(0x3A);
     72     writedata(0x27);
     73     writedata(0x1B);
     74     writedata(0x08);
     75     writedata(0x09);
     76     writedata(0x03);
     77     writedata(0x02);
     78     writedata(0x0A);
     79     writedata(0x11);
     80     writedata(0x1d);
     81     writedata(0x23);
     82     writedata(0x35);
     83     writedata(0x41);
     84     writedata(0x4b);
     85     writedata(0x4b);
     86     writedata(0x42);
     87     writedata(0x3A);
     88     writedata(0x27);
     89     writedata(0x1B);
     90     writedata(0x08);
     91     writedata(0x09);
     92     writedata(0x03);
     93     writedata(0x00);
     94     writedata(0x01);
     95     
     96     writecommand(HX8357_COLMOD);
     97     writedata(0x55);  // 16 bit
     98     
     99     writecommand(HX8357_MADCTL);  
    100     writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER); 
    101     
    102     writecommand(HX8357_TEON);  // TE off
    103     writedata(0x00); 
    104     
    105     writecommand(HX8357_TEARLINE);  // tear line
    106     writedata(0x00); 
    107     writedata(0x02);
    108 
    109     writecommand(HX8357_SLPOUT);  //Exit Sleep
    110     delay(150);
    111     
    112     writecommand(HX8357_DISPON);  // display on
    113     delay(50);
    114 
    115 // End of HX8357D display configuration
    116 
    117 
    118