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 |
ILI9341_Init.h (4898B)
1 2 // This is the command sequence that initialises the ILI9341 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 #if defined (ILI9341_DRIVER) || defined (ILI9342_DRIVER) 9 { 10 writecommand(0xEF); 11 writedata(0x03); 12 writedata(0x80); 13 writedata(0x02); 14 15 writecommand(0xCF); 16 writedata(0x00); 17 writedata(0XC1); 18 writedata(0X30); 19 20 writecommand(0xED); 21 writedata(0x64); 22 writedata(0x03); 23 writedata(0X12); 24 writedata(0X81); 25 26 writecommand(0xE8); 27 writedata(0x85); 28 writedata(0x00); 29 writedata(0x78); 30 31 writecommand(0xCB); 32 writedata(0x39); 33 writedata(0x2C); 34 writedata(0x00); 35 writedata(0x34); 36 writedata(0x02); 37 38 writecommand(0xF7); 39 writedata(0x20); 40 41 writecommand(0xEA); 42 writedata(0x00); 43 writedata(0x00); 44 45 writecommand(ILI9341_PWCTR1); //Power control 46 writedata(0x23); //VRH[5:0] 47 48 writecommand(ILI9341_PWCTR2); //Power control 49 writedata(0x10); //SAP[2:0];BT[3:0] 50 51 writecommand(ILI9341_VMCTR1); //VCM control 52 writedata(0x3e); 53 writedata(0x28); 54 55 writecommand(ILI9341_VMCTR2); //VCM control2 56 writedata(0x86); //-- 57 58 writecommand(ILI9341_MADCTL); // Memory Access Control 59 #ifdef M5STACK 60 writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER); // Rotation 0 (portrait mode) 61 #else 62 writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER); // Rotation 0 (portrait mode) 63 #endif 64 65 writecommand(ILI9341_PIXFMT); 66 writedata(0x55); 67 68 writecommand(ILI9341_FRMCTR1); 69 writedata(0x00); 70 writedata(0x13); // 0x18 79Hz, 0x1B default 70Hz, 0x13 100Hz 71 72 writecommand(ILI9341_DFUNCTR); // Display Function Control 73 writedata(0x08); 74 writedata(0x82); 75 writedata(0x27); 76 77 writecommand(0xF2); // 3Gamma Function Disable 78 writedata(0x00); 79 80 writecommand(ILI9341_GAMMASET); //Gamma curve selected 81 writedata(0x01); 82 83 writecommand(ILI9341_GMCTRP1); //Set Gamma 84 writedata(0x0F); 85 writedata(0x31); 86 writedata(0x2B); 87 writedata(0x0C); 88 writedata(0x0E); 89 writedata(0x08); 90 writedata(0x4E); 91 writedata(0xF1); 92 writedata(0x37); 93 writedata(0x07); 94 writedata(0x10); 95 writedata(0x03); 96 writedata(0x0E); 97 writedata(0x09); 98 writedata(0x00); 99 100 writecommand(ILI9341_GMCTRN1); //Set Gamma 101 writedata(0x00); 102 writedata(0x0E); 103 writedata(0x14); 104 writedata(0x03); 105 writedata(0x11); 106 writedata(0x07); 107 writedata(0x31); 108 writedata(0xC1); 109 writedata(0x48); 110 writedata(0x08); 111 writedata(0x0F); 112 writedata(0x0C); 113 writedata(0x31); 114 writedata(0x36); 115 writedata(0x0F); 116 117 writecommand(ILI9341_SLPOUT); //Exit Sleep 118 119 end_tft_write(); 120 delay(120); 121 begin_tft_write(); 122 123 writecommand(ILI9341_DISPON); //Display on 124 125 } 126 127 #elif defined (ILI9341_2_DRIVER) // Alternative init sequence, see https://github.com/Bodmer/TFT_eSPI/issues/1172 128 129 { 130 writecommand(0xCF); 131 writedata(0x00); 132 writedata(0XC1); 133 writedata(0X30); 134 135 writecommand(0xED); 136 writedata(0x64); 137 writedata(0x03); 138 writedata(0X12); 139 writedata(0X81); 140 141 writecommand(0xE8); 142 writedata(0x85); 143 writedata(0x00); 144 writedata(0x78); 145 146 writecommand(0xCB); 147 writedata(0x39); 148 writedata(0x2C); 149 writedata(0x00); 150 writedata(0x34); 151 writedata(0x02); 152 153 writecommand(0xF7); 154 writedata(0x20); 155 156 writecommand(0xEA); 157 writedata(0x00); 158 writedata(0x00); 159 160 writecommand(ILI9341_PWCTR1); //Power control 161 writedata(0x10); //VRH[5:0] 162 163 writecommand(ILI9341_PWCTR2); //Power control 164 writedata(0x00); //SAP[2:0];BT[3:0] 165 166 writecommand(ILI9341_VMCTR1); //VCM control 167 writedata(0x30); 168 writedata(0x30); 169 170 writecommand(ILI9341_VMCTR2); //VCM control2 171 writedata(0xB7); //-- 172 173 writecommand(ILI9341_PIXFMT); 174 writedata(0x55); 175 176 writecommand(0x36); // Memory Access Control 177 writedata(0x08); // Rotation 0 (portrait mode) 178 179 writecommand(ILI9341_FRMCTR1); 180 writedata(0x00); 181 writedata(0x1A); 182 183 writecommand(ILI9341_DFUNCTR); // Display Function Control 184 writedata(0x08); 185 writedata(0x82); 186 writedata(0x27); 187 188 writecommand(0xF2); // 3Gamma Function Disable 189 writedata(0x00); 190 191 writecommand(0x26); //Gamma curve selected 192 writedata(0x01); 193 194 writecommand(0xE0); //Set Gamma 195 writedata(0x0F); 196 writedata(0x2A); 197 writedata(0x28); 198 writedata(0x08); 199 writedata(0x0E); 200 writedata(0x08); 201 writedata(0x54); 202 writedata(0xA9); 203 writedata(0x43); 204 writedata(0x0A); 205 writedata(0x0F); 206 writedata(0x00); 207 writedata(0x00); 208 writedata(0x00); 209 writedata(0x00); 210 211 writecommand(0XE1); //Set Gamma 212 writedata(0x00); 213 writedata(0x15); 214 writedata(0x17); 215 writedata(0x07); 216 writedata(0x11); 217 writedata(0x06); 218 writedata(0x2B); 219 writedata(0x56); 220 writedata(0x3C); 221 writedata(0x05); 222 writedata(0x10); 223 writedata(0x0F); 224 writedata(0x3F); 225 writedata(0x3F); 226 writedata(0x0F); 227 228 writecommand(0x2B); 229 writedata(0x00); 230 writedata(0x00); 231 writedata(0x01); 232 writedata(0x3f); 233 234 writecommand(0x2A); 235 writedata(0x00); 236 writedata(0x00); 237 writedata(0x00); 238 writedata(0xef); 239 240 writecommand(ILI9341_SLPOUT); //Exit Sleep 241 242 end_tft_write(); 243 delay(120); 244 begin_tft_write(); 245 246 writecommand(ILI9341_DISPON); //Display on 247 } 248 #endif