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 |
ST7796_Init.h (3184B)
1 2 // This is the command sequence that initialises the ST7796 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 TFT_INIT_DELAY 0 9 { 10 delay(120); 11 12 writecommand(0x01); //Software reset 13 delay(120); 14 15 writecommand(0x11); //Sleep exit 16 delay(120); 17 18 writecommand(0xF0); //Command Set control 19 writedata(0xC3); //Enable extension command 2 partI 20 21 writecommand(0xF0); //Command Set control 22 writedata(0x96); //Enable extension command 2 partII 23 24 writecommand(0x36); //Memory Data Access Control MX, MY, RGB mode 25 writedata(0x48); //X-Mirror, Top-Left to right-Buttom, RGB 26 27 writecommand(0x3A); //Interface Pixel Format 28 writedata(0x55); //Control interface color format set to 16 29 30 31 writecommand(0xB4); //Column inversion 32 writedata(0x01); //1-dot inversion 33 34 writecommand(0xB6); //Display Function Control 35 writedata(0x80); //Bypass 36 writedata(0x02); //Source Output Scan from S1 to S960, Gate Output scan from G1 to G480, scan cycle=2 37 writedata(0x3B); //LCD Drive Line=8*(59+1) 38 39 40 writecommand(0xE8); //Display Output Ctrl Adjust 41 writedata(0x40); 42 writedata(0x8A); 43 writedata(0x00); 44 writedata(0x00); 45 writedata(0x29); //Source eqaulizing period time= 22.5 us 46 writedata(0x19); //Timing for "Gate start"=25 (Tclk) 47 writedata(0xA5); //Timing for "Gate End"=37 (Tclk), Gate driver EQ function ON 48 writedata(0x33); 49 50 writecommand(0xC1); //Power control2 51 writedata(0x06); //VAP(GVDD)=3.85+( vcom+vcom offset), VAN(GVCL)=-3.85+( vcom+vcom offset) 52 53 writecommand(0xC2); //Power control 3 54 writedata(0xA7); //Source driving current level=low, Gamma driving current level=High 55 56 writecommand(0xC5); //VCOM Control 57 writedata(0x18); //VCOM=0.9 58 59 delay(120); 60 61 //ST7796 Gamma Sequence 62 writecommand(0xE0); //Gamma"+" 63 writedata(0xF0); 64 writedata(0x09); 65 writedata(0x0b); 66 writedata(0x06); 67 writedata(0x04); 68 writedata(0x15); 69 writedata(0x2F); 70 writedata(0x54); 71 writedata(0x42); 72 writedata(0x3C); 73 writedata(0x17); 74 writedata(0x14); 75 writedata(0x18); 76 writedata(0x1B); 77 78 writecommand(0xE1); //Gamma"-" 79 writedata(0xE0); 80 writedata(0x09); 81 writedata(0x0B); 82 writedata(0x06); 83 writedata(0x04); 84 writedata(0x03); 85 writedata(0x2B); 86 writedata(0x43); 87 writedata(0x42); 88 writedata(0x3B); 89 writedata(0x16); 90 writedata(0x14); 91 writedata(0x17); 92 writedata(0x1B); 93 94 delay(120); 95 96 writecommand(0xF0); //Command Set control 97 writedata(0x3C); //Disable extension command 2 partI 98 99 writecommand(0xF0); //Command Set control 100 writedata(0x69); //Disable extension command 2 partII 101 102 end_tft_write(); 103 delay(120); 104 begin_tft_write(); 105 106 writecommand(0x29); //Display on 107 }