David Prentice
/
Nucleo_dir_L152
Please run it on your NUCLEO-L152
MCUFRIEND_kbv/MCUFRIEND_kbv.cpp@1:d88d2ad55fac, 2019-09-18 (annotated)
- Committer:
- davidprentice
- Date:
- Wed Sep 18 10:38:19 2019 +0000
- Revision:
- 1:d88d2ad55fac
- Parent:
- 0:b608c7f02f80
Added messages to Serial Terminal (9600 baud)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davidprentice | 0:b608c7f02f80 | 1 | //#define SUPPORT_0139 //S6D0139 +280 bytes |
davidprentice | 0:b608c7f02f80 | 2 | #define SUPPORT_0154 //S6D0154 +320 bytes |
davidprentice | 0:b608c7f02f80 | 3 | //#define SUPPORT_1289 //SSD1289,SSD1297 (ID=0x9797) +626 bytes, 0.03s |
davidprentice | 0:b608c7f02f80 | 4 | //#define SUPPORT_1580 //R61580 Untested |
davidprentice | 0:b608c7f02f80 | 5 | #define SUPPORT_1963 //only works with 16BIT bus anyway |
davidprentice | 0:b608c7f02f80 | 6 | //#define SUPPORT_4532 //LGDP4532 +120 bytes. thanks Leodino |
davidprentice | 0:b608c7f02f80 | 7 | #define SUPPORT_4535 //LGDP4535 +180 bytes |
davidprentice | 0:b608c7f02f80 | 8 | #define SUPPORT_68140 //RM68140 +52 bytes defaults to PIXFMT=0x55 |
davidprentice | 0:b608c7f02f80 | 9 | //#define SUPPORT_7735 |
davidprentice | 0:b608c7f02f80 | 10 | #define SUPPORT_7781 //ST7781 +172 bytes |
davidprentice | 0:b608c7f02f80 | 11 | //#define SUPPORT_8230 //UC8230 +118 bytes |
davidprentice | 0:b608c7f02f80 | 12 | //#define SUPPORT_8347D //HX8347-D, HX8347-G, HX8347-I, HX8367-A +520 bytes, 0.27s |
davidprentice | 0:b608c7f02f80 | 13 | //#define SUPPORT_8347A //HX8347-A +500 bytes, 0.27s |
davidprentice | 0:b608c7f02f80 | 14 | //#define SUPPORT_8352A //HX8352A +486 bytes, 0.27s |
davidprentice | 0:b608c7f02f80 | 15 | //#define SUPPORT_8352B //HX8352B |
davidprentice | 0:b608c7f02f80 | 16 | //#define SUPPORT_8357D_GAMMA //monster 34 byte |
davidprentice | 0:b608c7f02f80 | 17 | //#define SUPPORT_9163 // |
davidprentice | 0:b608c7f02f80 | 18 | //#define SUPPORT_9225 //ILI9225-B, ILI9225-G ID=0x9225, ID=0x9226, ID=0x6813 +380 bytes |
davidprentice | 0:b608c7f02f80 | 19 | //#define SUPPORT_9326_5420 //ILI9326, SPFD5420 +246 bytes |
davidprentice | 0:b608c7f02f80 | 20 | //#define SUPPORT_9342 //costs +114 bytes |
davidprentice | 0:b608c7f02f80 | 21 | //#define SUPPORT_9806 //UNTESTED |
davidprentice | 0:b608c7f02f80 | 22 | #define SUPPORT_9488_555 //costs +230 bytes, 0.03s / 0.19s |
davidprentice | 0:b608c7f02f80 | 23 | #define SUPPORT_B509_7793 //R61509, ST7793 +244 bytes |
davidprentice | 0:b608c7f02f80 | 24 | #define OFFSET_9327 32 //costs about 103 bytes, 0.08s |
davidprentice | 0:b608c7f02f80 | 25 | |
davidprentice | 0:b608c7f02f80 | 26 | #include "MCUFRIEND_kbv.h" |
davidprentice | 0:b608c7f02f80 | 27 | #if defined(USE_SERIAL) |
davidprentice | 0:b608c7f02f80 | 28 | #include "utility/mcufriend_serial.h" |
davidprentice | 0:b608c7f02f80 | 29 | //uint8_t running; |
davidprentice | 0:b608c7f02f80 | 30 | #elif defined(__MBED__) |
davidprentice | 0:b608c7f02f80 | 31 | #include "utility/mcufriend_mbed.h" |
davidprentice | 0:b608c7f02f80 | 32 | #elif defined(__CC_ARM) || defined(__CROSSWORKS_ARM) |
davidprentice | 0:b608c7f02f80 | 33 | #include "utility/mcufriend_keil.h" |
davidprentice | 0:b608c7f02f80 | 34 | #else |
davidprentice | 0:b608c7f02f80 | 35 | #include "utility/mcufriend_shield.h" |
davidprentice | 0:b608c7f02f80 | 36 | #endif |
davidprentice | 0:b608c7f02f80 | 37 | |
davidprentice | 0:b608c7f02f80 | 38 | #define MIPI_DCS_REV1 (1<<0) |
davidprentice | 0:b608c7f02f80 | 39 | #define AUTO_READINC (1<<1) |
davidprentice | 0:b608c7f02f80 | 40 | #define READ_BGR (1<<2) |
davidprentice | 0:b608c7f02f80 | 41 | #define READ_LOWHIGH (1<<3) |
davidprentice | 0:b608c7f02f80 | 42 | #define READ_24BITS (1<<4) |
davidprentice | 0:b608c7f02f80 | 43 | #define XSA_XEA_16BIT (1<<5) |
davidprentice | 0:b608c7f02f80 | 44 | #define READ_NODUMMY (1<<6) |
davidprentice | 0:b608c7f02f80 | 45 | #define INVERT_GS (1<<8) |
davidprentice | 0:b608c7f02f80 | 46 | #define INVERT_SS (1<<9) |
davidprentice | 0:b608c7f02f80 | 47 | #define MV_AXIS (1<<10) |
davidprentice | 0:b608c7f02f80 | 48 | #define INVERT_RGB (1<<11) |
davidprentice | 0:b608c7f02f80 | 49 | #define REV_SCREEN (1<<12) |
davidprentice | 0:b608c7f02f80 | 50 | #define FLIP_VERT (1<<13) |
davidprentice | 0:b608c7f02f80 | 51 | #define FLIP_HORIZ (1<<14) |
davidprentice | 0:b608c7f02f80 | 52 | |
davidprentice | 0:b608c7f02f80 | 53 | #if (defined(USES_16BIT_BUS)) //only comes from SPECIALs |
davidprentice | 0:b608c7f02f80 | 54 | #define USING_16BIT_BUS 1 |
davidprentice | 0:b608c7f02f80 | 55 | #else |
davidprentice | 0:b608c7f02f80 | 56 | #define USING_16BIT_BUS 0 |
davidprentice | 0:b608c7f02f80 | 57 | #endif |
davidprentice | 0:b608c7f02f80 | 58 | |
davidprentice | 0:b608c7f02f80 | 59 | MCUFRIEND_kbv::MCUFRIEND_kbv(int CS, int RS, int WR, int RD, int _RST):Adafruit_GFX(240, 320) |
davidprentice | 0:b608c7f02f80 | 60 | { |
davidprentice | 0:b608c7f02f80 | 61 | // we can not access GPIO pins until AHB has been enabled. |
davidprentice | 0:b608c7f02f80 | 62 | } |
davidprentice | 0:b608c7f02f80 | 63 | |
davidprentice | 0:b608c7f02f80 | 64 | static uint8_t done_reset, is8347, is555, is9797; |
davidprentice | 0:b608c7f02f80 | 65 | static uint16_t color565_to_555(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 66 | return (color & 0xFFC0) | ((color & 0x1F) << 1) | ((color & 0x01)); //lose Green LSB, extend Blue LSB |
davidprentice | 0:b608c7f02f80 | 67 | } |
davidprentice | 0:b608c7f02f80 | 68 | static uint16_t color555_to_565(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 69 | return (color & 0xFFC0) | ((color & 0x0400) >> 5) | ((color & 0x3F) >> 1); //extend Green LSB |
davidprentice | 0:b608c7f02f80 | 70 | } |
davidprentice | 0:b608c7f02f80 | 71 | static uint8_t color565_to_r(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 72 | return ((color & 0xF800) >> 8); // transform to rrrrrxxx |
davidprentice | 0:b608c7f02f80 | 73 | } |
davidprentice | 0:b608c7f02f80 | 74 | static uint8_t color565_to_g(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 75 | return ((color & 0x07E0) >> 3); // transform to ggggggxx |
davidprentice | 0:b608c7f02f80 | 76 | } |
davidprentice | 0:b608c7f02f80 | 77 | static uint8_t color565_to_b(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 78 | return ((color & 0x001F) << 3); // transform to bbbbbxxx |
davidprentice | 0:b608c7f02f80 | 79 | } |
davidprentice | 0:b608c7f02f80 | 80 | static void write24(uint16_t color) { |
davidprentice | 0:b608c7f02f80 | 81 | uint8_t r = color565_to_r(color); |
davidprentice | 0:b608c7f02f80 | 82 | uint8_t g = color565_to_g(color); |
davidprentice | 0:b608c7f02f80 | 83 | uint8_t b = color565_to_b(color); |
davidprentice | 0:b608c7f02f80 | 84 | write8(r); |
davidprentice | 0:b608c7f02f80 | 85 | write8(g); |
davidprentice | 0:b608c7f02f80 | 86 | write8(b); |
davidprentice | 0:b608c7f02f80 | 87 | } |
davidprentice | 0:b608c7f02f80 | 88 | |
davidprentice | 0:b608c7f02f80 | 89 | void MCUFRIEND_kbv::reset(void) |
davidprentice | 0:b608c7f02f80 | 90 | { |
davidprentice | 0:b608c7f02f80 | 91 | done_reset = 1; |
davidprentice | 0:b608c7f02f80 | 92 | setWriteDir(); |
davidprentice | 0:b608c7f02f80 | 93 | CTL_INIT(); |
davidprentice | 0:b608c7f02f80 | 94 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 95 | RD_IDLE; |
davidprentice | 0:b608c7f02f80 | 96 | WR_IDLE; |
davidprentice | 0:b608c7f02f80 | 97 | RESET_IDLE; |
davidprentice | 0:b608c7f02f80 | 98 | delay(50); |
davidprentice | 0:b608c7f02f80 | 99 | RESET_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 100 | delay(100); |
davidprentice | 0:b608c7f02f80 | 101 | RESET_IDLE; |
davidprentice | 0:b608c7f02f80 | 102 | delay(100); |
davidprentice | 0:b608c7f02f80 | 103 | WriteCmdData(0xB0, 0x0000); //R61520 needs this to read ID |
davidprentice | 0:b608c7f02f80 | 104 | } |
davidprentice | 0:b608c7f02f80 | 105 | |
davidprentice | 0:b608c7f02f80 | 106 | static void writecmddata(uint16_t cmd, uint16_t dat) |
davidprentice | 0:b608c7f02f80 | 107 | { |
davidprentice | 0:b608c7f02f80 | 108 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 109 | WriteCmd(cmd); |
davidprentice | 0:b608c7f02f80 | 110 | WriteData(dat); |
davidprentice | 0:b608c7f02f80 | 111 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 112 | } |
davidprentice | 0:b608c7f02f80 | 113 | |
davidprentice | 0:b608c7f02f80 | 114 | void MCUFRIEND_kbv::WriteCmdData(uint16_t cmd, uint16_t dat) { writecmddata(cmd, dat); } |
davidprentice | 0:b608c7f02f80 | 115 | |
davidprentice | 0:b608c7f02f80 | 116 | static void WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t * block) |
davidprentice | 0:b608c7f02f80 | 117 | { |
davidprentice | 0:b608c7f02f80 | 118 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 119 | WriteCmd(cmd); |
davidprentice | 0:b608c7f02f80 | 120 | while (N-- > 0) { |
davidprentice | 0:b608c7f02f80 | 121 | uint8_t u8 = *block++; |
davidprentice | 0:b608c7f02f80 | 122 | write8(u8); |
davidprentice | 0:b608c7f02f80 | 123 | if (N && is8347) { |
davidprentice | 0:b608c7f02f80 | 124 | cmd++; |
davidprentice | 0:b608c7f02f80 | 125 | WriteCmd(cmd); |
davidprentice | 0:b608c7f02f80 | 126 | } |
davidprentice | 0:b608c7f02f80 | 127 | } |
davidprentice | 0:b608c7f02f80 | 128 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 129 | } |
davidprentice | 0:b608c7f02f80 | 130 | |
davidprentice | 0:b608c7f02f80 | 131 | static inline void WriteCmdParam4(uint8_t cmd, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4) |
davidprentice | 0:b608c7f02f80 | 132 | { |
davidprentice | 0:b608c7f02f80 | 133 | uint8_t d[4]; |
davidprentice | 0:b608c7f02f80 | 134 | d[0] = d1, d[1] = d2, d[2] = d3, d[3] = d4; |
davidprentice | 0:b608c7f02f80 | 135 | WriteCmdParamN(cmd, 4, d); |
davidprentice | 0:b608c7f02f80 | 136 | } |
davidprentice | 0:b608c7f02f80 | 137 | |
davidprentice | 0:b608c7f02f80 | 138 | //#define WriteCmdParam4(cmd, d1, d2, d3, d4) {uint8_t d[4];d[0] = d1, d[1] = d2, d[2] = d3, d[3] = d4;WriteCmdParamN(cmd, 4, d);} |
davidprentice | 0:b608c7f02f80 | 139 | void MCUFRIEND_kbv::pushCommand(uint16_t cmd, uint8_t * block, int8_t N) { WriteCmdParamN(cmd, N, block); } |
davidprentice | 0:b608c7f02f80 | 140 | |
davidprentice | 0:b608c7f02f80 | 141 | static uint16_t read16bits(void) |
davidprentice | 0:b608c7f02f80 | 142 | { |
davidprentice | 0:b608c7f02f80 | 143 | uint16_t ret; |
davidprentice | 0:b608c7f02f80 | 144 | uint8_t lo; |
davidprentice | 0:b608c7f02f80 | 145 | #if USING_16BIT_BUS |
davidprentice | 0:b608c7f02f80 | 146 | READ_16(ret); //single strobe to read whole bus |
davidprentice | 0:b608c7f02f80 | 147 | if (ret > 255) //ID might say 0x00D3 |
davidprentice | 0:b608c7f02f80 | 148 | return ret; |
davidprentice | 0:b608c7f02f80 | 149 | #else |
davidprentice | 0:b608c7f02f80 | 150 | READ_8(ret); |
davidprentice | 0:b608c7f02f80 | 151 | #endif |
davidprentice | 0:b608c7f02f80 | 152 | //all MIPI_DCS_REV1 style params are 8-bit |
davidprentice | 0:b608c7f02f80 | 153 | READ_8(lo); |
davidprentice | 0:b608c7f02f80 | 154 | return (ret << 8) | lo; |
davidprentice | 0:b608c7f02f80 | 155 | } |
davidprentice | 0:b608c7f02f80 | 156 | |
davidprentice | 0:b608c7f02f80 | 157 | uint16_t MCUFRIEND_kbv::readReg(uint16_t reg, int8_t index) |
davidprentice | 0:b608c7f02f80 | 158 | { |
davidprentice | 0:b608c7f02f80 | 159 | uint16_t ret; |
davidprentice | 0:b608c7f02f80 | 160 | uint8_t lo; |
davidprentice | 0:b608c7f02f80 | 161 | if (!done_reset) |
davidprentice | 0:b608c7f02f80 | 162 | reset(); |
davidprentice | 0:b608c7f02f80 | 163 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 164 | WriteCmd(reg); |
davidprentice | 0:b608c7f02f80 | 165 | setReadDir(); |
davidprentice | 0:b608c7f02f80 | 166 | delay(1); //1us should be adequate |
davidprentice | 0:b608c7f02f80 | 167 | // READ_16(ret); |
davidprentice | 0:b608c7f02f80 | 168 | do { ret = read16bits(); }while (--index >= 0); //need to test with SSD1963 |
davidprentice | 0:b608c7f02f80 | 169 | RD_IDLE; |
davidprentice | 0:b608c7f02f80 | 170 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 171 | setWriteDir(); |
davidprentice | 0:b608c7f02f80 | 172 | return ret; |
davidprentice | 0:b608c7f02f80 | 173 | } |
davidprentice | 0:b608c7f02f80 | 174 | |
davidprentice | 0:b608c7f02f80 | 175 | uint32_t MCUFRIEND_kbv::readReg32(uint16_t reg) |
davidprentice | 0:b608c7f02f80 | 176 | { |
davidprentice | 0:b608c7f02f80 | 177 | uint16_t h = readReg(reg, 0); |
davidprentice | 0:b608c7f02f80 | 178 | uint16_t l = readReg(reg, 1); |
davidprentice | 0:b608c7f02f80 | 179 | return ((uint32_t) h << 16) | (l); |
davidprentice | 0:b608c7f02f80 | 180 | } |
davidprentice | 0:b608c7f02f80 | 181 | |
davidprentice | 0:b608c7f02f80 | 182 | uint32_t MCUFRIEND_kbv::readReg40(uint16_t reg) |
davidprentice | 0:b608c7f02f80 | 183 | { |
davidprentice | 0:b608c7f02f80 | 184 | uint16_t h = readReg(reg, 0); |
davidprentice | 0:b608c7f02f80 | 185 | uint16_t m = readReg(reg, 1); |
davidprentice | 0:b608c7f02f80 | 186 | uint16_t l = readReg(reg, 2); |
davidprentice | 0:b608c7f02f80 | 187 | return ((uint32_t) h << 24) | (m << 8) | (l >> 8); |
davidprentice | 0:b608c7f02f80 | 188 | } |
davidprentice | 0:b608c7f02f80 | 189 | |
davidprentice | 0:b608c7f02f80 | 190 | uint16_t MCUFRIEND_kbv::readID(void) |
davidprentice | 0:b608c7f02f80 | 191 | { |
davidprentice | 0:b608c7f02f80 | 192 | uint16_t ret, ret2; |
davidprentice | 0:b608c7f02f80 | 193 | uint8_t msb; |
davidprentice | 0:b608c7f02f80 | 194 | ret = readReg(0); //forces a reset() if called before begin() |
davidprentice | 0:b608c7f02f80 | 195 | if (ret == 0x5408) //the SPFD5408 fails the 0xD3D3 test. |
davidprentice | 0:b608c7f02f80 | 196 | return 0x5408; |
davidprentice | 0:b608c7f02f80 | 197 | if (ret == 0x5420) //the SPFD5420 fails the 0xD3D3 test. |
davidprentice | 0:b608c7f02f80 | 198 | return 0x5420; |
davidprentice | 0:b608c7f02f80 | 199 | if (ret == 0x8989) //SSD1289 is always 8989 |
davidprentice | 0:b608c7f02f80 | 200 | return 0x1289; |
davidprentice | 0:b608c7f02f80 | 201 | ret = readReg(0x67); //HX8347-A |
davidprentice | 0:b608c7f02f80 | 202 | if (ret == 0x4747) |
davidprentice | 0:b608c7f02f80 | 203 | return 0x8347; |
davidprentice | 0:b608c7f02f80 | 204 | //#if defined(SUPPORT_1963) && USING_16BIT_BUS |
davidprentice | 0:b608c7f02f80 | 205 | ret = readReg32(0xA1); //SSD1963: [01 57 61 01] |
davidprentice | 0:b608c7f02f80 | 206 | if (ret == 0x6101) |
davidprentice | 0:b608c7f02f80 | 207 | return 0x1963; |
davidprentice | 0:b608c7f02f80 | 208 | if (ret == 0xFFFF) //R61526: [xx FF FF FF] |
davidprentice | 0:b608c7f02f80 | 209 | return 0x1526; //subsequent begin() enables Command Access |
davidprentice | 0:b608c7f02f80 | 210 | // if (ret == 0xFF00) //R61520: [xx FF FF 00] |
davidprentice | 0:b608c7f02f80 | 211 | // return 0x1520; //subsequent begin() enables Command Access |
davidprentice | 0:b608c7f02f80 | 212 | //#endif |
davidprentice | 0:b608c7f02f80 | 213 | ret = readReg40(0xBF); |
davidprentice | 0:b608c7f02f80 | 214 | if (ret == 0x8357) //HX8357B: [xx 01 62 83 57 FF] |
davidprentice | 0:b608c7f02f80 | 215 | return 0x8357; |
davidprentice | 0:b608c7f02f80 | 216 | if (ret == 0x9481) //ILI9481: [xx 02 04 94 81 FF] |
davidprentice | 0:b608c7f02f80 | 217 | return 0x9481; |
davidprentice | 0:b608c7f02f80 | 218 | if (ret == 0x1511) //?R61511: [xx 02 04 15 11] not tested yet |
davidprentice | 0:b608c7f02f80 | 219 | return 0x1511; |
davidprentice | 0:b608c7f02f80 | 220 | if (ret == 0x1520) //?R61520: [xx 01 22 15 20] |
davidprentice | 0:b608c7f02f80 | 221 | return 0x1520; |
davidprentice | 0:b608c7f02f80 | 222 | if (ret == 0x1526) //?R61526: [xx 01 22 15 26] |
davidprentice | 0:b608c7f02f80 | 223 | return 0x1526; |
davidprentice | 0:b608c7f02f80 | 224 | if (ret == 0x1581) //R61581: [xx 01 22 15 81] |
davidprentice | 0:b608c7f02f80 | 225 | return 0x1581; |
davidprentice | 0:b608c7f02f80 | 226 | if (ret == 0x1400) //?RM68140:[xx FF 68 14 00] not tested yet |
davidprentice | 0:b608c7f02f80 | 227 | return 0x6814; |
davidprentice | 0:b608c7f02f80 | 228 | ret = readReg32(0xD4); |
davidprentice | 0:b608c7f02f80 | 229 | if (ret == 0x5310) //NT35310: [xx 01 53 10] |
davidprentice | 0:b608c7f02f80 | 230 | return 0x5310; |
davidprentice | 0:b608c7f02f80 | 231 | ret = readReg32(0xD7); |
davidprentice | 0:b608c7f02f80 | 232 | if (ret == 0x8031) //weird unknown from BangGood [xx 20 80 31] PrinceCharles |
davidprentice | 0:b608c7f02f80 | 233 | return 0x8031; |
davidprentice | 0:b608c7f02f80 | 234 | ret = readReg40(0xEF); //ILI9327: [xx 02 04 93 27 FF] |
davidprentice | 0:b608c7f02f80 | 235 | if (ret == 0x9327) |
davidprentice | 0:b608c7f02f80 | 236 | return 0x9327; |
davidprentice | 0:b608c7f02f80 | 237 | ret = readReg32(0xFE) >> 8; //weird unknown from BangGood [04 20 53] |
davidprentice | 0:b608c7f02f80 | 238 | if (ret == 0x2053) |
davidprentice | 0:b608c7f02f80 | 239 | return 0x2053; |
davidprentice | 0:b608c7f02f80 | 240 | uint32_t ret32 = readReg32(0x04); |
davidprentice | 0:b608c7f02f80 | 241 | msb = ret32 >> 16; |
davidprentice | 0:b608c7f02f80 | 242 | ret = ret32; |
davidprentice | 0:b608c7f02f80 | 243 | // if (msb = 0x38 && ret == 0x8000) //unknown [xx 38 80 00] with D3 = 0x1602 |
davidprentice | 0:b608c7f02f80 | 244 | if (msb == 0x00 && ret == 0x8000) { //HX8357-D [xx 00 80 00] |
davidprentice | 0:b608c7f02f80 | 245 | #if 1 |
davidprentice | 0:b608c7f02f80 | 246 | uint8_t cmds[] = {0xFF, 0x83, 0x57}; |
davidprentice | 0:b608c7f02f80 | 247 | pushCommand(0xB9, cmds, 3); |
davidprentice | 0:b608c7f02f80 | 248 | msb = readReg(0xD0); |
davidprentice | 0:b608c7f02f80 | 249 | if (msb == 0x99) return 0x0099; //HX8357-D from datasheet |
davidprentice | 0:b608c7f02f80 | 250 | if (msb == 0x90) //HX8357-C undocumented |
davidprentice | 0:b608c7f02f80 | 251 | #endif |
davidprentice | 0:b608c7f02f80 | 252 | return 0x9090; //BIG CHANGE: HX8357-D was 0x8357 |
davidprentice | 0:b608c7f02f80 | 253 | } |
davidprentice | 0:b608c7f02f80 | 254 | // if (msb == 0xFF && ret == 0xFFFF) //R61526 [xx FF FF FF] |
davidprentice | 0:b608c7f02f80 | 255 | // return 0x1526; //subsequent begin() enables Command Access |
davidprentice | 0:b608c7f02f80 | 256 | if (ret == 0x1526) //R61526 [xx 06 15 26] if I have written NVM |
davidprentice | 0:b608c7f02f80 | 257 | return 0x1526; //subsequent begin() enables Command Access |
davidprentice | 0:b608c7f02f80 | 258 | if (ret == 0x89F0) //ST7735S: [xx 7C 89 F0] |
davidprentice | 0:b608c7f02f80 | 259 | return 0x7735; |
davidprentice | 0:b608c7f02f80 | 260 | if (ret == 0x8552) //ST7789V: [xx 85 85 52] |
davidprentice | 0:b608c7f02f80 | 261 | return 0x7789; |
davidprentice | 0:b608c7f02f80 | 262 | if (ret == 0xAC11) //?unknown [xx 61 AC 11] |
davidprentice | 0:b608c7f02f80 | 263 | return 0xAC11; |
davidprentice | 0:b608c7f02f80 | 264 | ret32 = readReg32(0xD3); //[xx 91 63 00] |
davidprentice | 0:b608c7f02f80 | 265 | ret = ret32 >> 8; |
davidprentice | 0:b608c7f02f80 | 266 | if (ret == 0x9163) return ret; |
davidprentice | 0:b608c7f02f80 | 267 | ret = readReg32(0xD3); //for ILI9488, 9486, 9340, 9341 |
davidprentice | 0:b608c7f02f80 | 268 | msb = ret >> 8; |
davidprentice | 0:b608c7f02f80 | 269 | if (msb == 0x93 || msb == 0x94 || msb == 0x98 || msb == 0x77 || msb == 0x16) |
davidprentice | 0:b608c7f02f80 | 270 | return ret; //0x9488, 9486, 9340, 9341, 7796 |
davidprentice | 0:b608c7f02f80 | 271 | if (ret == 0x00D3 || ret == 0xD3D3) |
davidprentice | 0:b608c7f02f80 | 272 | return ret; //16-bit write-only bus |
davidprentice | 0:b608c7f02f80 | 273 | /* |
davidprentice | 0:b608c7f02f80 | 274 | msb = 0x12; //read 3rd,4th byte. does not work in parallel |
davidprentice | 0:b608c7f02f80 | 275 | pushCommand(0xD9, &msb, 1); |
davidprentice | 0:b608c7f02f80 | 276 | ret2 = readReg(0xD3); |
davidprentice | 0:b608c7f02f80 | 277 | msb = 0x13; |
davidprentice | 0:b608c7f02f80 | 278 | pushCommand(0xD9, &msb, 1); |
davidprentice | 0:b608c7f02f80 | 279 | ret = (ret2 << 8) | readReg(0xD3); |
davidprentice | 0:b608c7f02f80 | 280 | // if (ret2 == 0x93) |
davidprentice | 0:b608c7f02f80 | 281 | return ret2; |
davidprentice | 0:b608c7f02f80 | 282 | */ |
davidprentice | 0:b608c7f02f80 | 283 | return readReg(0); //0154, 7783, 9320, 9325, 9335, B505, B509 |
davidprentice | 0:b608c7f02f80 | 284 | } |
davidprentice | 0:b608c7f02f80 | 285 | |
davidprentice | 0:b608c7f02f80 | 286 | // independent cursor and window registers. S6D0154, ST7781 increments. ILI92320/5 do not. |
davidprentice | 0:b608c7f02f80 | 287 | int16_t MCUFRIEND_kbv::readGRAM(int16_t x, int16_t y, uint16_t * block, int16_t w, int16_t h) |
davidprentice | 0:b608c7f02f80 | 288 | { |
davidprentice | 0:b608c7f02f80 | 289 | uint16_t ret, dummy, _MR = _MW; |
davidprentice | 0:b608c7f02f80 | 290 | int16_t n = w * h, row = 0, col = 0; |
davidprentice | 0:b608c7f02f80 | 291 | uint8_t r, g, b, tmp; |
davidprentice | 0:b608c7f02f80 | 292 | if (!is8347 && _lcd_capable & MIPI_DCS_REV1) // HX8347 uses same register |
davidprentice | 0:b608c7f02f80 | 293 | _MR = 0x2E; |
davidprentice | 0:b608c7f02f80 | 294 | if (_lcd_ID == 0x1602) _MR = 0x2E; |
davidprentice | 0:b608c7f02f80 | 295 | setAddrWindow(x, y, x + w - 1, y + h - 1); |
davidprentice | 0:b608c7f02f80 | 296 | while (n > 0) { |
davidprentice | 0:b608c7f02f80 | 297 | if (!(_lcd_capable & MIPI_DCS_REV1)) { |
davidprentice | 0:b608c7f02f80 | 298 | WriteCmdData(_MC, x + col); |
davidprentice | 0:b608c7f02f80 | 299 | WriteCmdData(_MP, y + row); |
davidprentice | 0:b608c7f02f80 | 300 | } |
davidprentice | 0:b608c7f02f80 | 301 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 302 | WriteCmd(_MR); |
davidprentice | 0:b608c7f02f80 | 303 | setReadDir(); |
davidprentice | 0:b608c7f02f80 | 304 | if (_lcd_capable & READ_NODUMMY) { |
davidprentice | 0:b608c7f02f80 | 305 | ; |
davidprentice | 0:b608c7f02f80 | 306 | } else if ((_lcd_capable & MIPI_DCS_REV1) || _lcd_ID == 0x1289) { |
davidprentice | 0:b608c7f02f80 | 307 | READ_8(r); |
davidprentice | 0:b608c7f02f80 | 308 | } else { |
davidprentice | 0:b608c7f02f80 | 309 | READ_16(dummy); |
davidprentice | 0:b608c7f02f80 | 310 | } |
davidprentice | 0:b608c7f02f80 | 311 | if (_lcd_ID == 0x1511) READ_8(r); //extra dummy for R61511 |
davidprentice | 0:b608c7f02f80 | 312 | while (n) { |
davidprentice | 0:b608c7f02f80 | 313 | if (_lcd_capable & READ_24BITS) { |
davidprentice | 0:b608c7f02f80 | 314 | READ_8(r); |
davidprentice | 0:b608c7f02f80 | 315 | READ_8(g); |
davidprentice | 0:b608c7f02f80 | 316 | READ_8(b); |
davidprentice | 0:b608c7f02f80 | 317 | if (_lcd_capable & READ_BGR) |
davidprentice | 0:b608c7f02f80 | 318 | ret = color565(b, g, r); |
davidprentice | 0:b608c7f02f80 | 319 | else |
davidprentice | 0:b608c7f02f80 | 320 | ret = color565(r, g, b); |
davidprentice | 0:b608c7f02f80 | 321 | } else { |
davidprentice | 0:b608c7f02f80 | 322 | READ_16(ret); |
davidprentice | 0:b608c7f02f80 | 323 | if (_lcd_capable & READ_LOWHIGH) |
davidprentice | 0:b608c7f02f80 | 324 | ret = (ret >> 8) | (ret << 8); |
davidprentice | 0:b608c7f02f80 | 325 | if (_lcd_capable & READ_BGR) |
davidprentice | 0:b608c7f02f80 | 326 | ret = (ret & 0x07E0) | (ret >> 11) | (ret << 11); |
davidprentice | 0:b608c7f02f80 | 327 | } |
davidprentice | 0:b608c7f02f80 | 328 | #if defined(SUPPORT_9488_555) |
davidprentice | 0:b608c7f02f80 | 329 | if (is555) ret = color555_to_565(ret); |
davidprentice | 0:b608c7f02f80 | 330 | #endif |
davidprentice | 0:b608c7f02f80 | 331 | *block++ = ret; |
davidprentice | 0:b608c7f02f80 | 332 | n--; |
davidprentice | 0:b608c7f02f80 | 333 | if (!(_lcd_capable & AUTO_READINC)) |
davidprentice | 0:b608c7f02f80 | 334 | break; |
davidprentice | 0:b608c7f02f80 | 335 | } |
davidprentice | 0:b608c7f02f80 | 336 | if (++col >= w) { |
davidprentice | 0:b608c7f02f80 | 337 | col = 0; |
davidprentice | 0:b608c7f02f80 | 338 | if (++row >= h) |
davidprentice | 0:b608c7f02f80 | 339 | row = 0; |
davidprentice | 0:b608c7f02f80 | 340 | } |
davidprentice | 0:b608c7f02f80 | 341 | RD_IDLE; |
davidprentice | 0:b608c7f02f80 | 342 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 343 | setWriteDir(); |
davidprentice | 0:b608c7f02f80 | 344 | } |
davidprentice | 0:b608c7f02f80 | 345 | if (!(_lcd_capable & MIPI_DCS_REV1)) |
davidprentice | 0:b608c7f02f80 | 346 | setAddrWindow(0, 0, width() - 1, height() - 1); |
davidprentice | 0:b608c7f02f80 | 347 | return 0; |
davidprentice | 0:b608c7f02f80 | 348 | } |
davidprentice | 0:b608c7f02f80 | 349 | |
davidprentice | 0:b608c7f02f80 | 350 | void MCUFRIEND_kbv::setRotation(uint8_t r) |
davidprentice | 0:b608c7f02f80 | 351 | { |
davidprentice | 0:b608c7f02f80 | 352 | uint16_t GS, SS_v, ORG, REV = _lcd_rev; |
davidprentice | 0:b608c7f02f80 | 353 | uint8_t val, d[3]; |
davidprentice | 0:b608c7f02f80 | 354 | rotation = r & 3; // just perform the operation ourselves on the protected variables |
davidprentice | 0:b608c7f02f80 | 355 | _width = (rotation & 1) ? HEIGHT : WIDTH; |
davidprentice | 0:b608c7f02f80 | 356 | _height = (rotation & 1) ? WIDTH : HEIGHT; |
davidprentice | 0:b608c7f02f80 | 357 | switch (rotation) { |
davidprentice | 0:b608c7f02f80 | 358 | case 0: //PORTRAIT: |
davidprentice | 0:b608c7f02f80 | 359 | val = 0x48; //MY=0, MX=1, MV=0, ML=0, BGR=1 |
davidprentice | 0:b608c7f02f80 | 360 | break; |
davidprentice | 0:b608c7f02f80 | 361 | case 1: //LANDSCAPE: 90 degrees |
davidprentice | 0:b608c7f02f80 | 362 | val = 0x28; //MY=0, MX=0, MV=1, ML=0, BGR=1 |
davidprentice | 0:b608c7f02f80 | 363 | break; |
davidprentice | 0:b608c7f02f80 | 364 | case 2: //PORTRAIT_REV: 180 degrees |
davidprentice | 0:b608c7f02f80 | 365 | val = 0x98; //MY=1, MX=0, MV=0, ML=1, BGR=1 |
davidprentice | 0:b608c7f02f80 | 366 | break; |
davidprentice | 0:b608c7f02f80 | 367 | case 3: //LANDSCAPE_REV: 270 degrees |
davidprentice | 0:b608c7f02f80 | 368 | val = 0xF8; //MY=1, MX=1, MV=1, ML=1, BGR=1 |
davidprentice | 0:b608c7f02f80 | 369 | break; |
davidprentice | 0:b608c7f02f80 | 370 | } |
davidprentice | 0:b608c7f02f80 | 371 | if (_lcd_capable & INVERT_GS) |
davidprentice | 0:b608c7f02f80 | 372 | val ^= 0x80; |
davidprentice | 0:b608c7f02f80 | 373 | if (_lcd_capable & INVERT_SS) |
davidprentice | 0:b608c7f02f80 | 374 | val ^= 0x40; |
davidprentice | 0:b608c7f02f80 | 375 | if (_lcd_capable & INVERT_RGB) |
davidprentice | 0:b608c7f02f80 | 376 | val ^= 0x08; |
davidprentice | 0:b608c7f02f80 | 377 | if (_lcd_capable & MIPI_DCS_REV1) { |
davidprentice | 0:b608c7f02f80 | 378 | if (_lcd_ID == 0x6814) { //.kbv my weird 0x9486 might be 68140 |
davidprentice | 0:b608c7f02f80 | 379 | GS = (val & 0x80) ? (1 << 6) : 0; //MY |
davidprentice | 0:b608c7f02f80 | 380 | SS_v = (val & 0x40) ? (1 << 5) : 0; //MX |
davidprentice | 0:b608c7f02f80 | 381 | val &= 0x28; //keep MV, BGR, MY=0, MX=0, ML=0 |
davidprentice | 0:b608c7f02f80 | 382 | d[0] = 0; |
davidprentice | 0:b608c7f02f80 | 383 | d[1] = GS | SS_v | 0x02; //MY, MX |
davidprentice | 0:b608c7f02f80 | 384 | d[2] = 0x3B; |
davidprentice | 0:b608c7f02f80 | 385 | WriteCmdParamN(0xB6, 3, d); |
davidprentice | 0:b608c7f02f80 | 386 | goto common_MC; |
davidprentice | 0:b608c7f02f80 | 387 | } else if (_lcd_ID == 0x1963 || _lcd_ID == 0x9481 || _lcd_ID == 0x1511) { |
davidprentice | 0:b608c7f02f80 | 388 | if (val & 0x80) |
davidprentice | 0:b608c7f02f80 | 389 | val |= 0x01; //GS |
davidprentice | 0:b608c7f02f80 | 390 | if ((val & 0x40)) |
davidprentice | 0:b608c7f02f80 | 391 | val |= 0x02; //SS |
davidprentice | 0:b608c7f02f80 | 392 | if (_lcd_ID == 0x1963) val &= ~0xC0; |
davidprentice | 0:b608c7f02f80 | 393 | if (_lcd_ID == 0x9481) val &= ~0xD0; |
davidprentice | 0:b608c7f02f80 | 394 | if (_lcd_ID == 0x1511) { |
davidprentice | 0:b608c7f02f80 | 395 | val &= ~0x10; //remove ML |
davidprentice | 0:b608c7f02f80 | 396 | val |= 0xC0; //force penguin 180 rotation |
davidprentice | 0:b608c7f02f80 | 397 | } |
davidprentice | 0:b608c7f02f80 | 398 | // val &= (_lcd_ID == 0x1963) ? ~0xC0 : ~0xD0; //MY=0, MX=0 with ML=0 for ILI9481 |
davidprentice | 0:b608c7f02f80 | 399 | goto common_MC; |
davidprentice | 0:b608c7f02f80 | 400 | } else if (is8347) { |
davidprentice | 0:b608c7f02f80 | 401 | _MC = 0x02, _MP = 0x06, _MW = 0x22, _SC = 0x02, _EC = 0x04, _SP = 0x06, _EP = 0x08; |
davidprentice | 0:b608c7f02f80 | 402 | if (_lcd_ID == 0x0065) { //HX8352-B |
davidprentice | 0:b608c7f02f80 | 403 | val |= 0x01; //GS=1 |
davidprentice | 0:b608c7f02f80 | 404 | if ((val & 0x10)) val ^= 0xD3; //(ML) flip MY, MX, ML, SS, GS |
davidprentice | 0:b608c7f02f80 | 405 | if (r & 1) _MC = 0x82, _MP = 0x80; |
davidprentice | 0:b608c7f02f80 | 406 | else _MC = 0x80, _MP = 0x82; |
davidprentice | 0:b608c7f02f80 | 407 | } |
davidprentice | 0:b608c7f02f80 | 408 | if (_lcd_ID == 0x5252) { //HX8352-A |
davidprentice | 0:b608c7f02f80 | 409 | val |= 0x02; //VERT_SCROLLON |
davidprentice | 0:b608c7f02f80 | 410 | if ((val & 0x10)) val ^= 0xD4; //(ML) flip MY, MX, SS. GS=1 |
davidprentice | 0:b608c7f02f80 | 411 | } |
davidprentice | 0:b608c7f02f80 | 412 | goto common_BGR; |
davidprentice | 0:b608c7f02f80 | 413 | } |
davidprentice | 0:b608c7f02f80 | 414 | common_MC: |
davidprentice | 0:b608c7f02f80 | 415 | _MC = 0x2A, _MP = 0x2B, _MW = 0x2C, _SC = 0x2A, _EC = 0x2A, _SP = 0x2B, _EP = 0x2B; |
davidprentice | 0:b608c7f02f80 | 416 | common_BGR: |
davidprentice | 0:b608c7f02f80 | 417 | WriteCmdParamN(is8347 ? 0x16 : 0x36, 1, &val); |
davidprentice | 0:b608c7f02f80 | 418 | _lcd_madctl = val; |
davidprentice | 0:b608c7f02f80 | 419 | // if (_lcd_ID == 0x1963) WriteCmdParamN(0x13, 0, NULL); //NORMAL mode |
davidprentice | 0:b608c7f02f80 | 420 | } |
davidprentice | 0:b608c7f02f80 | 421 | // cope with 9320 variants |
davidprentice | 0:b608c7f02f80 | 422 | else { |
davidprentice | 0:b608c7f02f80 | 423 | switch (_lcd_ID) { |
davidprentice | 0:b608c7f02f80 | 424 | #if defined(SUPPORT_9225) |
davidprentice | 0:b608c7f02f80 | 425 | case 0x9225: |
davidprentice | 0:b608c7f02f80 | 426 | _SC = 0x37, _EC = 0x36, _SP = 0x39, _EP = 0x38; |
davidprentice | 0:b608c7f02f80 | 427 | _MC = 0x20, _MP = 0x21, _MW = 0x22; |
davidprentice | 0:b608c7f02f80 | 428 | GS = (val & 0x80) ? (1 << 9) : 0; |
davidprentice | 0:b608c7f02f80 | 429 | SS_v = (val & 0x40) ? (1 << 8) : 0; |
davidprentice | 0:b608c7f02f80 | 430 | WriteCmdData(0x01, GS | SS_v | 0x001C); // set Driver Output Control |
davidprentice | 0:b608c7f02f80 | 431 | goto common_ORG; |
davidprentice | 0:b608c7f02f80 | 432 | #endif |
davidprentice | 0:b608c7f02f80 | 433 | #if defined(SUPPORT_0139) || defined(SUPPORT_0154) |
davidprentice | 0:b608c7f02f80 | 434 | #ifdef SUPPORT_0139 |
davidprentice | 0:b608c7f02f80 | 435 | case 0x0139: |
davidprentice | 0:b608c7f02f80 | 436 | _SC = 0x46, _EC = 0x46, _SP = 0x48, _EP = 0x47; |
davidprentice | 0:b608c7f02f80 | 437 | goto common_S6D; |
davidprentice | 0:b608c7f02f80 | 438 | #endif |
davidprentice | 0:b608c7f02f80 | 439 | #ifdef SUPPORT_0154 |
davidprentice | 0:b608c7f02f80 | 440 | case 0x0154: |
davidprentice | 0:b608c7f02f80 | 441 | _SC = 0x37, _EC = 0x36, _SP = 0x39, _EP = 0x38; |
davidprentice | 0:b608c7f02f80 | 442 | goto common_S6D; |
davidprentice | 0:b608c7f02f80 | 443 | #endif |
davidprentice | 0:b608c7f02f80 | 444 | common_S6D: |
davidprentice | 0:b608c7f02f80 | 445 | _MC = 0x20, _MP = 0x21, _MW = 0x22; |
davidprentice | 0:b608c7f02f80 | 446 | GS = (val & 0x80) ? (1 << 9) : 0; |
davidprentice | 0:b608c7f02f80 | 447 | SS_v = (val & 0x40) ? (1 << 8) : 0; |
davidprentice | 0:b608c7f02f80 | 448 | // S6D0139 requires NL = 0x27, S6D0154 NL = 0x28 |
davidprentice | 0:b608c7f02f80 | 449 | WriteCmdData(0x01, GS | SS_v | ((_lcd_ID == 0x0139) ? 0x27 : 0x28)); |
davidprentice | 0:b608c7f02f80 | 450 | goto common_ORG; |
davidprentice | 0:b608c7f02f80 | 451 | #endif |
davidprentice | 0:b608c7f02f80 | 452 | case 0x5420: |
davidprentice | 0:b608c7f02f80 | 453 | case 0x7793: |
davidprentice | 0:b608c7f02f80 | 454 | case 0x9326: |
davidprentice | 0:b608c7f02f80 | 455 | case 0xB509: |
davidprentice | 0:b608c7f02f80 | 456 | _MC = 0x200, _MP = 0x201, _MW = 0x202, _SC = 0x210, _EC = 0x211, _SP = 0x212, _EP = 0x213; |
davidprentice | 0:b608c7f02f80 | 457 | GS = (val & 0x80) ? (1 << 15) : 0; |
davidprentice | 0:b608c7f02f80 | 458 | uint16_t NL; |
davidprentice | 0:b608c7f02f80 | 459 | NL = ((432 / 8) - 1) << 9; |
davidprentice | 0:b608c7f02f80 | 460 | if (_lcd_ID == 0x9326 || _lcd_ID == 0x5420) NL >>= 1; |
davidprentice | 0:b608c7f02f80 | 461 | WriteCmdData(0x400, GS | NL); |
davidprentice | 0:b608c7f02f80 | 462 | goto common_SS; |
davidprentice | 0:b608c7f02f80 | 463 | default: |
davidprentice | 0:b608c7f02f80 | 464 | _MC = 0x20, _MP = 0x21, _MW = 0x22, _SC = 0x50, _EC = 0x51, _SP = 0x52, _EP = 0x53; |
davidprentice | 0:b608c7f02f80 | 465 | GS = (val & 0x80) ? (1 << 15) : 0; |
davidprentice | 0:b608c7f02f80 | 466 | WriteCmdData(0x60, GS | 0x2700); // Gate Scan Line (0xA700) |
davidprentice | 0:b608c7f02f80 | 467 | common_SS: |
davidprentice | 0:b608c7f02f80 | 468 | SS_v = (val & 0x40) ? (1 << 8) : 0; |
davidprentice | 0:b608c7f02f80 | 469 | WriteCmdData(0x01, SS_v); // set Driver Output Control |
davidprentice | 0:b608c7f02f80 | 470 | common_ORG: |
davidprentice | 0:b608c7f02f80 | 471 | ORG = (val & 0x20) ? (1 << 3) : 0; |
davidprentice | 0:b608c7f02f80 | 472 | #ifdef SUPPORT_8230 |
davidprentice | 0:b608c7f02f80 | 473 | if (_lcd_ID == 0x8230) { // UC8230 has strange BGR and READ_BGR behaviour |
davidprentice | 0:b608c7f02f80 | 474 | if (rotation == 1 || rotation == 2) { |
davidprentice | 0:b608c7f02f80 | 475 | val ^= 0x08; // change BGR bit for LANDSCAPE and PORTRAIT_REV |
davidprentice | 0:b608c7f02f80 | 476 | } |
davidprentice | 0:b608c7f02f80 | 477 | } |
davidprentice | 0:b608c7f02f80 | 478 | #endif |
davidprentice | 0:b608c7f02f80 | 479 | if (val & 0x08) |
davidprentice | 0:b608c7f02f80 | 480 | ORG |= 0x1000; //BGR |
davidprentice | 0:b608c7f02f80 | 481 | _lcd_madctl = ORG | 0x0030; |
davidprentice | 0:b608c7f02f80 | 482 | WriteCmdData(0x03, _lcd_madctl); // set GRAM write direction and BGR=1. |
davidprentice | 0:b608c7f02f80 | 483 | break; |
davidprentice | 0:b608c7f02f80 | 484 | #ifdef SUPPORT_1289 |
davidprentice | 0:b608c7f02f80 | 485 | case 0x1289: |
davidprentice | 0:b608c7f02f80 | 486 | _MC = 0x4E, _MP = 0x4F, _MW = 0x22, _SC = 0x44, _EC = 0x44, _SP = 0x45, _EP = 0x46; |
davidprentice | 0:b608c7f02f80 | 487 | if (rotation & 1) |
davidprentice | 0:b608c7f02f80 | 488 | val ^= 0xD0; // exchange Landscape modes |
davidprentice | 0:b608c7f02f80 | 489 | GS = (val & 0x80) ? (1 << 14) : 0; //called TB (top-bottom), CAD=0 |
davidprentice | 0:b608c7f02f80 | 490 | SS_v = (val & 0x40) ? (1 << 9) : 0; //called RL (right-left) |
davidprentice | 0:b608c7f02f80 | 491 | ORG = (val & 0x20) ? (1 << 3) : 0; //called AM |
davidprentice | 0:b608c7f02f80 | 492 | _lcd_drivOut = GS | SS_v | (REV << 13) | 0x013F; //REV=0, BGR=0, MUX=319 |
davidprentice | 0:b608c7f02f80 | 493 | if (val & 0x08) |
davidprentice | 0:b608c7f02f80 | 494 | _lcd_drivOut |= 0x0800; //BGR |
davidprentice | 0:b608c7f02f80 | 495 | WriteCmdData(0x01, _lcd_drivOut); // set Driver Output Control |
davidprentice | 0:b608c7f02f80 | 496 | if (is9797) WriteCmdData(0x11, ORG | 0x4C30); else // DFM=2, DEN=1, WM=1, TY=0 |
davidprentice | 0:b608c7f02f80 | 497 | WriteCmdData(0x11, ORG | 0x6070); // DFM=3, EN=0, TY=1 |
davidprentice | 0:b608c7f02f80 | 498 | break; |
davidprentice | 0:b608c7f02f80 | 499 | #endif |
davidprentice | 0:b608c7f02f80 | 500 | } |
davidprentice | 0:b608c7f02f80 | 501 | } |
davidprentice | 0:b608c7f02f80 | 502 | if ((rotation & 1) && ((_lcd_capable & MV_AXIS) == 0)) { |
davidprentice | 0:b608c7f02f80 | 503 | uint16_t x; |
davidprentice | 0:b608c7f02f80 | 504 | x = _MC, _MC = _MP, _MP = x; |
davidprentice | 0:b608c7f02f80 | 505 | x = _SC, _SC = _SP, _SP = x; //.kbv check 0139 |
davidprentice | 0:b608c7f02f80 | 506 | x = _EC, _EC = _EP, _EP = x; //.kbv check 0139 |
davidprentice | 0:b608c7f02f80 | 507 | } |
davidprentice | 0:b608c7f02f80 | 508 | setAddrWindow(0, 0, width() - 1, height() - 1); |
davidprentice | 0:b608c7f02f80 | 509 | vertScroll(0, HEIGHT, 0); //reset scrolling after a rotation |
davidprentice | 0:b608c7f02f80 | 510 | } |
davidprentice | 0:b608c7f02f80 | 511 | |
davidprentice | 0:b608c7f02f80 | 512 | void MCUFRIEND_kbv::drawPixel(int16_t x, int16_t y, uint16_t color) |
davidprentice | 0:b608c7f02f80 | 513 | { |
davidprentice | 0:b608c7f02f80 | 514 | // MCUFRIEND just plots at edge if you try to write outside of the box: |
davidprentice | 0:b608c7f02f80 | 515 | if (x < 0 || y < 0 || x >= width() || y >= height()) |
davidprentice | 0:b608c7f02f80 | 516 | return; |
davidprentice | 0:b608c7f02f80 | 517 | #if defined(SUPPORT_9488_555) |
davidprentice | 0:b608c7f02f80 | 518 | if (is555) color = color565_to_555(color); |
davidprentice | 0:b608c7f02f80 | 519 | #endif |
davidprentice | 0:b608c7f02f80 | 520 | setAddrWindow(x, y, x, y); |
davidprentice | 0:b608c7f02f80 | 521 | // CS_ACTIVE; WriteCmd(_MW); write16(color); CS_IDLE; //-0.01s +98B |
davidprentice | 0:b608c7f02f80 | 522 | if (is9797) { CS_ACTIVE; WriteCmd(_MW); write24(color); CS_IDLE;} else |
davidprentice | 0:b608c7f02f80 | 523 | WriteCmdData(_MW, color); |
davidprentice | 0:b608c7f02f80 | 524 | } |
davidprentice | 0:b608c7f02f80 | 525 | |
davidprentice | 0:b608c7f02f80 | 526 | void MCUFRIEND_kbv::setAddrWindow(int16_t x, int16_t y, int16_t x1, int16_t y1) |
davidprentice | 0:b608c7f02f80 | 527 | { |
davidprentice | 0:b608c7f02f80 | 528 | #if defined(OFFSET_9327) |
davidprentice | 0:b608c7f02f80 | 529 | if (_lcd_ID == 0x9327) { |
davidprentice | 0:b608c7f02f80 | 530 | if (rotation == 2) y += OFFSET_9327, y1 += OFFSET_9327; |
davidprentice | 0:b608c7f02f80 | 531 | if (rotation == 3) x += OFFSET_9327, x1 += OFFSET_9327; |
davidprentice | 0:b608c7f02f80 | 532 | } |
davidprentice | 0:b608c7f02f80 | 533 | #endif |
davidprentice | 0:b608c7f02f80 | 534 | #if 1 |
davidprentice | 0:b608c7f02f80 | 535 | if (_lcd_ID == 0x1526 && (rotation & 1)) { |
davidprentice | 0:b608c7f02f80 | 536 | int16_t dx = x1 - x, dy = y1 - y; |
davidprentice | 0:b608c7f02f80 | 537 | if (dy == 0) { y1++; } |
davidprentice | 0:b608c7f02f80 | 538 | else if (dx == 0) { x1 += dy; y1 -= dy; } |
davidprentice | 0:b608c7f02f80 | 539 | } |
davidprentice | 0:b608c7f02f80 | 540 | #endif |
davidprentice | 0:b608c7f02f80 | 541 | if (_lcd_capable & MIPI_DCS_REV1) { |
davidprentice | 0:b608c7f02f80 | 542 | WriteCmdParam4(_SC, x >> 8, x, x1 >> 8, x1); //Start column instead of _MC |
davidprentice | 0:b608c7f02f80 | 543 | WriteCmdParam4(_SP, y >> 8, y, y1 >> 8, y1); // |
davidprentice | 0:b608c7f02f80 | 544 | if (is8347 && _lcd_ID == 0x0065) { //HX8352-B has separate _MC, _SC |
davidprentice | 0:b608c7f02f80 | 545 | uint8_t d[2]; |
davidprentice | 0:b608c7f02f80 | 546 | d[0] = x >> 8; d[1] = x; |
davidprentice | 0:b608c7f02f80 | 547 | WriteCmdParamN(_MC, 2, d); //allows !MV_AXIS to work |
davidprentice | 0:b608c7f02f80 | 548 | d[0] = y >> 8; d[1] = y; |
davidprentice | 0:b608c7f02f80 | 549 | WriteCmdParamN(_MP, 2, d); |
davidprentice | 0:b608c7f02f80 | 550 | } |
davidprentice | 0:b608c7f02f80 | 551 | } else { |
davidprentice | 0:b608c7f02f80 | 552 | WriteCmdData(_MC, x); |
davidprentice | 0:b608c7f02f80 | 553 | WriteCmdData(_MP, y); |
davidprentice | 0:b608c7f02f80 | 554 | if (!(x == x1 && y == y1)) { //only need MC,MP for drawPixel |
davidprentice | 0:b608c7f02f80 | 555 | if (_lcd_capable & XSA_XEA_16BIT) { |
davidprentice | 0:b608c7f02f80 | 556 | if (rotation & 1) |
davidprentice | 0:b608c7f02f80 | 557 | y1 = y = (y1 << 8) | y; |
davidprentice | 0:b608c7f02f80 | 558 | else |
davidprentice | 0:b608c7f02f80 | 559 | x1 = x = (x1 << 8) | x; |
davidprentice | 0:b608c7f02f80 | 560 | } |
davidprentice | 0:b608c7f02f80 | 561 | WriteCmdData(_SC, x); |
davidprentice | 0:b608c7f02f80 | 562 | WriteCmdData(_SP, y); |
davidprentice | 0:b608c7f02f80 | 563 | WriteCmdData(_EC, x1); |
davidprentice | 0:b608c7f02f80 | 564 | WriteCmdData(_EP, y1); |
davidprentice | 0:b608c7f02f80 | 565 | } |
davidprentice | 0:b608c7f02f80 | 566 | } |
davidprentice | 0:b608c7f02f80 | 567 | } |
davidprentice | 0:b608c7f02f80 | 568 | |
davidprentice | 0:b608c7f02f80 | 569 | void MCUFRIEND_kbv::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
davidprentice | 0:b608c7f02f80 | 570 | { |
davidprentice | 0:b608c7f02f80 | 571 | int16_t end; |
davidprentice | 0:b608c7f02f80 | 572 | #if defined(SUPPORT_9488_555) |
davidprentice | 0:b608c7f02f80 | 573 | if (is555) color = color565_to_555(color); |
davidprentice | 0:b608c7f02f80 | 574 | #endif |
davidprentice | 0:b608c7f02f80 | 575 | if (w < 0) { |
davidprentice | 0:b608c7f02f80 | 576 | w = -w; |
davidprentice | 0:b608c7f02f80 | 577 | x -= w; |
davidprentice | 0:b608c7f02f80 | 578 | } //+ve w |
davidprentice | 0:b608c7f02f80 | 579 | end = x + w; |
davidprentice | 0:b608c7f02f80 | 580 | if (x < 0) |
davidprentice | 0:b608c7f02f80 | 581 | x = 0; |
davidprentice | 0:b608c7f02f80 | 582 | if (end > width()) |
davidprentice | 0:b608c7f02f80 | 583 | end = width(); |
davidprentice | 0:b608c7f02f80 | 584 | w = end - x; |
davidprentice | 0:b608c7f02f80 | 585 | if (h < 0) { |
davidprentice | 0:b608c7f02f80 | 586 | h = -h; |
davidprentice | 0:b608c7f02f80 | 587 | y -= h; |
davidprentice | 0:b608c7f02f80 | 588 | } //+ve h |
davidprentice | 0:b608c7f02f80 | 589 | end = y + h; |
davidprentice | 0:b608c7f02f80 | 590 | if (y < 0) |
davidprentice | 0:b608c7f02f80 | 591 | y = 0; |
davidprentice | 0:b608c7f02f80 | 592 | if (end > height()) |
davidprentice | 0:b608c7f02f80 | 593 | end = height(); |
davidprentice | 0:b608c7f02f80 | 594 | h = end - y; |
davidprentice | 0:b608c7f02f80 | 595 | setAddrWindow(x, y, x + w - 1, y + h - 1); |
davidprentice | 0:b608c7f02f80 | 596 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 597 | WriteCmd(_MW); |
davidprentice | 0:b608c7f02f80 | 598 | if (h > w) { |
davidprentice | 0:b608c7f02f80 | 599 | end = h; |
davidprentice | 0:b608c7f02f80 | 600 | h = w; |
davidprentice | 0:b608c7f02f80 | 601 | w = end; |
davidprentice | 0:b608c7f02f80 | 602 | } |
davidprentice | 0:b608c7f02f80 | 603 | uint8_t hi = color >> 8, lo = color & 0xFF; |
davidprentice | 0:b608c7f02f80 | 604 | while (h-- > 0) { |
davidprentice | 0:b608c7f02f80 | 605 | end = w; |
davidprentice | 0:b608c7f02f80 | 606 | #if USING_16BIT_BUS |
davidprentice | 0:b608c7f02f80 | 607 | #if defined(__MK66FX1M0__) //180MHz M4 |
davidprentice | 0:b608c7f02f80 | 608 | #define STROBE_16BIT {WR_ACTIVE4;WR_ACTIVE;WR_IDLE4;WR_IDLE;} //56ns |
davidprentice | 0:b608c7f02f80 | 609 | #elif defined(__SAM3X8E__) //84MHz M3 |
davidprentice | 0:b608c7f02f80 | 610 | #define STROBE_16BIT {WR_ACTIVE4;WR_ACTIVE2;WR_IDLE4;WR_IDLE2;} //286ns ?ILI9486 |
davidprentice | 0:b608c7f02f80 | 611 | //#define STROBE_16BIT {WR_ACTIVE4;WR_ACTIVE;WR_IDLE4;WR_IDLE;} //238ns SSD1289 |
davidprentice | 0:b608c7f02f80 | 612 | //#define STROBE_16BIT {WR_ACTIVE2;WR_ACTIVE;WR_IDLE2;} //119ns RM68140 |
davidprentice | 0:b608c7f02f80 | 613 | #else //16MHz AVR |
davidprentice | 0:b608c7f02f80 | 614 | #define STROBE_16BIT {WR_ACTIVE;WR_ACTIVE;WR_IDLE; } //375ns ?ILI9486 |
davidprentice | 0:b608c7f02f80 | 615 | #endif |
davidprentice | 0:b608c7f02f80 | 616 | write_16(color); //we could just do the strobe |
davidprentice | 0:b608c7f02f80 | 617 | lo = end & 7; |
davidprentice | 0:b608c7f02f80 | 618 | hi = end >> 3; |
davidprentice | 0:b608c7f02f80 | 619 | if (hi) |
davidprentice | 0:b608c7f02f80 | 620 | do { |
davidprentice | 0:b608c7f02f80 | 621 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 622 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 623 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 624 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 625 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 626 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 627 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 628 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 629 | } while (--hi > 0); |
davidprentice | 0:b608c7f02f80 | 630 | while (lo-- > 0) { |
davidprentice | 0:b608c7f02f80 | 631 | STROBE_16BIT; |
davidprentice | 0:b608c7f02f80 | 632 | } |
davidprentice | 0:b608c7f02f80 | 633 | #else |
davidprentice | 0:b608c7f02f80 | 634 | #if defined(SUPPORT_1289) |
davidprentice | 0:b608c7f02f80 | 635 | if (is9797) { |
davidprentice | 0:b608c7f02f80 | 636 | uint8_t r = color565_to_r(color); |
davidprentice | 0:b608c7f02f80 | 637 | uint8_t g = color565_to_g(color); |
davidprentice | 0:b608c7f02f80 | 638 | uint8_t b = color565_to_b(color); |
davidprentice | 0:b608c7f02f80 | 639 | do { |
davidprentice | 0:b608c7f02f80 | 640 | write8(r); |
davidprentice | 0:b608c7f02f80 | 641 | write8(g); |
davidprentice | 0:b608c7f02f80 | 642 | write8(b); |
davidprentice | 0:b608c7f02f80 | 643 | } while (--end != 0); |
davidprentice | 0:b608c7f02f80 | 644 | } else |
davidprentice | 0:b608c7f02f80 | 645 | #endif |
davidprentice | 0:b608c7f02f80 | 646 | do { |
davidprentice | 0:b608c7f02f80 | 647 | write8(hi); |
davidprentice | 0:b608c7f02f80 | 648 | write8(lo); |
davidprentice | 0:b608c7f02f80 | 649 | } while (--end != 0); |
davidprentice | 0:b608c7f02f80 | 650 | #endif |
davidprentice | 0:b608c7f02f80 | 651 | } |
davidprentice | 0:b608c7f02f80 | 652 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 653 | if (!(_lcd_capable & MIPI_DCS_REV1) || ((_lcd_ID == 0x1526) && (rotation & 1))) |
davidprentice | 0:b608c7f02f80 | 654 | setAddrWindow(0, 0, width() - 1, height() - 1); |
davidprentice | 0:b608c7f02f80 | 655 | } |
davidprentice | 0:b608c7f02f80 | 656 | |
davidprentice | 0:b608c7f02f80 | 657 | static void pushColors_any(uint16_t cmd, uint8_t * block, int16_t n, bool first, uint8_t flags) |
davidprentice | 0:b608c7f02f80 | 658 | { |
davidprentice | 0:b608c7f02f80 | 659 | uint16_t color; |
davidprentice | 0:b608c7f02f80 | 660 | uint8_t h, l; |
davidprentice | 0:b608c7f02f80 | 661 | bool isconst = flags & 1; |
davidprentice | 0:b608c7f02f80 | 662 | bool isbigend = (flags & 2) != 0; |
davidprentice | 0:b608c7f02f80 | 663 | CS_ACTIVE; |
davidprentice | 0:b608c7f02f80 | 664 | if (first) { |
davidprentice | 0:b608c7f02f80 | 665 | WriteCmd(cmd); |
davidprentice | 0:b608c7f02f80 | 666 | } |
davidprentice | 0:b608c7f02f80 | 667 | |
davidprentice | 0:b608c7f02f80 | 668 | if (!isconst && !isbigend) { |
davidprentice | 0:b608c7f02f80 | 669 | uint16_t *block16 = (uint16_t*)block; |
davidprentice | 0:b608c7f02f80 | 670 | while (n-- > 0) { |
davidprentice | 0:b608c7f02f80 | 671 | color = *block16++; |
davidprentice | 0:b608c7f02f80 | 672 | write16(color); |
davidprentice | 0:b608c7f02f80 | 673 | } |
davidprentice | 0:b608c7f02f80 | 674 | } else |
davidprentice | 0:b608c7f02f80 | 675 | |
davidprentice | 0:b608c7f02f80 | 676 | while (n-- > 0) { |
davidprentice | 0:b608c7f02f80 | 677 | if (isconst) { |
davidprentice | 0:b608c7f02f80 | 678 | h = pgm_read_byte(block++); |
davidprentice | 0:b608c7f02f80 | 679 | l = pgm_read_byte(block++); |
davidprentice | 0:b608c7f02f80 | 680 | } else { |
davidprentice | 0:b608c7f02f80 | 681 | h = (*block++); |
davidprentice | 0:b608c7f02f80 | 682 | l = (*block++); |
davidprentice | 0:b608c7f02f80 | 683 | } |
davidprentice | 0:b608c7f02f80 | 684 | color = (isbigend) ? (h << 8 | l) : (l << 8 | h); |
davidprentice | 0:b608c7f02f80 | 685 | #if defined(SUPPORT_9488_555) |
davidprentice | 0:b608c7f02f80 | 686 | if (is555) color = color565_to_555(color); |
davidprentice | 0:b608c7f02f80 | 687 | #endif |
davidprentice | 0:b608c7f02f80 | 688 | if (is9797) write24(color); else |
davidprentice | 0:b608c7f02f80 | 689 | write16(color); |
davidprentice | 0:b608c7f02f80 | 690 | } |
davidprentice | 0:b608c7f02f80 | 691 | CS_IDLE; |
davidprentice | 0:b608c7f02f80 | 692 | } |
davidprentice | 0:b608c7f02f80 | 693 | |
davidprentice | 0:b608c7f02f80 | 694 | void MCUFRIEND_kbv::pushColors(uint16_t * block, int16_t n, bool first) |
davidprentice | 0:b608c7f02f80 | 695 | { |
davidprentice | 0:b608c7f02f80 | 696 | pushColors_any(_MW, (uint8_t *)block, n, first, 0); |
davidprentice | 0:b608c7f02f80 | 697 | } |
davidprentice | 0:b608c7f02f80 | 698 | void MCUFRIEND_kbv::pushColors(uint8_t * block, int16_t n, bool first) |
davidprentice | 0:b608c7f02f80 | 699 | { |
davidprentice | 0:b608c7f02f80 | 700 | pushColors_any(_MW, (uint8_t *)block, n, first, 2); //regular bigend |
davidprentice | 0:b608c7f02f80 | 701 | } |
davidprentice | 0:b608c7f02f80 | 702 | void MCUFRIEND_kbv::pushColors(const uint8_t * block, int16_t n, bool first, bool bigend) |
davidprentice | 0:b608c7f02f80 | 703 | { |
davidprentice | 0:b608c7f02f80 | 704 | pushColors_any(_MW, (uint8_t *)block, n, first, bigend ? 3 : 1); |
davidprentice | 0:b608c7f02f80 | 705 | } |
davidprentice | 0:b608c7f02f80 | 706 | |
davidprentice | 0:b608c7f02f80 | 707 | void MCUFRIEND_kbv::vertScroll(int16_t top, int16_t scrollines, int16_t offset) |
davidprentice | 0:b608c7f02f80 | 708 | { |
davidprentice | 0:b608c7f02f80 | 709 | #if defined(OFFSET_9327) |
davidprentice | 0:b608c7f02f80 | 710 | if (_lcd_ID == 0x9327) { |
davidprentice | 0:b608c7f02f80 | 711 | if (rotation == 2 || rotation == 3) top += OFFSET_9327; |
davidprentice | 0:b608c7f02f80 | 712 | } |
davidprentice | 0:b608c7f02f80 | 713 | #endif |
davidprentice | 0:b608c7f02f80 | 714 | int16_t bfa = HEIGHT - top - scrollines; // bottom fixed area |
davidprentice | 0:b608c7f02f80 | 715 | int16_t vsp; |
davidprentice | 0:b608c7f02f80 | 716 | int16_t sea = top; |
davidprentice | 0:b608c7f02f80 | 717 | if (_lcd_ID == 0x9327) bfa += 32; |
davidprentice | 0:b608c7f02f80 | 718 | if (offset <= -scrollines || offset >= scrollines) offset = 0; //valid scroll |
davidprentice | 0:b608c7f02f80 | 719 | vsp = top + offset; // vertical start position |
davidprentice | 0:b608c7f02f80 | 720 | if (offset < 0) |
davidprentice | 0:b608c7f02f80 | 721 | vsp += scrollines; //keep in unsigned range |
davidprentice | 0:b608c7f02f80 | 722 | sea = top + scrollines - 1; |
davidprentice | 0:b608c7f02f80 | 723 | if (_lcd_capable & MIPI_DCS_REV1) { |
davidprentice | 0:b608c7f02f80 | 724 | uint8_t d[6]; // for multi-byte parameters |
davidprentice | 0:b608c7f02f80 | 725 | /* |
davidprentice | 0:b608c7f02f80 | 726 | if (_lcd_ID == 0x9327) { //panel is wired for 240x432 |
davidprentice | 0:b608c7f02f80 | 727 | if (rotation == 2 || rotation == 3) { //180 or 270 degrees |
davidprentice | 0:b608c7f02f80 | 728 | if (scrollines == HEIGHT) { |
davidprentice | 0:b608c7f02f80 | 729 | scrollines = 432; // we get a glitch but hey-ho |
davidprentice | 0:b608c7f02f80 | 730 | vsp -= 432 - HEIGHT; |
davidprentice | 0:b608c7f02f80 | 731 | } |
davidprentice | 0:b608c7f02f80 | 732 | if (vsp < 0) |
davidprentice | 0:b608c7f02f80 | 733 | vsp += 432; |
davidprentice | 0:b608c7f02f80 | 734 | } |
davidprentice | 0:b608c7f02f80 | 735 | bfa = 432 - top - scrollines; |
davidprentice | 0:b608c7f02f80 | 736 | } |
davidprentice | 0:b608c7f02f80 | 737 | */ |
davidprentice | 0:b608c7f02f80 | 738 | d[0] = top >> 8; //TFA |
davidprentice | 0:b608c7f02f80 | 739 | d[1] = top; |
davidprentice | 0:b608c7f02f80 | 740 | d[2] = scrollines >> 8; //VSA |
davidprentice | 0:b608c7f02f80 | 741 | d[3] = scrollines; |
davidprentice | 0:b608c7f02f80 | 742 | d[4] = bfa >> 8; //BFA |
davidprentice | 0:b608c7f02f80 | 743 | d[5] = bfa; |
davidprentice | 0:b608c7f02f80 | 744 | WriteCmdParamN(is8347 ? 0x0E : 0x33, 6, d); |
davidprentice | 0:b608c7f02f80 | 745 | // if (offset == 0 && rotation > 1) vsp = top + scrollines; //make non-valid |
davidprentice | 0:b608c7f02f80 | 746 | d[0] = vsp >> 8; //VSP |
davidprentice | 0:b608c7f02f80 | 747 | d[1] = vsp; |
davidprentice | 0:b608c7f02f80 | 748 | WriteCmdParamN(is8347 ? 0x14 : 0x37, 2, d); |
davidprentice | 0:b608c7f02f80 | 749 | if (is8347) { |
davidprentice | 0:b608c7f02f80 | 750 | d[0] = (offset != 0) ? (_lcd_ID == 0x8347 ? 0x02 : 0x08) : 0; |
davidprentice | 0:b608c7f02f80 | 751 | WriteCmdParamN(_lcd_ID == 0x8347 ? 0x18 : 0x01, 1, d); //HX8347-D |
davidprentice | 0:b608c7f02f80 | 752 | } else if (offset == 0 && (_lcd_capable & MIPI_DCS_REV1)) { |
davidprentice | 0:b608c7f02f80 | 753 | WriteCmdParamN(0x13, 0, NULL); //NORMAL i.e. disable scroll |
davidprentice | 0:b608c7f02f80 | 754 | } |
davidprentice | 0:b608c7f02f80 | 755 | return; |
davidprentice | 0:b608c7f02f80 | 756 | } |
davidprentice | 0:b608c7f02f80 | 757 | // cope with 9320 style variants: |
davidprentice | 0:b608c7f02f80 | 758 | switch (_lcd_ID) { |
davidprentice | 0:b608c7f02f80 | 759 | case 0x7783: |
davidprentice | 0:b608c7f02f80 | 760 | WriteCmdData(0x61, _lcd_rev); //!NDL, !VLE, REV |
davidprentice | 0:b608c7f02f80 | 761 | WriteCmdData(0x6A, vsp); //VL# |
davidprentice | 0:b608c7f02f80 | 762 | break; |
davidprentice | 0:b608c7f02f80 | 763 | #ifdef SUPPORT_0139 |
davidprentice | 0:b608c7f02f80 | 764 | case 0x0139: |
davidprentice | 0:b608c7f02f80 | 765 | WriteCmdData(0x07, 0x0213 | (_lcd_rev << 2)); //VLE1=1, GON=1, REV=x, D=3 |
davidprentice | 0:b608c7f02f80 | 766 | WriteCmdData(0x41, vsp); //VL# check vsp |
davidprentice | 0:b608c7f02f80 | 767 | break; |
davidprentice | 0:b608c7f02f80 | 768 | #endif |
davidprentice | 0:b608c7f02f80 | 769 | #if defined(SUPPORT_0154) || defined(SUPPORT_9225) //thanks tongbajiel |
davidprentice | 0:b608c7f02f80 | 770 | case 0x9225: |
davidprentice | 0:b608c7f02f80 | 771 | case 0x0154: |
davidprentice | 0:b608c7f02f80 | 772 | WriteCmdData(0x31, sea); //SEA |
davidprentice | 0:b608c7f02f80 | 773 | WriteCmdData(0x32, top); //SSA |
davidprentice | 0:b608c7f02f80 | 774 | WriteCmdData(0x33, vsp - top); //SST |
davidprentice | 0:b608c7f02f80 | 775 | break; |
davidprentice | 0:b608c7f02f80 | 776 | #endif |
davidprentice | 0:b608c7f02f80 | 777 | #ifdef SUPPORT_1289 |
davidprentice | 0:b608c7f02f80 | 778 | case 0x1289: |
davidprentice | 0:b608c7f02f80 | 779 | WriteCmdData(0x41, vsp); //VL# |
davidprentice | 0:b608c7f02f80 | 780 | break; |
davidprentice | 0:b608c7f02f80 | 781 | #endif |
davidprentice | 0:b608c7f02f80 | 782 | case 0x5420: |
davidprentice | 0:b608c7f02f80 | 783 | case 0x7793: |
davidprentice | 0:b608c7f02f80 | 784 | case 0x9326: |
davidprentice | 0:b608c7f02f80 | 785 | case 0xB509: |
davidprentice | 0:b608c7f02f80 | 786 | WriteCmdData(0x401, (1 << 1) | _lcd_rev); //VLE, REV |
davidprentice | 0:b608c7f02f80 | 787 | WriteCmdData(0x404, vsp); //VL# |
davidprentice | 0:b608c7f02f80 | 788 | break; |
davidprentice | 0:b608c7f02f80 | 789 | default: |
davidprentice | 0:b608c7f02f80 | 790 | // 0x6809, 0x9320, 0x9325, 0x9335, 0xB505 can only scroll whole screen |
davidprentice | 0:b608c7f02f80 | 791 | WriteCmdData(0x61, (1 << 1) | _lcd_rev); //!NDL, VLE, REV |
davidprentice | 0:b608c7f02f80 | 792 | WriteCmdData(0x6A, vsp); //VL# |
davidprentice | 0:b608c7f02f80 | 793 | break; |
davidprentice | 0:b608c7f02f80 | 794 | } |
davidprentice | 0:b608c7f02f80 | 795 | } |
davidprentice | 0:b608c7f02f80 | 796 | |
davidprentice | 0:b608c7f02f80 | 797 | void MCUFRIEND_kbv::invertDisplay(boolean i) |
davidprentice | 0:b608c7f02f80 | 798 | { |
davidprentice | 0:b608c7f02f80 | 799 | uint8_t val; |
davidprentice | 0:b608c7f02f80 | 800 | _lcd_rev = ((_lcd_capable & REV_SCREEN) != 0) ^ i; |
davidprentice | 0:b608c7f02f80 | 801 | if (_lcd_capable & MIPI_DCS_REV1) { |
davidprentice | 0:b608c7f02f80 | 802 | if (is8347) { |
davidprentice | 0:b608c7f02f80 | 803 | // HX8347D: 0x36 Panel Characteristic. REV_Panel |
davidprentice | 0:b608c7f02f80 | 804 | // HX8347A: 0x36 is Display Control 10 |
davidprentice | 0:b608c7f02f80 | 805 | if (_lcd_ID == 0x8347 || _lcd_ID == 0x5252) // HX8347-A, HX5352-A |
davidprentice | 0:b608c7f02f80 | 806 | val = _lcd_rev ? 6 : 2; //INVON id bit#2, NORON=bit#1 |
davidprentice | 0:b608c7f02f80 | 807 | else val = _lcd_rev ? 8 : 10; //HX8347-D, G, I: SCROLLON=bit3, INVON=bit1 |
davidprentice | 0:b608c7f02f80 | 808 | // HX8347: 0x01 Display Mode has diff bit mapping for A, D |
davidprentice | 0:b608c7f02f80 | 809 | WriteCmdParamN(0x01, 1, &val); |
davidprentice | 0:b608c7f02f80 | 810 | } else |
davidprentice | 0:b608c7f02f80 | 811 | WriteCmdParamN(_lcd_rev ? 0x21 : 0x20, 0, NULL); |
davidprentice | 0:b608c7f02f80 | 812 | return; |
davidprentice | 0:b608c7f02f80 | 813 | } |
davidprentice | 0:b608c7f02f80 | 814 | // cope with 9320 style variants: |
davidprentice | 0:b608c7f02f80 | 815 | switch (_lcd_ID) { |
davidprentice | 0:b608c7f02f80 | 816 | #ifdef SUPPORT_0139 |
davidprentice | 0:b608c7f02f80 | 817 | case 0x0139: |
davidprentice | 0:b608c7f02f80 | 818 | #endif |
davidprentice | 0:b608c7f02f80 | 819 | case 0x9225: //REV is in reg(0x07) like Samsung |
davidprentice | 0:b608c7f02f80 | 820 | case 0x0154: |
davidprentice | 0:b608c7f02f80 | 821 | WriteCmdData(0x07, 0x13 | (_lcd_rev << 2)); //.kbv kludge |
davidprentice | 0:b608c7f02f80 | 822 | break; |
davidprentice | 0:b608c7f02f80 | 823 | #ifdef SUPPORT_1289 |
davidprentice | 0:b608c7f02f80 | 824 | case 0x1289: |
davidprentice | 0:b608c7f02f80 | 825 | _lcd_drivOut &= ~(1 << 13); |
davidprentice | 0:b608c7f02f80 | 826 | if (_lcd_rev) |
davidprentice | 0:b608c7f02f80 | 827 | _lcd_drivOut |= (1 << 13); |
davidprentice | 0:b608c7f02f80 | 828 | WriteCmdData(0x01, _lcd_drivOut); |
davidprentice | 0:b608c7f02f80 | 829 | break; |
davidprentice | 0:b608c7f02f80 | 830 | #endif |
davidprentice | 0:b608c7f02f80 | 831 | case 0x5420: |
davidprentice | 0:b608c7f02f80 | 832 | case 0x7793: |
davidprentice | 0:b608c7f02f80 | 833 | case 0x9326: |
davidprentice | 0:b608c7f02f80 | 834 | case 0xB509: |
davidprentice | 0:b608c7f02f80 | 835 | WriteCmdData(0x401, (1 << 1) | _lcd_rev); //.kbv kludge VLE |
davidprentice | 0:b608c7f02f80 | 836 | break; |
davidprentice | 0:b608c7f02f80 | 837 | default: |
davidprentice | 0:b608c7f02f80 | 838 | WriteCmdData(0x61, _lcd_rev); |
davidprentice | 0:b608c7f02f80 | 839 | break; |
davidprentice | 0:b608c7f02f80 | 840 | } |
davidprentice | 0:b608c7f02f80 | 841 | } |
davidprentice | 0:b608c7f02f80 | 842 | |
davidprentice | 0:b608c7f02f80 | 843 | #define TFTLCD_DELAY 0xFFFF |
davidprentice | 0:b608c7f02f80 | 844 | #define TFTLCD_DELAY8 0x7F |
davidprentice | 0:b608c7f02f80 | 845 | static void init_table(const void *table, int16_t size) |
davidprentice | 0:b608c7f02f80 | 846 | { |
davidprentice | 0:b608c7f02f80 | 847 | #ifdef SUPPORT_8357D_GAMMA |
davidprentice | 0:b608c7f02f80 | 848 | uint8_t *p = (uint8_t *) table, dat[36]; //HX8357_99 has GAMMA[34] |
davidprentice | 0:b608c7f02f80 | 849 | #else |
davidprentice | 0:b608c7f02f80 | 850 | uint8_t *p = (uint8_t *) table, dat[24]; //R61526 has GAMMA[22] |
davidprentice | 0:b608c7f02f80 | 851 | #endif |
davidprentice | 0:b608c7f02f80 | 852 | while (size > 0) { |
davidprentice | 0:b608c7f02f80 | 853 | uint8_t cmd = pgm_read_byte(p++); |
davidprentice | 0:b608c7f02f80 | 854 | uint8_t len = pgm_read_byte(p++); |
davidprentice | 0:b608c7f02f80 | 855 | if (cmd == TFTLCD_DELAY8) { |
davidprentice | 0:b608c7f02f80 | 856 | delay(len); |
davidprentice | 0:b608c7f02f80 | 857 | len = 0; |
davidprentice | 0:b608c7f02f80 | 858 | } else { |
davidprentice | 0:b608c7f02f80 | 859 | for (uint8_t i = 0; i < len; i++) |
davidprentice | 0:b608c7f02f80 | 860 | dat[i] = pgm_read_byte(p++); |
davidprentice | 0:b608c7f02f80 | 861 | WriteCmdParamN(cmd, len, dat); |
davidprentice | 0:b608c7f02f80 | 862 | } |
davidprentice | 0:b608c7f02f80 | 863 | size -= len + 2; |
davidprentice | 0:b608c7f02f80 | 864 | } |
davidprentice | 0:b608c7f02f80 | 865 | } |
davidprentice | 0:b608c7f02f80 | 866 | |
davidprentice | 0:b608c7f02f80 | 867 | static void init_table16(const void *table, int16_t size) |
davidprentice | 0:b608c7f02f80 | 868 | { |
davidprentice | 0:b608c7f02f80 | 869 | uint16_t *p = (uint16_t *) table; |
davidprentice | 0:b608c7f02f80 | 870 | while (size > 0) { |
davidprentice | 0:b608c7f02f80 | 871 | uint16_t cmd = pgm_read_word(p++); |
davidprentice | 0:b608c7f02f80 | 872 | uint16_t d = pgm_read_word(p++); |
davidprentice | 0:b608c7f02f80 | 873 | if (cmd == TFTLCD_DELAY) |
davidprentice | 0:b608c7f02f80 | 874 | delay(d); |
davidprentice | 0:b608c7f02f80 | 875 | else { |
davidprentice | 0:b608c7f02f80 | 876 | writecmddata(cmd, d); //static function |
davidprentice | 0:b608c7f02f80 | 877 | } |
davidprentice | 0:b608c7f02f80 | 878 | size -= 2 * sizeof(int16_t); |
davidprentice | 0:b608c7f02f80 | 879 | } |
davidprentice | 0:b608c7f02f80 | 880 | } |
davidprentice | 0:b608c7f02f80 | 881 | |
davidprentice | 0:b608c7f02f80 | 882 | void MCUFRIEND_kbv::begin(uint16_t ID) |
davidprentice | 0:b608c7f02f80 | 883 | { |
davidprentice | 0:b608c7f02f80 | 884 | int16_t *p16; //so we can "write" to a const protected variable. |
davidprentice | 0:b608c7f02f80 | 885 | const uint8_t *table8_ads = NULL; |
davidprentice | 0:b608c7f02f80 | 886 | int16_t table_size; |
davidprentice | 0:b608c7f02f80 | 887 | reset(); |
davidprentice | 0:b608c7f02f80 | 888 | _lcd_xor = 0; |
davidprentice | 0:b608c7f02f80 | 889 | switch (_lcd_ID = ID) { |
davidprentice | 0:b608c7f02f80 | 890 | /* |
davidprentice | 0:b608c7f02f80 | 891 | static const uint16_t _regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 892 | 0x0000, 0x0001, // start oscillation |
davidprentice | 0:b608c7f02f80 | 893 | 0x0007, 0x0000, // source output control 0 D0 |
davidprentice | 0:b608c7f02f80 | 894 | 0x0013, 0x0000, // power control 3 off |
davidprentice | 0:b608c7f02f80 | 895 | 0x0011, 0x2604, // |
davidprentice | 0:b608c7f02f80 | 896 | 0x0014, 0x0015, // |
davidprentice | 0:b608c7f02f80 | 897 | 0x0010, 0x3C00, // |
davidprentice | 0:b608c7f02f80 | 898 | // 0x0013, 0x0040, // |
davidprentice | 0:b608c7f02f80 | 899 | // 0x0013, 0x0060, // |
davidprentice | 0:b608c7f02f80 | 900 | // 0x0013, 0x0070, // |
davidprentice | 0:b608c7f02f80 | 901 | 0x0013, 0x0070, // power control 3 PON PON1 AON |
davidprentice | 0:b608c7f02f80 | 902 | |
davidprentice | 0:b608c7f02f80 | 903 | 0x0001, 0x0127, // driver output control |
davidprentice | 0:b608c7f02f80 | 904 | // 0x0002, 0x0700, // field 0 b/c waveform xor waveform |
davidprentice | 0:b608c7f02f80 | 905 | 0x0003, 0x1030, // |
davidprentice | 0:b608c7f02f80 | 906 | 0x0007, 0x0000, // |
davidprentice | 0:b608c7f02f80 | 907 | 0x0008, 0x0404, // |
davidprentice | 0:b608c7f02f80 | 908 | 0x000B, 0x0200, // |
davidprentice | 0:b608c7f02f80 | 909 | 0x000C, 0x0000, // |
davidprentice | 0:b608c7f02f80 | 910 | 0x00015,0x0000, // |
davidprentice | 0:b608c7f02f80 | 911 | |
davidprentice | 0:b608c7f02f80 | 912 | //gamma setting |
davidprentice | 0:b608c7f02f80 | 913 | 0x0030, 0x0000, |
davidprentice | 0:b608c7f02f80 | 914 | 0x0031, 0x0606, |
davidprentice | 0:b608c7f02f80 | 915 | 0x0032, 0x0006, |
davidprentice | 0:b608c7f02f80 | 916 | 0x0033, 0x0403, |
davidprentice | 0:b608c7f02f80 | 917 | 0x0034, 0x0107, |
davidprentice | 0:b608c7f02f80 | 918 | 0x0035, 0x0101, |
davidprentice | 0:b608c7f02f80 | 919 | 0x0036, 0x0707, |
davidprentice | 0:b608c7f02f80 | 920 | 0x0037, 0x0304, |
davidprentice | 0:b608c7f02f80 | 921 | 0x0038, 0x0A00, |
davidprentice | 0:b608c7f02f80 | 922 | 0x0039, 0x0706, |
davidprentice | 0:b608c7f02f80 | 923 | |
davidprentice | 0:b608c7f02f80 | 924 | 0x0040, 0x0000, |
davidprentice | 0:b608c7f02f80 | 925 | 0x0041, 0x0000, |
davidprentice | 0:b608c7f02f80 | 926 | 0x0042, 0x013F, |
davidprentice | 0:b608c7f02f80 | 927 | 0x0043, 0x0000, |
davidprentice | 0:b608c7f02f80 | 928 | 0x0044, 0x0000, |
davidprentice | 0:b608c7f02f80 | 929 | 0x0045, 0x0000, |
davidprentice | 0:b608c7f02f80 | 930 | 0x0046, 0xEF00, |
davidprentice | 0:b608c7f02f80 | 931 | 0x0047, 0x013F, |
davidprentice | 0:b608c7f02f80 | 932 | 0x0048, 0x0000, |
davidprentice | 0:b608c7f02f80 | 933 | 0x0007, 0x0011, |
davidprentice | 0:b608c7f02f80 | 934 | 0x0007, 0x0017, |
davidprentice | 0:b608c7f02f80 | 935 | }; |
davidprentice | 0:b608c7f02f80 | 936 | */ |
davidprentice | 0:b608c7f02f80 | 937 | #ifdef SUPPORT_0139 |
davidprentice | 0:b608c7f02f80 | 938 | case 0x0139: |
davidprentice | 0:b608c7f02f80 | 939 | _lcd_capable = REV_SCREEN | XSA_XEA_16BIT; //remove AUTO_READINC |
davidprentice | 0:b608c7f02f80 | 940 | static const uint16_t S6D0139_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 941 | 0x0000, 0x0001, //Start oscillator |
davidprentice | 0:b608c7f02f80 | 942 | 0x0011, 0x1a00, //Power Control 2 |
davidprentice | 0:b608c7f02f80 | 943 | 0x0014, 0x2020, //Power Control 4 |
davidprentice | 0:b608c7f02f80 | 944 | 0x0010, 0x0900, //Power Control 1 |
davidprentice | 0:b608c7f02f80 | 945 | 0x0013, 0x0040, //Power Control 3 |
davidprentice | 0:b608c7f02f80 | 946 | 0x0013, 0x0060, //Power Control 3 |
davidprentice | 0:b608c7f02f80 | 947 | 0x0013, 0x0070, //Power Control 3 |
davidprentice | 0:b608c7f02f80 | 948 | 0x0011, 0x1a04, //Power Control 2 |
davidprentice | 0:b608c7f02f80 | 949 | 0x0010, 0x2f00, //Power Control 1 |
davidprentice | 0:b608c7f02f80 | 950 | 0x0001, 0x0127, //Driver Control: SM=0, GS=0, SS=1, 240x320 |
davidprentice | 0:b608c7f02f80 | 951 | 0x0002, 0x0100, //LCD Control: (.kbv was 0700) FLD=0, BC= 0, EOR=1 |
davidprentice | 0:b608c7f02f80 | 952 | 0x0003, 0x1030, //Entry Mode: TR1=0, DFM=0, BGR=1, I_D=3 |
davidprentice | 0:b608c7f02f80 | 953 | 0x0007, 0x0000, //Display Control: everything off |
davidprentice | 0:b608c7f02f80 | 954 | 0x0008, 0x0303, //Blank Period: FP=3, BP=3 |
davidprentice | 0:b608c7f02f80 | 955 | 0x0009, 0x0000, //f.k. |
davidprentice | 0:b608c7f02f80 | 956 | 0x000b, 0x0000, //Frame Control: |
davidprentice | 0:b608c7f02f80 | 957 | 0x000c, 0x0000, //Interface Control: system i/f |
davidprentice | 0:b608c7f02f80 | 958 | 0x0040, 0x0000, //Scan Line |
davidprentice | 0:b608c7f02f80 | 959 | 0x0041, 0x0000, //Vertical Scroll Control |
davidprentice | 0:b608c7f02f80 | 960 | 0x0007, 0x0014, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=0 (halt) |
davidprentice | 0:b608c7f02f80 | 961 | 0x0007, 0x0016, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=2 (blank) |
davidprentice | 0:b608c7f02f80 | 962 | 0x0007, 0x0017, //Display Control: VLE1=0, SPT=0, GON=1, REV=1, D=3 (normal) |
davidprentice | 0:b608c7f02f80 | 963 | // 0x0007, 0x0217, //Display Control: VLE1=1, SPT=0, GON=1, REV=1, D=3 |
davidprentice | 0:b608c7f02f80 | 964 | }; |
davidprentice | 0:b608c7f02f80 | 965 | init_table16(S6D0139_regValues, sizeof(S6D0139_regValues)); |
davidprentice | 0:b608c7f02f80 | 966 | break; |
davidprentice | 0:b608c7f02f80 | 967 | #endif |
davidprentice | 0:b608c7f02f80 | 968 | |
davidprentice | 0:b608c7f02f80 | 969 | #ifdef SUPPORT_0154 |
davidprentice | 0:b608c7f02f80 | 970 | case 0x0154: |
davidprentice | 0:b608c7f02f80 | 971 | _lcd_capable = AUTO_READINC | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 972 | static const uint16_t S6D0154_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 973 | 0x0011, 0x001A, |
davidprentice | 0:b608c7f02f80 | 974 | 0x0012, 0x3121, //BT=3, DC1=1, DC2=2, DC3=1 |
davidprentice | 0:b608c7f02f80 | 975 | 0x0013, 0x006C, //GVD=108 |
davidprentice | 0:b608c7f02f80 | 976 | 0x0014, 0x4249, //VCM=66, VML=73 |
davidprentice | 0:b608c7f02f80 | 977 | |
davidprentice | 0:b608c7f02f80 | 978 | 0x0010, 0x0800, //SAP=8 |
davidprentice | 0:b608c7f02f80 | 979 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 980 | 0x0011, 0x011A, //APON=0, PON=1, AON=0, VCI1_EN=1, VC=10 |
davidprentice | 0:b608c7f02f80 | 981 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 982 | 0x0011, 0x031A, //APON=0, PON=3, AON=0, VCI1_EN=1, VC=10 |
davidprentice | 0:b608c7f02f80 | 983 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 984 | 0x0011, 0x071A, //APON=0, PON=7, AON=0, VCI1_EN=1, VC=10 |
davidprentice | 0:b608c7f02f80 | 985 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 986 | 0x0011, 0x0F1A, //APON=0, PON=15, AON=0, VCI1_EN=1, VC=10 |
davidprentice | 0:b608c7f02f80 | 987 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 988 | 0x0011, 0x0F3A, //APON=0, PON=15, AON=1, VCI1_EN=1, VC=10 |
davidprentice | 0:b608c7f02f80 | 989 | TFTLCD_DELAY, 30, |
davidprentice | 0:b608c7f02f80 | 990 | |
davidprentice | 0:b608c7f02f80 | 991 | 0x0001, 0x0128, |
davidprentice | 0:b608c7f02f80 | 992 | 0x0002, 0x0100, |
davidprentice | 0:b608c7f02f80 | 993 | 0x0003, 0x1030, |
davidprentice | 0:b608c7f02f80 | 994 | 0x0007, 0x1012, |
davidprentice | 0:b608c7f02f80 | 995 | 0x0008, 0x0303, |
davidprentice | 0:b608c7f02f80 | 996 | 0x000B, 0x1100, |
davidprentice | 0:b608c7f02f80 | 997 | 0x000C, 0x0000, |
davidprentice | 0:b608c7f02f80 | 998 | 0x000F, 0x1801, |
davidprentice | 0:b608c7f02f80 | 999 | 0x0015, 0x0020, |
davidprentice | 0:b608c7f02f80 | 1000 | |
davidprentice | 0:b608c7f02f80 | 1001 | 0x0050,0x0101, |
davidprentice | 0:b608c7f02f80 | 1002 | 0x0051,0x0603, |
davidprentice | 0:b608c7f02f80 | 1003 | 0x0052,0x0408, |
davidprentice | 0:b608c7f02f80 | 1004 | 0x0053,0x0000, |
davidprentice | 0:b608c7f02f80 | 1005 | 0x0054,0x0605, |
davidprentice | 0:b608c7f02f80 | 1006 | 0x0055,0x0406, |
davidprentice | 0:b608c7f02f80 | 1007 | 0x0056,0x0303, |
davidprentice | 0:b608c7f02f80 | 1008 | 0x0057,0x0303, |
davidprentice | 0:b608c7f02f80 | 1009 | 0x0058,0x0010, |
davidprentice | 0:b608c7f02f80 | 1010 | 0x0059,0x1000, |
davidprentice | 0:b608c7f02f80 | 1011 | |
davidprentice | 0:b608c7f02f80 | 1012 | 0x0007, 0x0012, //GON=1, REV=0, D=2 |
davidprentice | 0:b608c7f02f80 | 1013 | TFTLCD_DELAY, 40, |
davidprentice | 0:b608c7f02f80 | 1014 | 0x0007, 0x0013, //GON=1, REV=0, D=3 |
davidprentice | 0:b608c7f02f80 | 1015 | 0x0007, 0x0017, //GON=1, REV=1, D=3 DISPLAY ON |
davidprentice | 0:b608c7f02f80 | 1016 | }; |
davidprentice | 0:b608c7f02f80 | 1017 | init_table16(S6D0154_regValues, sizeof(S6D0154_regValues)); |
davidprentice | 0:b608c7f02f80 | 1018 | |
davidprentice | 0:b608c7f02f80 | 1019 | break; |
davidprentice | 0:b608c7f02f80 | 1020 | #endif |
davidprentice | 0:b608c7f02f80 | 1021 | |
davidprentice | 0:b608c7f02f80 | 1022 | #ifdef SUPPORT_1289 |
davidprentice | 0:b608c7f02f80 | 1023 | case 0x9797: |
davidprentice | 0:b608c7f02f80 | 1024 | is9797 = 1; |
davidprentice | 0:b608c7f02f80 | 1025 | // _lcd_capable = 0 | XSA_XEA_16BIT | REV_SCREEN | AUTO_READINC | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1026 | // deliberately set READ_BGR to disable Software Scroll in graphictest_kbv example |
davidprentice | 0:b608c7f02f80 | 1027 | _lcd_capable = 0 | XSA_XEA_16BIT | REV_SCREEN | AUTO_READINC | READ_24BITS | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 1028 | _lcd_ID = 0x1289; |
davidprentice | 0:b608c7f02f80 | 1029 | goto common_1289; |
davidprentice | 0:b608c7f02f80 | 1030 | case 0x1289: |
davidprentice | 0:b608c7f02f80 | 1031 | _lcd_capable = 0 | XSA_XEA_16BIT | REV_SCREEN | AUTO_READINC; |
davidprentice | 0:b608c7f02f80 | 1032 | common_1289: |
davidprentice | 0:b608c7f02f80 | 1033 | // came from MikroElektronika library http://www.hmsprojects.com/tft_lcd.html |
davidprentice | 0:b608c7f02f80 | 1034 | static const uint16_t SSD1289_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1035 | 0x0000, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1036 | 0x0003, 0xA8A4, |
davidprentice | 0:b608c7f02f80 | 1037 | 0x000C, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1038 | 0x000D, 0x000A, // VRH=10 |
davidprentice | 0:b608c7f02f80 | 1039 | 0x000E, 0x2B00, |
davidprentice | 0:b608c7f02f80 | 1040 | 0x001E, 0x00B7, |
davidprentice | 0:b608c7f02f80 | 1041 | 0x0001, 0x2B3F, // setRotation() alters |
davidprentice | 0:b608c7f02f80 | 1042 | 0x0002, 0x0600, // B_C=1, EOR=1 |
davidprentice | 0:b608c7f02f80 | 1043 | 0x0010, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1044 | 0x0011, 0x6070, // setRotation() alters |
davidprentice | 0:b608c7f02f80 | 1045 | 0x0005, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1046 | 0x0006, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1047 | 0x0016, 0xEF1C, |
davidprentice | 0:b608c7f02f80 | 1048 | 0x0017, 0x0003, |
davidprentice | 0:b608c7f02f80 | 1049 | 0x0007, 0x0233, |
davidprentice | 0:b608c7f02f80 | 1050 | 0x000B, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1051 | 0x000F, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1052 | 0x0030, 0x0707, |
davidprentice | 0:b608c7f02f80 | 1053 | 0x0031, 0x0204, |
davidprentice | 0:b608c7f02f80 | 1054 | 0x0032, 0x0204, |
davidprentice | 0:b608c7f02f80 | 1055 | 0x0033, 0x0502, |
davidprentice | 0:b608c7f02f80 | 1056 | 0x0034, 0x0507, |
davidprentice | 0:b608c7f02f80 | 1057 | 0x0035, 0x0204, |
davidprentice | 0:b608c7f02f80 | 1058 | 0x0036, 0x0204, |
davidprentice | 0:b608c7f02f80 | 1059 | 0x0037, 0x0502, |
davidprentice | 0:b608c7f02f80 | 1060 | 0x003A, 0x0302, |
davidprentice | 0:b608c7f02f80 | 1061 | 0x003B, 0x0302, |
davidprentice | 0:b608c7f02f80 | 1062 | 0x0023, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1063 | 0x0024, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1064 | 0x0025, 0x8000, |
davidprentice | 0:b608c7f02f80 | 1065 | }; |
davidprentice | 0:b608c7f02f80 | 1066 | init_table16(SSD1289_regValues, sizeof(SSD1289_regValues)); |
davidprentice | 0:b608c7f02f80 | 1067 | break; |
davidprentice | 0:b608c7f02f80 | 1068 | #endif |
davidprentice | 0:b608c7f02f80 | 1069 | |
davidprentice | 0:b608c7f02f80 | 1070 | case 0x1511: // Unknown from Levy |
davidprentice | 0:b608c7f02f80 | 1071 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1; //extra read_8(dummy) |
davidprentice | 0:b608c7f02f80 | 1072 | static const uint8_t R61511_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1073 | 0xB0, 1, 0x00, //Command Access Protect |
davidprentice | 0:b608c7f02f80 | 1074 | }; |
davidprentice | 0:b608c7f02f80 | 1075 | table8_ads = R61511_regValues, table_size = sizeof(R61511_regValues); |
davidprentice | 0:b608c7f02f80 | 1076 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1077 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 1078 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1079 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 1080 | break; |
davidprentice | 0:b608c7f02f80 | 1081 | |
davidprentice | 0:b608c7f02f80 | 1082 | case 0x1520: |
davidprentice | 0:b608c7f02f80 | 1083 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1084 | static const uint8_t R61520_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1085 | 0xB0, 1, 0x00, //Command Access Protect |
davidprentice | 0:b608c7f02f80 | 1086 | 0xC0, 1, 0x0A, //DM=1, BGR=1 |
davidprentice | 0:b608c7f02f80 | 1087 | }; |
davidprentice | 0:b608c7f02f80 | 1088 | table8_ads = R61520_regValues, table_size = sizeof(R61520_regValues); |
davidprentice | 0:b608c7f02f80 | 1089 | break; |
davidprentice | 0:b608c7f02f80 | 1090 | |
davidprentice | 0:b608c7f02f80 | 1091 | case 0x1526: |
davidprentice | 0:b608c7f02f80 | 1092 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1093 | static const uint8_t R61526_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1094 | 0xB0, 1, 0x03, //Command Access |
davidprentice | 0:b608c7f02f80 | 1095 | 0xE2, 1, 0x3F, //Command Write Access |
davidprentice | 0:b608c7f02f80 | 1096 | 0xC0, 1, 0x22, //REV=0, BGR=1, SS=0 |
davidprentice | 0:b608c7f02f80 | 1097 | 0xE2, 1, 0x00, //Command Write Protect |
davidprentice | 0:b608c7f02f80 | 1098 | }; |
davidprentice | 0:b608c7f02f80 | 1099 | table8_ads = R61526_regValues, table_size = sizeof(R61526_regValues); |
davidprentice | 0:b608c7f02f80 | 1100 | break; |
davidprentice | 0:b608c7f02f80 | 1101 | |
davidprentice | 0:b608c7f02f80 | 1102 | #ifdef SUPPORT_1580 |
davidprentice | 0:b608c7f02f80 | 1103 | case 0x1580: |
davidprentice | 0:b608c7f02f80 | 1104 | _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_GS | READ_NODUMMY; //thanks vanhan123 |
davidprentice | 0:b608c7f02f80 | 1105 | static const uint16_t R61580_regValues[] PROGMEM = { //from MCHIP Graphics Lib drvTFT001.c |
davidprentice | 0:b608c7f02f80 | 1106 | // Synchronization after reset |
davidprentice | 0:b608c7f02f80 | 1107 | TFTLCD_DELAY, 2, |
davidprentice | 0:b608c7f02f80 | 1108 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1109 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1110 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1111 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1112 | |
davidprentice | 0:b608c7f02f80 | 1113 | // Setup display |
davidprentice | 0:b608c7f02f80 | 1114 | 0x00A4, 0x0001, // CALB=1 |
davidprentice | 0:b608c7f02f80 | 1115 | TFTLCD_DELAY, 2, |
davidprentice | 0:b608c7f02f80 | 1116 | 0x0060, 0xA700, // Driver Output Control |
davidprentice | 0:b608c7f02f80 | 1117 | 0x0008, 0x0808, // Display Control BP=8, FP=8 |
davidprentice | 0:b608c7f02f80 | 1118 | 0x0030, 0x0111, // y control |
davidprentice | 0:b608c7f02f80 | 1119 | 0x0031, 0x2410, // y control |
davidprentice | 0:b608c7f02f80 | 1120 | 0x0032, 0x0501, // y control |
davidprentice | 0:b608c7f02f80 | 1121 | 0x0033, 0x050C, // y control |
davidprentice | 0:b608c7f02f80 | 1122 | 0x0034, 0x2211, // y control |
davidprentice | 0:b608c7f02f80 | 1123 | 0x0035, 0x0C05, // y control |
davidprentice | 0:b608c7f02f80 | 1124 | 0x0036, 0x2105, // y control |
davidprentice | 0:b608c7f02f80 | 1125 | 0x0037, 0x1004, // y control |
davidprentice | 0:b608c7f02f80 | 1126 | 0x0038, 0x1101, // y control |
davidprentice | 0:b608c7f02f80 | 1127 | 0x0039, 0x1122, // y control |
davidprentice | 0:b608c7f02f80 | 1128 | 0x0090, 0x0019, // 80Hz |
davidprentice | 0:b608c7f02f80 | 1129 | 0x0010, 0x0530, // Power Control |
davidprentice | 0:b608c7f02f80 | 1130 | 0x0011, 0x0237, //DC1=2, DC0=3, VC=7 |
davidprentice | 0:b608c7f02f80 | 1131 | // 0x0011, 0x17B0, //DC1=7, DC0=3, VC=0 ?b12 ?b7 vanhan123 |
davidprentice | 0:b608c7f02f80 | 1132 | 0x0012, 0x01BF, //VCMR=1, PSON=1, PON=1, VRH=15 |
davidprentice | 0:b608c7f02f80 | 1133 | // 0x0012, 0x013A, //VCMR=1, PSON=1, PON=1, VRH=10 vanhan123 |
davidprentice | 0:b608c7f02f80 | 1134 | 0x0013, 0x1300, //VDV=19 |
davidprentice | 0:b608c7f02f80 | 1135 | TFTLCD_DELAY, 100, |
davidprentice | 0:b608c7f02f80 | 1136 | |
davidprentice | 0:b608c7f02f80 | 1137 | 0x0001, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1138 | 0x0002, 0x0200, |
davidprentice | 0:b608c7f02f80 | 1139 | 0x0003, 0x1030, |
davidprentice | 0:b608c7f02f80 | 1140 | 0x0009, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1141 | 0x000A, 0x0008, |
davidprentice | 0:b608c7f02f80 | 1142 | 0x000C, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1143 | 0x000D, 0xD000, |
davidprentice | 0:b608c7f02f80 | 1144 | 0x000E, 0x0030, |
davidprentice | 0:b608c7f02f80 | 1145 | 0x000F, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1146 | 0x0020, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1147 | 0x0021, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1148 | 0x0029, 0x0077, |
davidprentice | 0:b608c7f02f80 | 1149 | 0x0050, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1150 | 0x0051, 0xD0EF, |
davidprentice | 0:b608c7f02f80 | 1151 | 0x0052, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1152 | 0x0053, 0x013F, |
davidprentice | 0:b608c7f02f80 | 1153 | 0x0061, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1154 | 0x006A, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1155 | 0x0080, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1156 | 0x0081, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1157 | 0x0082, 0x005F, |
davidprentice | 0:b608c7f02f80 | 1158 | 0x0093, 0x0701, |
davidprentice | 0:b608c7f02f80 | 1159 | 0x0007, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1160 | }; |
davidprentice | 0:b608c7f02f80 | 1161 | static const uint16_t R61580_DEM240320C[] PROGMEM = { //from DEM 240320C TMH-PW-N |
davidprentice | 0:b608c7f02f80 | 1162 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1163 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1164 | TFTLCD_DELAY, 100, |
davidprentice | 0:b608c7f02f80 | 1165 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1166 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1167 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1168 | 0x00, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1169 | 0xA4, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1170 | TFTLCD_DELAY, 100, |
davidprentice | 0:b608c7f02f80 | 1171 | 0x60, 0xA700, |
davidprentice | 0:b608c7f02f80 | 1172 | 0x08, 0x0808, |
davidprentice | 0:b608c7f02f80 | 1173 | /******************************************/ |
davidprentice | 0:b608c7f02f80 | 1174 | //Gamma Setting: |
davidprentice | 0:b608c7f02f80 | 1175 | 0x30, 0x0203, |
davidprentice | 0:b608c7f02f80 | 1176 | 0x31, 0x080F, |
davidprentice | 0:b608c7f02f80 | 1177 | 0x32, 0x0401, |
davidprentice | 0:b608c7f02f80 | 1178 | 0x33, 0x050B, |
davidprentice | 0:b608c7f02f80 | 1179 | 0x34, 0x3330, |
davidprentice | 0:b608c7f02f80 | 1180 | 0x35, 0x0B05, |
davidprentice | 0:b608c7f02f80 | 1181 | 0x36, 0x0005, |
davidprentice | 0:b608c7f02f80 | 1182 | 0x37, 0x0F08, |
davidprentice | 0:b608c7f02f80 | 1183 | 0x38, 0x0302, |
davidprentice | 0:b608c7f02f80 | 1184 | 0x39, 0x3033, |
davidprentice | 0:b608c7f02f80 | 1185 | /******************************************/ |
davidprentice | 0:b608c7f02f80 | 1186 | //Power Setting: |
davidprentice | 0:b608c7f02f80 | 1187 | 0x90, 0x0018, //80Hz |
davidprentice | 0:b608c7f02f80 | 1188 | 0x10, 0x0530, //BT,AP |
davidprentice | 0:b608c7f02f80 | 1189 | 0x11, 0x0237, //DC1,DC0,VC |
davidprentice | 0:b608c7f02f80 | 1190 | 0x12, 0x01BF, |
davidprentice | 0:b608c7f02f80 | 1191 | 0x13, 0x1000, //VCOM |
davidprentice | 0:b608c7f02f80 | 1192 | TFTLCD_DELAY, 200, |
davidprentice | 0:b608c7f02f80 | 1193 | /******************************************/ |
davidprentice | 0:b608c7f02f80 | 1194 | 0x01, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1195 | 0x02, 0x0200, |
davidprentice | 0:b608c7f02f80 | 1196 | 0x03, 0x1030, |
davidprentice | 0:b608c7f02f80 | 1197 | 0x09, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1198 | 0x0A, 0x0008, |
davidprentice | 0:b608c7f02f80 | 1199 | 0x0C, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1200 | 0x0D, 0xD000, |
davidprentice | 0:b608c7f02f80 | 1201 | |
davidprentice | 0:b608c7f02f80 | 1202 | 0x0E, 0x0030, |
davidprentice | 0:b608c7f02f80 | 1203 | 0x0F, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1204 | 0x20, 0x0000, //H Start |
davidprentice | 0:b608c7f02f80 | 1205 | 0x21, 0x0000, //V Start |
davidprentice | 0:b608c7f02f80 | 1206 | 0x29, 0x002E, |
davidprentice | 0:b608c7f02f80 | 1207 | 0x50, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1208 | 0x51, 0x00EF, |
davidprentice | 0:b608c7f02f80 | 1209 | 0x52, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1210 | 0x53, 0x013F, |
davidprentice | 0:b608c7f02f80 | 1211 | 0x61, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1212 | 0x6A, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1213 | 0x80, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1214 | 0x81, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1215 | 0x82, 0x005F, |
davidprentice | 0:b608c7f02f80 | 1216 | 0x93, 0x0701, |
davidprentice | 0:b608c7f02f80 | 1217 | /******************************************/ |
davidprentice | 0:b608c7f02f80 | 1218 | 0x07, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1219 | TFTLCD_DELAY, 100, |
davidprentice | 0:b608c7f02f80 | 1220 | }; |
davidprentice | 0:b608c7f02f80 | 1221 | init_table16(R61580_DEM240320C, sizeof(R61580_DEM240320C)); |
davidprentice | 0:b608c7f02f80 | 1222 | // init_table16(R61580_regValues, sizeof(R61580_regValues)); |
davidprentice | 0:b608c7f02f80 | 1223 | break; |
davidprentice | 0:b608c7f02f80 | 1224 | #endif |
davidprentice | 0:b608c7f02f80 | 1225 | |
davidprentice | 0:b608c7f02f80 | 1226 | #if defined(SUPPORT_1963) && USING_16BIT_BUS |
davidprentice | 0:b608c7f02f80 | 1227 | case 0x1963: |
davidprentice | 0:b608c7f02f80 | 1228 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | READ_NODUMMY | INVERT_SS | INVERT_RGB; |
davidprentice | 0:b608c7f02f80 | 1229 | // from NHD 5.0" 8-bit |
davidprentice | 0:b608c7f02f80 | 1230 | static const uint8_t SSD1963_NHD_50_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1231 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1232 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1233 | (0xE0), 1, 0x03, // Lock PLL |
davidprentice | 0:b608c7f02f80 | 1234 | (0xB0), 7, 0x08, 0x80, 0x03, 0x1F, 0x01, 0xDF, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1235 | (0xF0), 1, 0x03, //was 00 pixel data interface |
davidprentice | 0:b608c7f02f80 | 1236 | // (0x3A), 1, 0x60, // SET R G B format = 6 6 6 |
davidprentice | 0:b608c7f02f80 | 1237 | (0xE2), 3, 0x1D, 0x02, 0x54, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1238 | (0xE6), 3, 0x02, 0xFF, 0xFF, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1239 | (0xB4), 8, 0x04, 0x20, 0x00, 0x58, 0x80, 0x00, 0x00, 0x00, //HSYNC |
davidprentice | 0:b608c7f02f80 | 1240 | (0xB6), 7, 0x02, 0x0D, 0x00, 0x20, 0x01, 0x00, 0x00, //VSYNC |
davidprentice | 0:b608c7f02f80 | 1241 | (0x13), 0, //Enter Normal mode |
davidprentice | 0:b608c7f02f80 | 1242 | (0x38), 0, //Exit Idle mode |
davidprentice | 0:b608c7f02f80 | 1243 | }; |
davidprentice | 0:b608c7f02f80 | 1244 | // from NHD 7.0" 8-bit |
davidprentice | 0:b608c7f02f80 | 1245 | static const uint8_t SSD1963_NHD_70_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1246 | (0xE2), 3, 0x1D, 0x02, 0x04, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1247 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1248 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1249 | (0xE0), 1, 0x03, // Lock PLL |
davidprentice | 0:b608c7f02f80 | 1250 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 1251 | TFTLCD_DELAY8, 120, |
davidprentice | 0:b608c7f02f80 | 1252 | (0xB0), 7, 0x08, 0x80, 0x03, 0x1F, 0x01, 0xDF, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1253 | (0xF0), 1, 0x03, //was 00 pixel data interface |
davidprentice | 0:b608c7f02f80 | 1254 | // (0x3A), 1, 0x60, // SET R G B format = 6 6 6 |
davidprentice | 0:b608c7f02f80 | 1255 | (0xE6), 3, 0x0F, 0xFF, 0xFF, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1256 | (0xB4), 8, 0x04, 0x20, 0x00, 0x58, 0x80, 0x00, 0x00, 0x00, //HSYNC |
davidprentice | 0:b608c7f02f80 | 1257 | (0xB6), 7, 0x02, 0x0D, 0x00, 0x20, 0x01, 0x00, 0x00, //VSYNC |
davidprentice | 0:b608c7f02f80 | 1258 | (0x13), 0, //Enter Normal mode |
davidprentice | 0:b608c7f02f80 | 1259 | (0x38), 0, //Exit Idle mode |
davidprentice | 0:b608c7f02f80 | 1260 | }; |
davidprentice | 0:b608c7f02f80 | 1261 | // from UTFTv2.81 initlcd.h |
davidprentice | 0:b608c7f02f80 | 1262 | static const uint8_t SSD1963_800_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1263 | (0xE2), 3, 0x1E, 0x02, 0x54, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1264 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1265 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1266 | (0xE0), 1, 0x03, // |
davidprentice | 0:b608c7f02f80 | 1267 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1268 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 1269 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1270 | (0xE6), 3, 0x03, 0xFF, 0xFF, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1271 | (0xB0), 7, 0x24, 0x00, 0x03, 0x1F, 0x01, 0xDF, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1272 | // (0xB0), 7, 0x24, 0x00, 0x03, 0x1F, 0x01, 0xDF, 0x2D, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1273 | (0xB4), 8, 0x03, 0xA0, 0x00, 0x2E, 0x30, 0x00, 0x0F, 0x00, //HSYNC |
davidprentice | 0:b608c7f02f80 | 1274 | (0xB6), 7, 0x02, 0x0D, 0x00, 0x10, 0x10, 0x00, 0x08, //VSYNC |
davidprentice | 0:b608c7f02f80 | 1275 | (0xBA), 1, 0x0F, //GPIO[3:0] out 1 |
davidprentice | 0:b608c7f02f80 | 1276 | (0xB8), 2, 0x07, 0x01, //GPIO3=input, GPIO[2:0]=output |
davidprentice | 0:b608c7f02f80 | 1277 | (0xF0), 1, 0x03, //pixel data interface |
davidprentice | 0:b608c7f02f80 | 1278 | TFTLCD_DELAY8, 1, |
davidprentice | 0:b608c7f02f80 | 1279 | 0x28, 0, //Display Off |
davidprentice | 0:b608c7f02f80 | 1280 | 0x11, 0, //Sleep Out |
davidprentice | 0:b608c7f02f80 | 1281 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1282 | 0x29, 0, //Display On |
davidprentice | 0:b608c7f02f80 | 1283 | (0xBE), 6, 0x06, 0xF0, 0x01, 0xF0, 0x00, 0x00, //set PWM for B/L |
davidprentice | 0:b608c7f02f80 | 1284 | (0xD0), 1, 0x0D, |
davidprentice | 0:b608c7f02f80 | 1285 | }; |
davidprentice | 0:b608c7f02f80 | 1286 | // from UTFTv2.82 initlcd.h |
davidprentice | 0:b608c7f02f80 | 1287 | static const uint8_t SSD1963_800NEW_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1288 | (0xE2), 3, 0x1E, 0x02, 0x54, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1289 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1290 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1291 | (0xE0), 1, 0x03, // |
davidprentice | 0:b608c7f02f80 | 1292 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1293 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 1294 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1295 | (0xE6), 3, 0x03, 0xFF, 0xFF, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1296 | (0xB0), 7, 0x24, 0x00, 0x03, 0x1F, 0x01, 0xDF, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1297 | (0xB4), 8, 0x03, 0xA0, 0x00, 0x2E, 0x30, 0x00, 0x0F, 0x00, //HSYNC HT=928, HPS=46, HPW=48, LPS=15 |
davidprentice | 0:b608c7f02f80 | 1298 | (0xB6), 7, 0x02, 0x0D, 0x00, 0x10, 0x10, 0x00, 0x08, //VSYNC VT=525, VPS=16, VPW=16, FPS=8 |
davidprentice | 0:b608c7f02f80 | 1299 | (0xBA), 1, 0x0F, //GPIO[3:0] out 1 |
davidprentice | 0:b608c7f02f80 | 1300 | (0xB8), 2, 0x07, 0x01, //GPIO3=input, GPIO[2:0]=output |
davidprentice | 0:b608c7f02f80 | 1301 | (0xF0), 1, 0x03, //pixel data interface |
davidprentice | 0:b608c7f02f80 | 1302 | TFTLCD_DELAY8, 1, |
davidprentice | 0:b608c7f02f80 | 1303 | 0x28, 0, //Display Off |
davidprentice | 0:b608c7f02f80 | 1304 | 0x11, 0, //Sleep Out |
davidprentice | 0:b608c7f02f80 | 1305 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1306 | 0x29, 0, //Display On |
davidprentice | 0:b608c7f02f80 | 1307 | (0xBE), 6, 0x06, 0xF0, 0x01, 0xF0, 0x00, 0x00, //set PWM for B/L |
davidprentice | 0:b608c7f02f80 | 1308 | (0xD0), 1, 0x0D, |
davidprentice | 0:b608c7f02f80 | 1309 | }; |
davidprentice | 0:b608c7f02f80 | 1310 | // from UTFTv2.82 initlcd.h |
davidprentice | 0:b608c7f02f80 | 1311 | static const uint8_t SSD1963_800ALT_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1312 | (0xE2), 3, 0x23, 0x02, 0x04, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1313 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1314 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1315 | (0xE0), 1, 0x03, // |
davidprentice | 0:b608c7f02f80 | 1316 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1317 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 1318 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1319 | (0xE6), 3, 0x04, 0x93, 0xE0, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1320 | (0xB0), 7, 0x00, 0x00, 0x03, 0x1F, 0x01, 0xDF, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1321 | (0xB4), 8, 0x03, 0xA0, 0x00, 0x2E, 0x30, 0x00, 0x0F, 0x00, //HSYNC HT=928, HPS=46, HPW=48, LPS=15 |
davidprentice | 0:b608c7f02f80 | 1322 | (0xB6), 7, 0x02, 0x0D, 0x00, 0x10, 0x10, 0x00, 0x08, //VSYNC VT=525, VPS=16, VPW=16, FPS=8 |
davidprentice | 0:b608c7f02f80 | 1323 | (0xBA), 1, 0x0F, //GPIO[3:0] out 1 |
davidprentice | 0:b608c7f02f80 | 1324 | (0xB8), 2, 0x07, 0x01, //GPIO3=input, GPIO[2:0]=output |
davidprentice | 0:b608c7f02f80 | 1325 | (0xF0), 1, 0x03, //pixel data interface |
davidprentice | 0:b608c7f02f80 | 1326 | TFTLCD_DELAY8, 1, |
davidprentice | 0:b608c7f02f80 | 1327 | 0x28, 0, //Display Off |
davidprentice | 0:b608c7f02f80 | 1328 | 0x11, 0, //Sleep Out |
davidprentice | 0:b608c7f02f80 | 1329 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1330 | 0x29, 0, //Display On |
davidprentice | 0:b608c7f02f80 | 1331 | (0xBE), 6, 0x06, 0xF0, 0x01, 0xF0, 0x00, 0x00, //set PWM for B/L |
davidprentice | 0:b608c7f02f80 | 1332 | (0xD0), 1, 0x0D, |
davidprentice | 0:b608c7f02f80 | 1333 | }; |
davidprentice | 0:b608c7f02f80 | 1334 | // from UTFTv2.82 initlcd.h |
davidprentice | 0:b608c7f02f80 | 1335 | static const uint8_t SSD1963_480_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1336 | (0xE2), 3, 0x23, 0x02, 0x54, //PLL multiplier, set PLL clock to 120M |
davidprentice | 0:b608c7f02f80 | 1337 | (0xE0), 1, 0x01, // PLL enable |
davidprentice | 0:b608c7f02f80 | 1338 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1339 | (0xE0), 1, 0x03, // |
davidprentice | 0:b608c7f02f80 | 1340 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1341 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 1342 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1343 | (0xE6), 3, 0x01, 0x1F, 0xFF, //PLL setting for PCLK, depends on resolution |
davidprentice | 0:b608c7f02f80 | 1344 | (0xB0), 7, 0x20, 0x00, 0x01, 0xDF, 0x01, 0x0F, 0x00, //LCD SPECIFICATION |
davidprentice | 0:b608c7f02f80 | 1345 | (0xB4), 8, 0x02, 0x13, 0x00, 0x08, 0x2B, 0x00, 0x02, 0x00, //HSYNC |
davidprentice | 0:b608c7f02f80 | 1346 | (0xB6), 7, 0x01, 0x20, 0x00, 0x04, 0x0C, 0x00, 0x02, //VSYNC |
davidprentice | 0:b608c7f02f80 | 1347 | (0xBA), 1, 0x0F, //GPIO[3:0] out 1 |
davidprentice | 0:b608c7f02f80 | 1348 | (0xB8), 2, 0x07, 0x01, //GPIO3=input, GPIO[2:0]=output |
davidprentice | 0:b608c7f02f80 | 1349 | (0xF0), 1, 0x03, //pixel data interface |
davidprentice | 0:b608c7f02f80 | 1350 | TFTLCD_DELAY8, 1, |
davidprentice | 0:b608c7f02f80 | 1351 | 0x28, 0, //Display Off |
davidprentice | 0:b608c7f02f80 | 1352 | 0x11, 0, //Sleep Out |
davidprentice | 0:b608c7f02f80 | 1353 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1354 | 0x29, 0, //Display On |
davidprentice | 0:b608c7f02f80 | 1355 | (0xBE), 6, 0x06, 0xF0, 0x01, 0xF0, 0x00, 0x00, //set PWM for B/L |
davidprentice | 0:b608c7f02f80 | 1356 | (0xD0), 1, 0x0D, |
davidprentice | 0:b608c7f02f80 | 1357 | }; |
davidprentice | 0:b608c7f02f80 | 1358 | // table8_ads = SSD1963_480_regValues, table_size = sizeof(SSD1963_480_regValues); |
davidprentice | 0:b608c7f02f80 | 1359 | table8_ads = SSD1963_800_regValues, table_size = sizeof(SSD1963_800_regValues); |
davidprentice | 0:b608c7f02f80 | 1360 | // table8_ads = SSD1963_NHD_50_regValues, table_size = sizeof(SSD1963_NHD_50_regValues); |
davidprentice | 0:b608c7f02f80 | 1361 | // table8_ads = SSD1963_NHD_70_regValues, table_size = sizeof(SSD1963_NHD_70_regValues); |
davidprentice | 0:b608c7f02f80 | 1362 | // table8_ads = SSD1963_800NEW_regValues, table_size = sizeof(SSD1963_800NEW_regValues); |
davidprentice | 0:b608c7f02f80 | 1363 | // table8_ads = SSD1963_800ALT_regValues, table_size = sizeof(SSD1963_800ALT_regValues); |
davidprentice | 0:b608c7f02f80 | 1364 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1365 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 1366 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1367 | *p16 = 800; |
davidprentice | 0:b608c7f02f80 | 1368 | break; |
davidprentice | 0:b608c7f02f80 | 1369 | #endif |
davidprentice | 0:b608c7f02f80 | 1370 | |
davidprentice | 0:b608c7f02f80 | 1371 | #ifdef SUPPORT_4532 |
davidprentice | 0:b608c7f02f80 | 1372 | //Support for LG Electronics LGDP4532 (also 4531 i guess) by Leodino v1.0 2-Nov-2016 |
davidprentice | 0:b608c7f02f80 | 1373 | //based on data by waveshare and the datasheet of LG Electronics |
davidprentice | 0:b608c7f02f80 | 1374 | //My approach to get it working: the parameters by waveshare did no make it function allright |
davidprentice | 0:b608c7f02f80 | 1375 | //I started with remming lines to see if this helped. Basically the stuff in range 41-93 |
davidprentice | 0:b608c7f02f80 | 1376 | //gives problems. |
davidprentice | 0:b608c7f02f80 | 1377 | //The other lines that are REMmed give no problems, but it seems default values are OK as well. |
davidprentice | 0:b608c7f02f80 | 1378 | case 0x4532: // thanks Leodino |
davidprentice | 0:b608c7f02f80 | 1379 | _lcd_capable = 0 | REV_SCREEN; // | INVERT_GS; |
davidprentice | 0:b608c7f02f80 | 1380 | static const uint16_t LGDP4532_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1381 | 0x0000,0x0001, //Device code read |
davidprentice | 0:b608c7f02f80 | 1382 | 0x0010,0x0628, //Power control 1 SAP[2:0] BT[3:0] AP[2:0] DK DSTB SLP |
davidprentice | 0:b608c7f02f80 | 1383 | 0x0012,0x0006, //Power control 3 PON VRH[3:0] |
davidprentice | 0:b608c7f02f80 | 1384 | //0x0013,0x0A32, //Power control 4 VCOMG VDV[4:0] VCM[6:0] |
davidprentice | 0:b608c7f02f80 | 1385 | 0x0011,0x0040, //Power control 2; DC1[2:0] DC0[2:0] VC[2:0] |
davidprentice | 0:b608c7f02f80 | 1386 | //0x0015,0x0050, //Regulator control RSET RI[2:0] RV[2:0] RCONT[2:0] |
davidprentice | 0:b608c7f02f80 | 1387 | 0x0012,0x0016, //Power control 3 PON VRH[3:0] |
davidprentice | 0:b608c7f02f80 | 1388 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1389 | 0x0010,0x5660, //Power control 1 SAP[2:0] BT[3:0] AP[2:0] DK DSTB SLP |
davidprentice | 0:b608c7f02f80 | 1390 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1391 | //0x0013,0x2A4E, //Power control 4 VCOMG VDV[4:0] VCM[6:0] |
davidprentice | 0:b608c7f02f80 | 1392 | //0x0001,0x0100, //Driver output control SM SS |
davidprentice | 0:b608c7f02f80 | 1393 | //0x0002,0x0300, //LCD Driving Wave Control |
davidprentice | 0:b608c7f02f80 | 1394 | //0x0003,0x1030, //Entry mode TRI DFM BGR ORG I/D[1:0] AM |
davidprentice | 0:b608c7f02f80 | 1395 | //0x0007,0x0202, //Display Control 1 PTDE[1:0] BASEE GON DTE COL D[1:0] |
davidprentice | 0:b608c7f02f80 | 1396 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1397 | //0x0008,0x0202, //Display Control 2 FP[3:0] BP[3:0] front and back porch (blank period at begin and end..) |
davidprentice | 0:b608c7f02f80 | 1398 | //0x000A,0x0000, //Test Register 1 (RA0h) |
davidprentice | 0:b608c7f02f80 | 1399 | //Gamma adjustment |
davidprentice | 0:b608c7f02f80 | 1400 | 0x0030,0x0000, |
davidprentice | 0:b608c7f02f80 | 1401 | 0x0031,0x0402, |
davidprentice | 0:b608c7f02f80 | 1402 | 0x0032,0x0106, |
davidprentice | 0:b608c7f02f80 | 1403 | 0x0033,0x0700, |
davidprentice | 0:b608c7f02f80 | 1404 | 0x0034,0x0104, |
davidprentice | 0:b608c7f02f80 | 1405 | 0x0035,0x0301, |
davidprentice | 0:b608c7f02f80 | 1406 | 0x0036,0x0707, |
davidprentice | 0:b608c7f02f80 | 1407 | 0x0037,0x0305, |
davidprentice | 0:b608c7f02f80 | 1408 | 0x0038,0x0208, |
davidprentice | 0:b608c7f02f80 | 1409 | 0x0039,0x0F0B, |
davidprentice | 0:b608c7f02f80 | 1410 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1411 | //some of this stuff in range 41-93 really throws things off.... |
davidprentice | 0:b608c7f02f80 | 1412 | //0x0041,0x0002, |
davidprentice | 0:b608c7f02f80 | 1413 | //0x0060,0x2700, //Driver Output Control (R60h) |
davidprentice | 0:b608c7f02f80 | 1414 | //0x0061,0x0001, //Base Image Display Control (R61h) |
davidprentice | 0:b608c7f02f80 | 1415 | //0x0090,0x0119, //Panel Interface Control 1 (R90h) DIVI[1:0] RTNI[4:0] |
davidprentice | 0:b608c7f02f80 | 1416 | //0x0092,0x010A, //Panel Interface Control 2 (R92h) NOWI[2:0] EQI2[1:0] EQI1[1:0] |
davidprentice | 0:b608c7f02f80 | 1417 | //0x0093,0x0004, //Panel Interface Control 3 (R93h) MCPI[2:0] |
davidprentice | 0:b608c7f02f80 | 1418 | //0x00A0,0x0100, //Test Register 1 (RA0h) |
davidprentice | 0:b608c7f02f80 | 1419 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1420 | 0x0007,0x0133, //Display Control 1 PTDE[1:0] BASEE GON DTE COL D[1:0] |
davidprentice | 0:b608c7f02f80 | 1421 | TFTLCD_DELAY,50, |
davidprentice | 0:b608c7f02f80 | 1422 | //0x00A0,0x0000, //Test Register 1 (RA0h) |
davidprentice | 0:b608c7f02f80 | 1423 | }; |
davidprentice | 0:b608c7f02f80 | 1424 | init_table16(LGDP4532_regValues, sizeof(LGDP4532_regValues)); |
davidprentice | 0:b608c7f02f80 | 1425 | break; |
davidprentice | 0:b608c7f02f80 | 1426 | #endif |
davidprentice | 0:b608c7f02f80 | 1427 | |
davidprentice | 0:b608c7f02f80 | 1428 | #ifdef SUPPORT_4535 |
davidprentice | 0:b608c7f02f80 | 1429 | case 0x4535: |
davidprentice | 0:b608c7f02f80 | 1430 | _lcd_capable = 0 | REV_SCREEN; // | INVERT_GS; |
davidprentice | 0:b608c7f02f80 | 1431 | static const uint16_t LGDP4535_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1432 | 0x0015, 0x0030, // Set the internal vcore voltage |
davidprentice | 0:b608c7f02f80 | 1433 | 0x009A, 0x0010, // Start internal OSC |
davidprentice | 0:b608c7f02f80 | 1434 | 0x0011, 0x0020, // set SS and SM bit |
davidprentice | 0:b608c7f02f80 | 1435 | 0x0010, 0x3428, // set 1 line inversion |
davidprentice | 0:b608c7f02f80 | 1436 | 0x0012, 0x0002, // set GRAM write direction and BGR=1 |
davidprentice | 0:b608c7f02f80 | 1437 | 0x0013, 0x1038, // Resize register |
davidprentice | 0:b608c7f02f80 | 1438 | TFTLCD_DELAY, 40, |
davidprentice | 0:b608c7f02f80 | 1439 | 0x0012, 0x0012, // set the back porch and front porch |
davidprentice | 0:b608c7f02f80 | 1440 | TFTLCD_DELAY, 40, |
davidprentice | 0:b608c7f02f80 | 1441 | 0x0010, 0x3420, // set non-display area refresh cycle ISC[3:0] |
davidprentice | 0:b608c7f02f80 | 1442 | 0x0013, 0x3045, // FMARK function |
davidprentice | 0:b608c7f02f80 | 1443 | TFTLCD_DELAY, 70, |
davidprentice | 0:b608c7f02f80 | 1444 | 0x0030, 0x0000, // RGB interface setting |
davidprentice | 0:b608c7f02f80 | 1445 | 0x0031, 0x0402, // Frame marker Position |
davidprentice | 0:b608c7f02f80 | 1446 | 0x0032, 0x0307, // RGB interface polarity |
davidprentice | 0:b608c7f02f80 | 1447 | 0x0033, 0x0304, // SAP, BT[3:0], AP, DSTB, SLP, STB |
davidprentice | 0:b608c7f02f80 | 1448 | 0x0034, 0x0004, // DC1[2:0], DC0[2:0], VC[2:0] |
davidprentice | 0:b608c7f02f80 | 1449 | 0x0035, 0x0401, // VREG1OUT voltage |
davidprentice | 0:b608c7f02f80 | 1450 | 0x0036, 0x0707, // VDV[4:0] for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 1451 | 0x0037, 0x0305, // SAP, BT[3:0], AP, DSTB, SLP, STB |
davidprentice | 0:b608c7f02f80 | 1452 | 0x0038, 0x0610, // DC1[2:0], DC0[2:0], VC[2:0] |
davidprentice | 0:b608c7f02f80 | 1453 | 0x0039, 0x0610, // VREG1OUT voltage |
davidprentice | 0:b608c7f02f80 | 1454 | 0x0001, 0x0100, // VDV[4:0] for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 1455 | 0x0002, 0x0300, // VCM[4:0] for VCOMH |
davidprentice | 0:b608c7f02f80 | 1456 | 0x0003, 0x1030, // GRAM horizontal Address |
davidprentice | 0:b608c7f02f80 | 1457 | 0x0008, 0x0808, // GRAM Vertical Address |
davidprentice | 0:b608c7f02f80 | 1458 | 0x000A, 0x0008, |
davidprentice | 0:b608c7f02f80 | 1459 | 0x0060, 0x2700, // Gate Scan Line |
davidprentice | 0:b608c7f02f80 | 1460 | 0x0061, 0x0001, // NDL,VLE, REV |
davidprentice | 0:b608c7f02f80 | 1461 | 0x0090, 0x013E, |
davidprentice | 0:b608c7f02f80 | 1462 | 0x0092, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1463 | 0x0093, 0x0100, |
davidprentice | 0:b608c7f02f80 | 1464 | 0x00A0, 0x3000, |
davidprentice | 0:b608c7f02f80 | 1465 | 0x00A3, 0x0010, |
davidprentice | 0:b608c7f02f80 | 1466 | 0x0007, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1467 | 0x0007, 0x0021, |
davidprentice | 0:b608c7f02f80 | 1468 | 0x0007, 0x0023, |
davidprentice | 0:b608c7f02f80 | 1469 | 0x0007, 0x0033, |
davidprentice | 0:b608c7f02f80 | 1470 | 0x0007, 0x0133, |
davidprentice | 0:b608c7f02f80 | 1471 | }; |
davidprentice | 0:b608c7f02f80 | 1472 | init_table16(LGDP4535_regValues, sizeof(LGDP4535_regValues)); |
davidprentice | 0:b608c7f02f80 | 1473 | break; |
davidprentice | 0:b608c7f02f80 | 1474 | #endif |
davidprentice | 0:b608c7f02f80 | 1475 | |
davidprentice | 0:b608c7f02f80 | 1476 | case 0x5310: |
davidprentice | 0:b608c7f02f80 | 1477 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_SS | INVERT_RGB | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1478 | static const uint8_t NT35310_regValues[] PROGMEM = { // |
davidprentice | 0:b608c7f02f80 | 1479 | TFTLCD_DELAY8, 10, //just some dummy |
davidprentice | 0:b608c7f02f80 | 1480 | }; |
davidprentice | 0:b608c7f02f80 | 1481 | table8_ads = NT35310_regValues, table_size = sizeof(NT35310_regValues); |
davidprentice | 0:b608c7f02f80 | 1482 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1483 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 1484 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1485 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 1486 | break; |
davidprentice | 0:b608c7f02f80 | 1487 | |
davidprentice | 0:b608c7f02f80 | 1488 | #ifdef SUPPORT_68140 |
davidprentice | 0:b608c7f02f80 | 1489 | case 0x6814: |
davidprentice | 0:b608c7f02f80 | 1490 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 1491 | static const uint8_t RM68140_regValues_max[] PROGMEM = { // |
davidprentice | 0:b608c7f02f80 | 1492 | 0x3A, 1, 0x55, //Pixel format .kbv my Mega Shield |
davidprentice | 0:b608c7f02f80 | 1493 | }; |
davidprentice | 0:b608c7f02f80 | 1494 | table8_ads = RM68140_regValues_max, table_size = sizeof(RM68140_regValues_max); |
davidprentice | 0:b608c7f02f80 | 1495 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1496 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 1497 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1498 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 1499 | break; |
davidprentice | 0:b608c7f02f80 | 1500 | #endif |
davidprentice | 0:b608c7f02f80 | 1501 | |
davidprentice | 0:b608c7f02f80 | 1502 | #ifdef SUPPORT_7735 |
davidprentice | 0:b608c7f02f80 | 1503 | case 0x7735: // |
davidprentice | 0:b608c7f02f80 | 1504 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1505 | static const uint8_t PROGMEM table7735S[] = { |
davidprentice | 0:b608c7f02f80 | 1506 | // (COMMAND_BYTE), n, data_bytes.... |
davidprentice | 0:b608c7f02f80 | 1507 | 0xB1, 3, 0x01, 0x2C, 0x2D, // [05 3C 3C] FRMCTR1 if GM==11 |
davidprentice | 0:b608c7f02f80 | 1508 | 0xB2, 3, 0x01, 0x2C, 0x2D, // [05 3C 3C] |
davidprentice | 0:b608c7f02f80 | 1509 | 0xB3, 6, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, // [05 3C 3C 05 3C 3C] |
davidprentice | 0:b608c7f02f80 | 1510 | 0xB4, 1, 0x07, // [07] INVCTR Column inversion |
davidprentice | 0:b608c7f02f80 | 1511 | //ST7735XR Power Sequence |
davidprentice | 0:b608c7f02f80 | 1512 | 0xC0, 3, 0xA2, 0x02, 0x84, // [A8 08 84] PWCTR1 |
davidprentice | 0:b608c7f02f80 | 1513 | 0xC1, 1, 0xC5, // [C0] |
davidprentice | 0:b608c7f02f80 | 1514 | 0xC2, 2, 0x0A, 0x00, // [0A 00] |
davidprentice | 0:b608c7f02f80 | 1515 | 0xC3, 2, 0x8A, 0x2A, // [8A 26] |
davidprentice | 0:b608c7f02f80 | 1516 | 0xC4, 2, 0x8A, 0xEE, // [8A EE] |
davidprentice | 0:b608c7f02f80 | 1517 | 0xC5, 1, 0x0E, // [05] VMCTR1 VCOM |
davidprentice | 0:b608c7f02f80 | 1518 | }; |
davidprentice | 0:b608c7f02f80 | 1519 | table8_ads = table7735S, table_size = sizeof(table7735S); // |
davidprentice | 0:b608c7f02f80 | 1520 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1521 | *p16 = 160; |
davidprentice | 0:b608c7f02f80 | 1522 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1523 | *p16 = 128; |
davidprentice | 0:b608c7f02f80 | 1524 | break; |
davidprentice | 0:b608c7f02f80 | 1525 | #endif |
davidprentice | 0:b608c7f02f80 | 1526 | |
davidprentice | 0:b608c7f02f80 | 1527 | #ifdef SUPPORT_7781 |
davidprentice | 0:b608c7f02f80 | 1528 | case 0x7783: |
davidprentice | 0:b608c7f02f80 | 1529 | _lcd_capable = AUTO_READINC | REV_SCREEN | INVERT_GS; |
davidprentice | 0:b608c7f02f80 | 1530 | static const uint16_t ST7781_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1531 | 0x00FF, 0x0001, //can we do 0xFF |
davidprentice | 0:b608c7f02f80 | 1532 | 0x00F3, 0x0008, |
davidprentice | 0:b608c7f02f80 | 1533 | // LCD_Write_COM(0x00F3, |
davidprentice | 0:b608c7f02f80 | 1534 | |
davidprentice | 0:b608c7f02f80 | 1535 | 0x00, 0x0001, |
davidprentice | 0:b608c7f02f80 | 1536 | 0x0001, 0x0100, // Driver Output Control Register (R01h) |
davidprentice | 0:b608c7f02f80 | 1537 | 0x0002, 0x0700, // LCD Driving Waveform Control (R02h) |
davidprentice | 0:b608c7f02f80 | 1538 | 0x0003, 0x1030, // Entry Mode (R03h) |
davidprentice | 0:b608c7f02f80 | 1539 | 0x0008, 0x0302, |
davidprentice | 0:b608c7f02f80 | 1540 | 0x0009, 0x0000, |
davidprentice | 0:b608c7f02f80 | 1541 | 0x0010, 0x0000, // Power Control 1 (R10h) |
davidprentice | 0:b608c7f02f80 | 1542 | 0x0011, 0x0007, // Power Control 2 (R11h) |
davidprentice | 0:b608c7f02f80 | 1543 | 0x0012, 0x0000, // Power Control 3 (R12h) |
davidprentice | 0:b608c7f02f80 | 1544 | 0x0013, 0x0000, // Power Control 4 (R13h) |
davidprentice | 0:b608c7f02f80 | 1545 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 1546 | 0x0010, 0x14B0, // Power Control 1 SAP=1, BT=4, APE=1, AP=3 |
davidprentice | 0:b608c7f02f80 | 1547 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 1548 | 0x0011, 0x0007, // Power Control 2 VC=7 |
davidprentice | 0:b608c7f02f80 | 1549 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 1550 | 0x0012, 0x008E, // Power Control 3 VCIRE=1, VRH=14 |
davidprentice | 0:b608c7f02f80 | 1551 | 0x0013, 0x0C00, // Power Control 4 VDV=12 |
davidprentice | 0:b608c7f02f80 | 1552 | 0x0029, 0x0015, // NVM read data 2 VCM=21 |
davidprentice | 0:b608c7f02f80 | 1553 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 1554 | 0x0030, 0x0000, // Gamma Control 1 |
davidprentice | 0:b608c7f02f80 | 1555 | 0x0031, 0x0107, // Gamma Control 2 |
davidprentice | 0:b608c7f02f80 | 1556 | 0x0032, 0x0000, // Gamma Control 3 |
davidprentice | 0:b608c7f02f80 | 1557 | 0x0035, 0x0203, // Gamma Control 6 |
davidprentice | 0:b608c7f02f80 | 1558 | 0x0036, 0x0402, // Gamma Control 7 |
davidprentice | 0:b608c7f02f80 | 1559 | 0x0037, 0x0000, // Gamma Control 8 |
davidprentice | 0:b608c7f02f80 | 1560 | 0x0038, 0x0207, // Gamma Control 9 |
davidprentice | 0:b608c7f02f80 | 1561 | 0x0039, 0x0000, // Gamma Control 10 |
davidprentice | 0:b608c7f02f80 | 1562 | 0x003C, 0x0203, // Gamma Control 13 |
davidprentice | 0:b608c7f02f80 | 1563 | 0x003D, 0x0403, // Gamma Control 14 |
davidprentice | 0:b608c7f02f80 | 1564 | 0x0060, 0xA700, // Driver Output Control (R60h) .kbv was 0xa700 |
davidprentice | 0:b608c7f02f80 | 1565 | 0x0061, 0x0001, // Driver Output Control (R61h) |
davidprentice | 0:b608c7f02f80 | 1566 | 0x0090, 0X0029, // Panel Interface Control 1 (R90h) |
davidprentice | 0:b608c7f02f80 | 1567 | |
davidprentice | 0:b608c7f02f80 | 1568 | // Display On |
davidprentice | 0:b608c7f02f80 | 1569 | 0x0007, 0x0133, // Display Control (R07h) |
davidprentice | 0:b608c7f02f80 | 1570 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 1571 | }; |
davidprentice | 0:b608c7f02f80 | 1572 | init_table16(ST7781_regValues, sizeof(ST7781_regValues)); |
davidprentice | 0:b608c7f02f80 | 1573 | break; |
davidprentice | 0:b608c7f02f80 | 1574 | #endif |
davidprentice | 0:b608c7f02f80 | 1575 | |
davidprentice | 0:b608c7f02f80 | 1576 | case 0x7789: |
davidprentice | 0:b608c7f02f80 | 1577 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1578 | static const uint8_t ST7789_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1579 | (0xB2), 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, //PORCTRK: Porch setting [08 08 00 22 22] PSEN=0 anyway |
davidprentice | 0:b608c7f02f80 | 1580 | (0xB7), 1, 0x35, //GCTRL: Gate Control [35] |
davidprentice | 0:b608c7f02f80 | 1581 | (0xBB), 1, 0x2B, //VCOMS: VCOM setting VCOM=1.175 [20] VCOM=0.9 |
davidprentice | 0:b608c7f02f80 | 1582 | (0xC0), 1, 0x04, //LCMCTRL: LCM Control [2C] |
davidprentice | 0:b608c7f02f80 | 1583 | (0xC2), 2, 0x01, 0xFF, //VDVVRHEN: VDV and VRH Command Enable [01 FF] |
davidprentice | 0:b608c7f02f80 | 1584 | (0xC3), 1, 0x11, //VRHS: VRH Set VAP=4.4, VAN=-4.4 [0B] |
davidprentice | 0:b608c7f02f80 | 1585 | (0xC4), 1, 0x20, //VDVS: VDV Set [20] |
davidprentice | 0:b608c7f02f80 | 1586 | (0xC6), 1, 0x0F, //FRCTRL2: Frame Rate control in normal mode [0F] |
davidprentice | 0:b608c7f02f80 | 1587 | (0xD0), 2, 0xA4, 0xA1, //PWCTRL1: Power Control 1 [A4 A1] |
davidprentice | 0:b608c7f02f80 | 1588 | (0xE0), 14, 0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19, //PVGAMCTRL: Positive Voltage Gamma control |
davidprentice | 0:b608c7f02f80 | 1589 | (0xE1), 14, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19, //NVGAMCTRL: Negative Voltage Gamma control |
davidprentice | 0:b608c7f02f80 | 1590 | }; |
davidprentice | 0:b608c7f02f80 | 1591 | static const uint8_t ST7789_regValues_arcain6[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1592 | (0xB2), 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, //PORCTRK: Porch setting [08 08 00 22 22] PSEN=0 anyway |
davidprentice | 0:b608c7f02f80 | 1593 | (0xB7), 1, 0x35, //GCTRL: Gate Control [35] |
davidprentice | 0:b608c7f02f80 | 1594 | (0xBB), 1, 0x35, //VCOMS: VCOM setting VCOM=??? [20] VCOM=0.9 |
davidprentice | 0:b608c7f02f80 | 1595 | (0xC0), 1, 0x2C, //LCMCTRL: LCM Control [2C] |
davidprentice | 0:b608c7f02f80 | 1596 | (0xC2), 2, 0x01, 0xFF, //VDVVRHEN: VDV and VRH Command Enable [01 FF] |
davidprentice | 0:b608c7f02f80 | 1597 | (0xC3), 1, 0x13, //VRHS: VRH Set VAP=???, VAN=-??? [0B] |
davidprentice | 0:b608c7f02f80 | 1598 | (0xC4), 1, 0x20, //VDVS: VDV Set [20] |
davidprentice | 0:b608c7f02f80 | 1599 | (0xC6), 1, 0x0F, //FRCTRL2: Frame Rate control in normal mode [0F] |
davidprentice | 0:b608c7f02f80 | 1600 | (0xCA), 1, 0x0F, //REGSEL2 [0F] |
davidprentice | 0:b608c7f02f80 | 1601 | (0xC8), 1, 0x08, //REGSEL1 [08] |
davidprentice | 0:b608c7f02f80 | 1602 | (0x55), 1, 0x90, //WRCACE [00] |
davidprentice | 0:b608c7f02f80 | 1603 | (0xD0), 2, 0xA4, 0xA1, //PWCTRL1: Power Control 1 [A4 A1] |
davidprentice | 0:b608c7f02f80 | 1604 | (0xE0), 14, 0xD0, 0x00, 0x06, 0x09, 0x0B, 0x2A, 0x3C, 0x55, 0x4B, 0x08, 0x16, 0x14, 0x19, 0x20, //PVGAMCTRL: Positive Voltage Gamma control |
davidprentice | 0:b608c7f02f80 | 1605 | (0xE1), 14, 0xD0, 0x00, 0x06, 0x09, 0x0B, 0x29, 0x36, 0x54, 0x4B, 0x0D, 0x16, 0x14, 0x21, 0x20, //NVGAMCTRL: Negative Voltage Gamma control |
davidprentice | 0:b608c7f02f80 | 1606 | }; |
davidprentice | 0:b608c7f02f80 | 1607 | table8_ads = ST7789_regValues, table_size = sizeof(ST7789_regValues); // |
davidprentice | 0:b608c7f02f80 | 1608 | break; |
davidprentice | 0:b608c7f02f80 | 1609 | |
davidprentice | 0:b608c7f02f80 | 1610 | case 0x8031: //Unknown BangGood thanks PrinceCharles |
davidprentice | 0:b608c7f02f80 | 1611 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 1612 | static const uint8_t FK8031_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1613 | // 0xF2:8.2 = SM, 0xF2:8.0 = REV. invertDisplay(), vertScroll() do not work |
davidprentice | 0:b608c7f02f80 | 1614 | 0xF2,11, 0x16, 0x16, 0x03, 0x08, 0x08, 0x08, 0x08, 0x10, 0x04, 0x16, 0x16, // f.k. 0xF2:8.2 SM=1 |
davidprentice | 0:b608c7f02f80 | 1615 | 0xFD, 3, 0x11, 0x02, 0x35, //f.k 0xFD:1.1 creates contiguous scan lins |
davidprentice | 0:b608c7f02f80 | 1616 | }; |
davidprentice | 0:b608c7f02f80 | 1617 | table8_ads = FK8031_regValues, table_size = sizeof(FK8031_regValues); |
davidprentice | 0:b608c7f02f80 | 1618 | break; |
davidprentice | 0:b608c7f02f80 | 1619 | |
davidprentice | 0:b608c7f02f80 | 1620 | #ifdef SUPPORT_8347D |
davidprentice | 0:b608c7f02f80 | 1621 | case 0x4747: //HX8347-D |
davidprentice | 0:b608c7f02f80 | 1622 | _lcd_capable = REV_SCREEN | MIPI_DCS_REV1 | MV_AXIS | INVERT_SS | AUTO_READINC | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1623 | goto common_8347DGI; |
davidprentice | 0:b608c7f02f80 | 1624 | case 0x6767: //HX8367-A |
davidprentice | 0:b608c7f02f80 | 1625 | case 0x7575: //HX8347-G |
davidprentice | 0:b608c7f02f80 | 1626 | case 0x9595: //HX8347-I |
davidprentice | 0:b608c7f02f80 | 1627 | _lcd_capable = REV_SCREEN | MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 1628 | common_8347DGI: |
davidprentice | 0:b608c7f02f80 | 1629 | is8347 = 1; |
davidprentice | 0:b608c7f02f80 | 1630 | static const uint8_t HX8347G_2_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1631 | 0xEA, 2, 0x00, 0x20, //PTBA[15:0] |
davidprentice | 0:b608c7f02f80 | 1632 | 0xEC, 2, 0x0C, 0xC4, //STBA[15:0] |
davidprentice | 0:b608c7f02f80 | 1633 | 0xE8, 1, 0x38, //OPON[7:0] |
davidprentice | 0:b608c7f02f80 | 1634 | 0xE9, 1, 0x10, //OPON1[7:0] |
davidprentice | 0:b608c7f02f80 | 1635 | 0xF1, 1, 0x01, //OTPS1B |
davidprentice | 0:b608c7f02f80 | 1636 | 0xF2, 1, 0x10, //GEN |
davidprentice | 0:b608c7f02f80 | 1637 | //Gamma 2.2 Setting |
davidprentice | 0:b608c7f02f80 | 1638 | 0x40, 13, 0x01, 0x00, 0x00, 0x10, 0x0E, 0x24, 0x04, 0x50, 0x02, 0x13, 0x19, 0x19, 0x16, |
davidprentice | 0:b608c7f02f80 | 1639 | 0x50, 14, 0x1B, 0x31, 0x2F, 0x3F, 0x3F, 0x3E, 0x2F, 0x7B, 0x09, 0x06, 0x06, 0x0C, 0x1D, 0xCC, |
davidprentice | 0:b608c7f02f80 | 1640 | //Power Voltage Setting |
davidprentice | 0:b608c7f02f80 | 1641 | 0x1B, 1, 0x1B, //VRH=4.65V |
davidprentice | 0:b608c7f02f80 | 1642 | 0x1A, 1, 0x01, //BT (VGH~15V,VGL~-10V,DDVDH~5V) |
davidprentice | 0:b608c7f02f80 | 1643 | 0x24, 1, 0x2F, //VMH(VCOM High voltage ~3.2V) |
davidprentice | 0:b608c7f02f80 | 1644 | 0x25, 1, 0x57, //VML(VCOM Low voltage -1.2V) |
davidprentice | 0:b608c7f02f80 | 1645 | //****VCOM offset**/// |
davidprentice | 0:b608c7f02f80 | 1646 | 0x23, 1, 0x88, //for Flicker adjust //can reload from OTP |
davidprentice | 0:b608c7f02f80 | 1647 | //Power on Setting |
davidprentice | 0:b608c7f02f80 | 1648 | 0x18, 1, 0x34, //I/P_RADJ,N/P_RADJ, Normal mode 60Hz |
davidprentice | 0:b608c7f02f80 | 1649 | 0x19, 1, 0x01, //OSC_EN='1', start Osc |
davidprentice | 0:b608c7f02f80 | 1650 | 0x01, 1, 0x00, //DP_STB='0', out deep sleep |
davidprentice | 0:b608c7f02f80 | 1651 | 0x1F, 1, 0x88, // GAS=1, VOMG=00, PON=0, DK=1, XDK=0, DVDH_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1652 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1653 | 0x1F, 1, 0x80, // GAS=1, VOMG=00, PON=0, DK=0, XDK=0, DVDH_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1654 | TFTLCD_DELAY8, 3, |
davidprentice | 0:b608c7f02f80 | 1655 | 0x1F, 1, 0x90, // GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1656 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1657 | 0x1F, 1, 0xD0, // GAS=1, VOMG=10, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1658 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1659 | //262k/65k color selection |
davidprentice | 0:b608c7f02f80 | 1660 | 0x17, 1, 0x05, //default 0x06 262k color // 0x05 65k color |
davidprentice | 0:b608c7f02f80 | 1661 | //SET PANEL |
davidprentice | 0:b608c7f02f80 | 1662 | 0x36, 1, 0x00, //SS_P, GS_P,REV_P,BGR_P |
davidprentice | 0:b608c7f02f80 | 1663 | //Display ON Setting |
davidprentice | 0:b608c7f02f80 | 1664 | 0x28, 1, 0x38, //GON=1, DTE=1, D=1000 |
davidprentice | 0:b608c7f02f80 | 1665 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1666 | 0x28, 1, 0x3F, //GON=1, DTE=1, D=1100 |
davidprentice | 0:b608c7f02f80 | 1667 | |
davidprentice | 0:b608c7f02f80 | 1668 | 0x16, 1, 0x18, |
davidprentice | 0:b608c7f02f80 | 1669 | }; |
davidprentice | 0:b608c7f02f80 | 1670 | init_table(HX8347G_2_regValues, sizeof(HX8347G_2_regValues)); |
davidprentice | 0:b608c7f02f80 | 1671 | break; |
davidprentice | 0:b608c7f02f80 | 1672 | #endif |
davidprentice | 0:b608c7f02f80 | 1673 | |
davidprentice | 0:b608c7f02f80 | 1674 | #ifdef SUPPORT_8352A |
davidprentice | 0:b608c7f02f80 | 1675 | case 0x5252: //HX8352-A |
davidprentice | 0:b608c7f02f80 | 1676 | _lcd_capable = MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 1677 | is8347 = 1; |
davidprentice | 0:b608c7f02f80 | 1678 | static const uint8_t HX8352A_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1679 | 0x83, 1, 0x02, //Test Mode: TESTM=1 |
davidprentice | 0:b608c7f02f80 | 1680 | 0x85, 1, 0x03, //VDD ctl : VDC_SEL=3 [05] |
davidprentice | 0:b608c7f02f80 | 1681 | 0x8B, 1, 0x01, //VGS_RES 1: RES_VGS1=1 |
davidprentice | 0:b608c7f02f80 | 1682 | 0x8C, 1, 0x93, //VGS_RES 2: RES_VGS2=1, anon=0x13 [93] |
davidprentice | 0:b608c7f02f80 | 1683 | 0x91, 1, 0x01, //PWM control: SYNC=1 |
davidprentice | 0:b608c7f02f80 | 1684 | 0x83, 1, 0x00, //Test Mode: TESTM=0 |
davidprentice | 0:b608c7f02f80 | 1685 | //Gamma Setting |
davidprentice | 0:b608c7f02f80 | 1686 | 0x3E, 12, 0xB0, 0x03, 0x10, 0x56, 0x13, 0x46, 0x23, 0x76, 0x00, 0x5E, 0x4F, 0x40, |
davidprentice | 0:b608c7f02f80 | 1687 | //Power Voltage Setting |
davidprentice | 0:b608c7f02f80 | 1688 | 0x17, 1, 0x91, //OSC 1: RADJ=9, OSC_EN=1 [F0] |
davidprentice | 0:b608c7f02f80 | 1689 | 0x2B, 1, 0xF9, //Cycle 1: N_DC=F9 [BE] |
davidprentice | 0:b608c7f02f80 | 1690 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1691 | 0x1B, 1, 0x14, //Power 3: BT=1, ??=1, AP=0 [42] |
davidprentice | 0:b608c7f02f80 | 1692 | 0x1A, 1, 0x11, //Power 2: VC3=1, VC1=1 [05] |
davidprentice | 0:b608c7f02f80 | 1693 | 0x1C, 1, 0x06, //Power 4: VRH=6 [0D] |
davidprentice | 0:b608c7f02f80 | 1694 | 0x1F, 1, 0x42, //VCOM : VCM=42 [55] |
davidprentice | 0:b608c7f02f80 | 1695 | TFTLCD_DELAY8, 20, |
davidprentice | 0:b608c7f02f80 | 1696 | 0x19, 1, 0x0A, //Power 1: DK=1, VL_TR1=1 [09] |
davidprentice | 0:b608c7f02f80 | 1697 | 0x19, 1, 0x1A, //Power 1: PON=1, DK=1, VL_TR1=1 [09] |
davidprentice | 0:b608c7f02f80 | 1698 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1699 | 0x19, 1, 0x12, //Power 1: PON=1, DK=1, STB=1 [09] |
davidprentice | 0:b608c7f02f80 | 1700 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1701 | 0x1E, 1, 0x27, //Power 6: VCOMG=1, VDV=7 [10] |
davidprentice | 0:b608c7f02f80 | 1702 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1703 | //Display ON Setting |
davidprentice | 0:b608c7f02f80 | 1704 | 0x24, 1, 0x60, //Display 2: PT=1, GON=1 [A0] |
davidprentice | 0:b608c7f02f80 | 1705 | 0x3D, 1, 0x40, //Source 1: N_SAP=40 [C0] |
davidprentice | 0:b608c7f02f80 | 1706 | 0x34, 1, 0x38, //Cycle 10: EQS=0x38 [38] |
davidprentice | 0:b608c7f02f80 | 1707 | 0x35, 1, 0x38, //Cycle 11: EQP=0x38 [38] |
davidprentice | 0:b608c7f02f80 | 1708 | 0x24, 1, 0x38, //Display 2: GON=1 D=2 [A0] |
davidprentice | 0:b608c7f02f80 | 1709 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1710 | 0x24, 1, 0x3C, //Display 2: GON=1 D=3 [A0] |
davidprentice | 0:b608c7f02f80 | 1711 | 0x16, 1, 0x1C, //Memaccess: GS=1, BGR=1, SS=1 |
davidprentice | 0:b608c7f02f80 | 1712 | 0x01, 1, 0x06, //Disp Mode: INVON=1, NORON=1 [02] |
davidprentice | 0:b608c7f02f80 | 1713 | 0x55, 1, 0x06, //SM_PANEL=0, SS_PANEL=0, GS_PANEL=1, REV_PANEL=1, BGR_PANEL=0 |
davidprentice | 0:b608c7f02f80 | 1714 | }; |
davidprentice | 0:b608c7f02f80 | 1715 | init_table(HX8352A_regValues, sizeof(HX8352A_regValues)); |
davidprentice | 0:b608c7f02f80 | 1716 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1717 | *p16 = 400; |
davidprentice | 0:b608c7f02f80 | 1718 | break; |
davidprentice | 0:b608c7f02f80 | 1719 | #endif |
davidprentice | 0:b608c7f02f80 | 1720 | |
davidprentice | 0:b608c7f02f80 | 1721 | #ifdef SUPPORT_8352B |
davidprentice | 0:b608c7f02f80 | 1722 | case 0x0065: //HX8352-B |
davidprentice | 0:b608c7f02f80 | 1723 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 1724 | is8347 = 1; |
davidprentice | 0:b608c7f02f80 | 1725 | static const uint8_t HX8352B_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1726 | // Register setting for EQ setting |
davidprentice | 0:b608c7f02f80 | 1727 | 0xe5, 1, 0x10, // |
davidprentice | 0:b608c7f02f80 | 1728 | 0xe7, 1, 0x10, // |
davidprentice | 0:b608c7f02f80 | 1729 | 0xe8, 1, 0x48, // |
davidprentice | 0:b608c7f02f80 | 1730 | 0xec, 1, 0x09, // |
davidprentice | 0:b608c7f02f80 | 1731 | 0xed, 1, 0x6c, // |
davidprentice | 0:b608c7f02f80 | 1732 | // Power on Setting |
davidprentice | 0:b608c7f02f80 | 1733 | 0x23, 1, 0x6F, //VMF |
davidprentice | 0:b608c7f02f80 | 1734 | 0x24, 1, 0x57, //VMH |
davidprentice | 0:b608c7f02f80 | 1735 | 0x25, 1, 0x71, //VML |
davidprentice | 0:b608c7f02f80 | 1736 | 0xE2, 1, 0x18, // |
davidprentice | 0:b608c7f02f80 | 1737 | 0x1B, 1, 0x15, //VRH |
davidprentice | 0:b608c7f02f80 | 1738 | 0x01, 1, 0x00, // |
davidprentice | 0:b608c7f02f80 | 1739 | 0x1C, 1, 0x03, //AP=3 |
davidprentice | 0:b608c7f02f80 | 1740 | // Power on sequence |
davidprentice | 0:b608c7f02f80 | 1741 | 0x19, 1, 0x01, //OSCEN=1 |
davidprentice | 0:b608c7f02f80 | 1742 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1743 | 0x1F, 1, 0x8C, //GASEN=1, DK=1, XDK=1 |
davidprentice | 0:b608c7f02f80 | 1744 | 0x1F, 1, 0x84, //GASEN=1, XDK=1 |
davidprentice | 0:b608c7f02f80 | 1745 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1746 | 0x1F, 1, 0x94, //GASEN=1, PON=1, XDK=1 |
davidprentice | 0:b608c7f02f80 | 1747 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1748 | 0x1F, 1, 0xD4, //GASEN=1, VCOMG=1, PON=1, XDK=1 |
davidprentice | 0:b608c7f02f80 | 1749 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1750 | // Gamma Setting |
davidprentice | 0:b608c7f02f80 | 1751 | 0x40, 13, 0x00, 0x2B, 0x29, 0x3E, 0x3D, 0x3F, 0x24, 0x74, 0x08, 0x06, 0x07, 0x0D, 0x17, |
davidprentice | 0:b608c7f02f80 | 1752 | 0x50, 13, 0x00, 0x02, 0x01, 0x16, 0x14, 0x3F, 0x0B, 0x5B, 0x08, 0x12, 0x18, 0x19, 0x17, |
davidprentice | 0:b608c7f02f80 | 1753 | 0x5D, 1, 0xFF, // |
davidprentice | 0:b608c7f02f80 | 1754 | |
davidprentice | 0:b608c7f02f80 | 1755 | 0x16, 1, 0x08, //MemoryAccess BGR=1 |
davidprentice | 0:b608c7f02f80 | 1756 | 0x28, 1, 0x20, //GON=1 |
davidprentice | 0:b608c7f02f80 | 1757 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1758 | 0x28, 1, 0x38, //GON=1, DTE=1, D=2 |
davidprentice | 0:b608c7f02f80 | 1759 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1760 | 0x28, 1, 0x3C, //GON=1, DTE=1, D=3 |
davidprentice | 0:b608c7f02f80 | 1761 | |
davidprentice | 0:b608c7f02f80 | 1762 | 0x02, 2, 0x00, 0x00, //SC |
davidprentice | 0:b608c7f02f80 | 1763 | 0x04, 2, 0x00, 0xEF, //EC |
davidprentice | 0:b608c7f02f80 | 1764 | 0x06, 2, 0x00, 0x00, //SP |
davidprentice | 0:b608c7f02f80 | 1765 | 0x08, 2, 0x01, 0x8F, //EP |
davidprentice | 0:b608c7f02f80 | 1766 | |
davidprentice | 0:b608c7f02f80 | 1767 | 0x80, 2, 0x00, 0x00, //CAC |
davidprentice | 0:b608c7f02f80 | 1768 | 0x82, 2, 0x00, 0x00, //RAC |
davidprentice | 0:b608c7f02f80 | 1769 | 0x17, 1, 0x05, //COLMOD = 565 |
davidprentice | 0:b608c7f02f80 | 1770 | |
davidprentice | 0:b608c7f02f80 | 1771 | }; |
davidprentice | 0:b608c7f02f80 | 1772 | init_table(HX8352B_regValues, sizeof(HX8352B_regValues)); |
davidprentice | 0:b608c7f02f80 | 1773 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1774 | *p16 = 400; |
davidprentice | 0:b608c7f02f80 | 1775 | break; |
davidprentice | 0:b608c7f02f80 | 1776 | #endif |
davidprentice | 0:b608c7f02f80 | 1777 | |
davidprentice | 0:b608c7f02f80 | 1778 | #ifdef SUPPORT_8347A |
davidprentice | 0:b608c7f02f80 | 1779 | case 0x8347: |
davidprentice | 0:b608c7f02f80 | 1780 | _lcd_capable = REV_SCREEN | MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 1781 | // AN.01 The reference setting of CMO 3.2” Panel |
davidprentice | 0:b608c7f02f80 | 1782 | static const uint8_t HX8347A_CMO32_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1783 | // VENDOR Gamma for 3.2" |
davidprentice | 0:b608c7f02f80 | 1784 | (0x46), 12, 0xA4, 0x53, 0x00, 0x44, 0x04, 0x67, 0x33, 0x77, 0x12, 0x4C, 0x46, 0x44, |
davidprentice | 0:b608c7f02f80 | 1785 | // Display Setting |
davidprentice | 0:b608c7f02f80 | 1786 | (0x01), 1, 0x06, // IDMON=0, INVON=1, NORON=1, PTLON=0 |
davidprentice | 0:b608c7f02f80 | 1787 | (0x16), 1, 0x48, // MY=0, MX=0, MV=0, ML=1, BGR=0, TEON=0 |
davidprentice | 0:b608c7f02f80 | 1788 | (0x23), 3, 0x95, 0x95, 0xFF, // N_DC=1001 0101, PI_DC=1001 0101, I_DC=1111 1111 |
davidprentice | 0:b608c7f02f80 | 1789 | |
davidprentice | 0:b608c7f02f80 | 1790 | (0x27), 4, 0x02, 0x02, 0x02, 0x02, // N_BP=2, N_FP=2, PI_BP=2, PI_FP=2 |
davidprentice | 0:b608c7f02f80 | 1791 | (0x2C), 2, 0x02, 0x02, // I_BP=2, I_FP=2 |
davidprentice | 0:b608c7f02f80 | 1792 | |
davidprentice | 0:b608c7f02f80 | 1793 | (0x3a), 4, 0x01, 0x01, 0xF0, 0x00, // N_RTN=0, N_NW=1, P_RTN=0, P_NW=1, I_RTN=15, I_NW=0, DIV=0 |
davidprentice | 0:b608c7f02f80 | 1794 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1795 | (0x35), 2, 0x38, 0x78, // EQS=38h, EQP=78h |
davidprentice | 0:b608c7f02f80 | 1796 | (0x3E), 1, 0x38, // SON=38h |
davidprentice | 0:b608c7f02f80 | 1797 | (0x40), 2, 0x0F, 0xF0, // GDON=0Fh, GDOFF |
davidprentice | 0:b608c7f02f80 | 1798 | // Power Supply Setting |
davidprentice | 0:b608c7f02f80 | 1799 | (0x19), 1, 0x49, // CADJ=0100, CUADJ=100, OSD_EN=1 ,60Hz |
davidprentice | 0:b608c7f02f80 | 1800 | (0x93), 1, 0x0F, // RADJ=1111, 100% |
davidprentice | 0:b608c7f02f80 | 1801 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1802 | (0x20), 1, 0x40, // BT=0100 |
davidprentice | 0:b608c7f02f80 | 1803 | (0x1D), 3, 0x07, 0x00, 0x04, // VC1=7, VC3=0, VRH=?? |
davidprentice | 0:b608c7f02f80 | 1804 | //VCOM SETTING for 3.2" |
davidprentice | 0:b608c7f02f80 | 1805 | (0x44), 2, 0x4D, 0x11, // VCM=100 1101, VDV=1 0001 |
davidprentice | 0:b608c7f02f80 | 1806 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1807 | (0x1C), 1, 0x04, // AP=100 |
davidprentice | 0:b608c7f02f80 | 1808 | TFTLCD_DELAY8, 20, |
davidprentice | 0:b608c7f02f80 | 1809 | (0x1B), 1, 0x18, // GASENB=0, PON=0, DK=1, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1810 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1811 | (0x1B), 1, 0x10, // GASENB=0, PON=1, DK=0, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1812 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1813 | (0x43), 1, 0x80, //set VCOMG=1 |
davidprentice | 0:b608c7f02f80 | 1814 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1815 | // Display ON Setting |
davidprentice | 0:b608c7f02f80 | 1816 | (0x90), 1, 0x7F, // SAP=0111 1111 |
davidprentice | 0:b608c7f02f80 | 1817 | (0x26), 1, 0x04, //GON=0, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1818 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1819 | (0x26), 1, 0x24, //GON=1, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1820 | (0x26), 1, 0x2C, //GON=1, DTE=0, D=11 |
davidprentice | 0:b608c7f02f80 | 1821 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1822 | (0x26), 1, 0x3C, //GON=1, DTE=1, D=11 |
davidprentice | 0:b608c7f02f80 | 1823 | // INTERNAL REGISTER SETTING |
davidprentice | 0:b608c7f02f80 | 1824 | (0x57), 1, 0x02, // TEST_Mode=1: into TEST mode |
davidprentice | 0:b608c7f02f80 | 1825 | (0x55), 1, 0x00, // VDC_SEL=000, VDDD=1.95V |
davidprentice | 0:b608c7f02f80 | 1826 | (0xFE), 1, 0x5A, // For ESD protection |
davidprentice | 0:b608c7f02f80 | 1827 | (0x57), 1, 0x00, // TEST_Mode=0: exit TEST mode |
davidprentice | 0:b608c7f02f80 | 1828 | }; |
davidprentice | 0:b608c7f02f80 | 1829 | // AN.01 The reference setting of CMO 2.4” Panel |
davidprentice | 0:b608c7f02f80 | 1830 | static const uint8_t HX8347A_CMO24_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1831 | // VENDOR Gamma for 2.4" |
davidprentice | 0:b608c7f02f80 | 1832 | (0x46), 12, 0x94, 0x41, 0x00, 0x33, 0x23, 0x45, 0x44, 0x77, 0x12, 0xCC, 0x46, 0x82, |
davidprentice | 0:b608c7f02f80 | 1833 | // Display Setting |
davidprentice | 0:b608c7f02f80 | 1834 | (0x01), 1, 0x06, // IDMON=0, INVON=1, NORON=1, PTLON=0 |
davidprentice | 0:b608c7f02f80 | 1835 | (0x16), 1, 0x48, // MY=0, MX=0, MV=0, ML=1, BGR=0, TEON=0 |
davidprentice | 0:b608c7f02f80 | 1836 | (0x23), 3, 0x95, 0x95, 0xFF, // N_DC=1001 0101, PI_DC=1001 0101, I_DC=1111 1111 |
davidprentice | 0:b608c7f02f80 | 1837 | |
davidprentice | 0:b608c7f02f80 | 1838 | (0x27), 4, 0x02, 0x02, 0x02, 0x02, // N_BP=2, N_FP=2, PI_BP=2, PI_FP=2 |
davidprentice | 0:b608c7f02f80 | 1839 | (0x2C), 2, 0x02, 0x02, // I_BP=2, I_FP=2 |
davidprentice | 0:b608c7f02f80 | 1840 | |
davidprentice | 0:b608c7f02f80 | 1841 | (0x3a), 4, 0x01, 0x01, 0xF0, 0x00, // N_RTN=0, N_NW=1, P_RTN=0, P_NW=1, I_RTN=15, I_NW=0, DIV=0 |
davidprentice | 0:b608c7f02f80 | 1842 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1843 | (0x35), 2, 0x38, 0x78, // EQS=38h, EQP=78h |
davidprentice | 0:b608c7f02f80 | 1844 | (0x3E), 1, 0x38, // SON=38h |
davidprentice | 0:b608c7f02f80 | 1845 | (0x40), 2, 0x0F, 0xF0, // GDON=0Fh, GDOFF |
davidprentice | 0:b608c7f02f80 | 1846 | // Power Supply Setting |
davidprentice | 0:b608c7f02f80 | 1847 | (0x19), 1, 0x49, // CADJ=0100, CUADJ=100, OSD_EN=1 ,60Hz |
davidprentice | 0:b608c7f02f80 | 1848 | (0x93), 1, 0x0F, // RADJ=1111, 100% |
davidprentice | 0:b608c7f02f80 | 1849 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1850 | (0x20), 1, 0x40, // BT=0100 |
davidprentice | 0:b608c7f02f80 | 1851 | (0x1D), 3, 0x07, 0x00, 0x04, // VC1=7, VC3=0, VRH=?? |
davidprentice | 0:b608c7f02f80 | 1852 | //VCOM SETTING for 2.4" |
davidprentice | 0:b608c7f02f80 | 1853 | (0x44), 2, 0x40, 0x12, // VCM=100 0000, VDV=1 0001 |
davidprentice | 0:b608c7f02f80 | 1854 | TFTLCD_DELAY8, 10, |
davidprentice | 0:b608c7f02f80 | 1855 | (0x1C), 1, 0x04, // AP=100 |
davidprentice | 0:b608c7f02f80 | 1856 | TFTLCD_DELAY8, 20, |
davidprentice | 0:b608c7f02f80 | 1857 | (0x1B), 1, 0x18, // GASENB=0, PON=0, DK=1, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1858 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1859 | (0x1B), 1, 0x10, // GASENB=0, PON=1, DK=0, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1860 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1861 | (0x43), 1, 0x80, //set VCOMG=1 |
davidprentice | 0:b608c7f02f80 | 1862 | TFTLCD_DELAY8, 100, |
davidprentice | 0:b608c7f02f80 | 1863 | // Display ON Setting |
davidprentice | 0:b608c7f02f80 | 1864 | (0x90), 1, 0x7F, // SAP=0111 1111 |
davidprentice | 0:b608c7f02f80 | 1865 | (0x26), 1, 0x04, //GON=0, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1866 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1867 | (0x26), 1, 0x24, //GON=1, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1868 | (0x26), 1, 0x2C, //GON=1, DTE=0, D=11 |
davidprentice | 0:b608c7f02f80 | 1869 | TFTLCD_DELAY8, 40, |
davidprentice | 0:b608c7f02f80 | 1870 | (0x26), 1, 0x3C, //GON=1, DTE=1, D=11 |
davidprentice | 0:b608c7f02f80 | 1871 | // INTERNAL REGISTER SETTING |
davidprentice | 0:b608c7f02f80 | 1872 | (0x57), 1, 0x02, // TEST_Mode=1: into TEST mode |
davidprentice | 0:b608c7f02f80 | 1873 | (0x55), 1, 0x00, // VDC_SEL=000, VDDD=1.95V |
davidprentice | 0:b608c7f02f80 | 1874 | (0xFE), 1, 0x5A, // For ESD protection |
davidprentice | 0:b608c7f02f80 | 1875 | (0x57), 1, 0x00, // TEST_Mode=0: exit TEST mode |
davidprentice | 0:b608c7f02f80 | 1876 | }; |
davidprentice | 0:b608c7f02f80 | 1877 | static const uint8_t HX8347A_ITDB02_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1878 | // VENDOR Gamma ITDB02 same as CMO32. Delays are shorter than AN01 |
davidprentice | 0:b608c7f02f80 | 1879 | (0x46), 12, 0xA4, 0x53, 0x00, 0x44, 0x04, 0x67, 0x33, 0x77, 0x12, 0x4C, 0x46, 0x44, |
davidprentice | 0:b608c7f02f80 | 1880 | // Display Setting |
davidprentice | 0:b608c7f02f80 | 1881 | (0x01), 1, 0x06, // IDMON=0, INVON=1, NORON=1, PTLON=0 |
davidprentice | 0:b608c7f02f80 | 1882 | (0x16), 1, 0xC8, // MY=0, MX=0, MV=0, ML=1, BGR=0, TEON=0 .itead |
davidprentice | 0:b608c7f02f80 | 1883 | (0x23), 3, 0x95, 0x95, 0xFF, // N_DC=1001 0101, PI_DC=1001 0101, I_DC=1111 1111 |
davidprentice | 0:b608c7f02f80 | 1884 | |
davidprentice | 0:b608c7f02f80 | 1885 | (0x27), 4, 0x02, 0x02, 0x02, 0x02, // N_BP=2, N_FP=2, PI_BP=2, PI_FP=2 |
davidprentice | 0:b608c7f02f80 | 1886 | (0x2C), 2, 0x02, 0x02, // I_BP=2, I_FP=2 |
davidprentice | 0:b608c7f02f80 | 1887 | |
davidprentice | 0:b608c7f02f80 | 1888 | (0x3a), 4, 0x01, 0x00, 0xF0, 0x00, // N_RTN=0, N_NW=1, P_RTN=0, ?? P_NW=1, I_RTN=15, I_NW=0, DIV=0 .itead |
davidprentice | 0:b608c7f02f80 | 1889 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1890 | (0x35), 2, 0x38, 0x78, // EQS=38h, EQP=78h |
davidprentice | 0:b608c7f02f80 | 1891 | (0x3E), 1, 0x38, // SON=38h |
davidprentice | 0:b608c7f02f80 | 1892 | (0x40), 2, 0x0F, 0xF0, // GDON=0Fh, GDOFF |
davidprentice | 0:b608c7f02f80 | 1893 | // Power Supply Setting |
davidprentice | 0:b608c7f02f80 | 1894 | (0x19), 1, 0x49, // CADJ=0100, CUADJ=100, OSD_EN=1 ,60Hz |
davidprentice | 0:b608c7f02f80 | 1895 | (0x93), 1, 0x0F, // RADJ=1111, 100% |
davidprentice | 0:b608c7f02f80 | 1896 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1897 | (0x20), 1, 0x40, // BT=0100 |
davidprentice | 0:b608c7f02f80 | 1898 | (0x1D), 3, 0x07, 0x00, 0x04, // VC1=7, VC3=0, VRH=?? |
davidprentice | 0:b608c7f02f80 | 1899 | //VCOM SETTING for ITDB02 |
davidprentice | 0:b608c7f02f80 | 1900 | (0x44), 2, 0x4D, 0x0E, // VCM=101 0000 4D, VDV=1 0001 .itead |
davidprentice | 0:b608c7f02f80 | 1901 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1902 | (0x1C), 1, 0x04, // AP=100 |
davidprentice | 0:b608c7f02f80 | 1903 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1904 | (0x1B), 1, 0x18, // GASENB=0, PON=0, DK=1, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1905 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1906 | (0x1B), 1, 0x10, // GASENB=0, PON=1, DK=0, XDK=0, VLCD_TRI=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 1907 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1908 | (0x43), 1, 0x80, //set VCOMG=1 |
davidprentice | 0:b608c7f02f80 | 1909 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1910 | // Display ON Setting |
davidprentice | 0:b608c7f02f80 | 1911 | (0x90), 1, 0x7F, // SAP=0111 1111 |
davidprentice | 0:b608c7f02f80 | 1912 | (0x26), 1, 0x04, //GON=0, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1913 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1914 | (0x26), 1, 0x24, //GON=1, DTE=0, D=01 |
davidprentice | 0:b608c7f02f80 | 1915 | (0x26), 1, 0x2C, //GON=1, DTE=0, D=11 |
davidprentice | 0:b608c7f02f80 | 1916 | TFTLCD_DELAY8, 5, |
davidprentice | 0:b608c7f02f80 | 1917 | (0x26), 1, 0x3C, //GON=1, DTE=1, D=11 |
davidprentice | 0:b608c7f02f80 | 1918 | // INTERNAL REGISTER SETTING for ITDB02 |
davidprentice | 0:b608c7f02f80 | 1919 | (0x57), 1, 0x02, // TEST_Mode=1: into TEST mode |
davidprentice | 0:b608c7f02f80 | 1920 | (0x95), 1, 0x01, // SET DISPLAY CLOCK AND PUMPING CLOCK TO SYNCHRONIZE .itead |
davidprentice | 0:b608c7f02f80 | 1921 | (0x57), 1, 0x00, // TEST_Mode=0: exit TEST mode |
davidprentice | 0:b608c7f02f80 | 1922 | }; |
davidprentice | 0:b608c7f02f80 | 1923 | static const uint8_t HX8347A_NHD_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1924 | //Gamma Setting NHD |
davidprentice | 0:b608c7f02f80 | 1925 | (0x46), 12, 0x94, 0x41, 0x00, 0x33, 0x23, 0x45, 0x44, 0x77, 0x12, 0xCC, 0x46, 0x82, |
davidprentice | 0:b608c7f02f80 | 1926 | (0x01), 1, 0x06, //Display Mode [06] |
davidprentice | 0:b608c7f02f80 | 1927 | (0x16), 1, 0xC8, //MADCTL [00] MY=1, MX=1, BGR=1 |
davidprentice | 0:b608c7f02f80 | 1928 | // (0x70), 1, 0x05, //Panel [06] 16-bit |
davidprentice | 0:b608c7f02f80 | 1929 | (0x23), 3, 0x95, 0x95, 0xFF, //Cycle Control 1-3 [95 95 FF] |
davidprentice | 0:b608c7f02f80 | 1930 | (0x27), 4, 0x02, 0x02, 0x02, 0x02, //Display Control 2-5 [02 02 02 02] |
davidprentice | 0:b608c7f02f80 | 1931 | (0x2C), 2, 0x02, 0x02, //Display Control 6-7 [02 02] |
davidprentice | 0:b608c7f02f80 | 1932 | (0x3A), 4, 0x01, 0x01, 0xF0, 0x00, //Cycle Control 1-4 [01 01 F0 00] |
davidprentice | 0:b608c7f02f80 | 1933 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1934 | (0x35), 2, 0x38, 0x78, //Display Control 9-10 [09 09] EQS=56, EQP=120 |
davidprentice | 0:b608c7f02f80 | 1935 | (0x3E), 1, 0x38, //Cycle Control 5 [38] |
davidprentice | 0:b608c7f02f80 | 1936 | (0x40), 1, 0x0F, //Cycle Control 6 [03] GDON=15 |
davidprentice | 0:b608c7f02f80 | 1937 | (0x41), 1, 0xF0, //Cycle Control 14 [F8] GDOF=248 |
davidprentice | 0:b608c7f02f80 | 1938 | |
davidprentice | 0:b608c7f02f80 | 1939 | (0x19), 1, 0x2D, //OSC Control 1 [86] CADJ=2, CUADJ=6, OSCEN=1 |
davidprentice | 0:b608c7f02f80 | 1940 | (0x93), 1, 0x06, //SAP Idle mode [00] ??? .nhd |
davidprentice | 0:b608c7f02f80 | 1941 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1942 | (0x20), 1, 0x40, //Power Control 6 [40] |
davidprentice | 0:b608c7f02f80 | 1943 | (0x1D), 3, 0x07, 0x00, 0x04, //Power Control 3-5 [04 00 06] VC=7 |
davidprentice | 0:b608c7f02f80 | 1944 | (0x44), 2, 0x3C, 0x12, //VCOM Control 2-3 [5A 11] VCM=60, VDV=18 |
davidprentice | 0:b608c7f02f80 | 1945 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1946 | (0x1C), 1, 0x04, //Power Control 2 [04] |
davidprentice | 0:b608c7f02f80 | 1947 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1948 | (0x43), 1, 0x80, //VCOM Control 1 [80] |
davidprentice | 0:b608c7f02f80 | 1949 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1950 | (0x1B), 1, 0x08, //Power Control 1 [00] DK=1 |
davidprentice | 0:b608c7f02f80 | 1951 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1952 | (0x1B), 1, 0x10, //Power Control 1 [00] PON=1 |
davidprentice | 0:b608c7f02f80 | 1953 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1954 | (0x90), 1, 0x7F, //Display Control 8 [0A] |
davidprentice | 0:b608c7f02f80 | 1955 | (0x26), 1, 0x04, //Display Control 1 [A0] D=1 |
davidprentice | 0:b608c7f02f80 | 1956 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1957 | (0x26), 1, 0x24, //Display Control 1 [A0] GON=1, D=1 |
davidprentice | 0:b608c7f02f80 | 1958 | (0x26), 1, 0x2C, //Display Control 1 [A0] GON=1, D=3 |
davidprentice | 0:b608c7f02f80 | 1959 | TFTLCD_DELAY8, 80, |
davidprentice | 0:b608c7f02f80 | 1960 | (0x26), 1, 0x3C, //Display Control 1 [A0] GON=1, DTE=1, D=3 |
davidprentice | 0:b608c7f02f80 | 1961 | (0x57), 1, 0x02, //? |
davidprentice | 0:b608c7f02f80 | 1962 | (0x55), 1, 0x00, //? |
davidprentice | 0:b608c7f02f80 | 1963 | (0x57), 1, 0x00, //? |
davidprentice | 0:b608c7f02f80 | 1964 | }; |
davidprentice | 0:b608c7f02f80 | 1965 | // Atmel ASF code uses VCOM2-3: 0x38, 0x12. 50ms delays and no TEST mode changes. |
davidprentice | 0:b608c7f02f80 | 1966 | init_table(HX8347A_NHD_regValues, sizeof(HX8347A_NHD_regValues)); |
davidprentice | 0:b608c7f02f80 | 1967 | // init_table(HX8347A_CMO32_regValues, sizeof(HX8347A_CMO32_regValues)); |
davidprentice | 0:b608c7f02f80 | 1968 | // init_table(HX8347A_CMO24_regValues, sizeof(HX8347A_CMO24_regValues)); |
davidprentice | 0:b608c7f02f80 | 1969 | // init_table(HX8347A_ITDB02_regValues, sizeof(HX8347A_ITDB02_regValues)); |
davidprentice | 0:b608c7f02f80 | 1970 | // init_table(HX8347G_2_regValues, sizeof(HX8347G_2_regValues)); |
davidprentice | 0:b608c7f02f80 | 1971 | break; |
davidprentice | 0:b608c7f02f80 | 1972 | #endif |
davidprentice | 0:b608c7f02f80 | 1973 | |
davidprentice | 0:b608c7f02f80 | 1974 | case 0x8357: //BIG CHANGE: HX8357-B is now 0x8357 |
davidprentice | 0:b608c7f02f80 | 1975 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 1976 | goto common_8357; |
davidprentice | 0:b608c7f02f80 | 1977 | case 0x9090: //BIG CHANGE: HX8357-D was 0x8357 |
davidprentice | 0:b608c7f02f80 | 1978 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1979 | common_8357: |
davidprentice | 0:b608c7f02f80 | 1980 | static const uint8_t HX8357C_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1981 | TFTLCD_DELAY8, 1, //dummy table |
davidprentice | 0:b608c7f02f80 | 1982 | }; |
davidprentice | 0:b608c7f02f80 | 1983 | table8_ads = HX8357C_regValues, table_size = sizeof(HX8357C_regValues); |
davidprentice | 0:b608c7f02f80 | 1984 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 1985 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 1986 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 1987 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 1988 | break; |
davidprentice | 0:b608c7f02f80 | 1989 | |
davidprentice | 0:b608c7f02f80 | 1990 | case 0x0099: //HX8357-D matches datasheet |
davidprentice | 0:b608c7f02f80 | 1991 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 1992 | static const uint8_t HX8357_99_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 1993 | (0xB9), 3, 0xFF, 0x83, 0x57, // SETEXTC |
davidprentice | 0:b608c7f02f80 | 1994 | TFTLCD_DELAY8, 150, |
davidprentice | 0:b608c7f02f80 | 1995 | TFTLCD_DELAY8, 150, |
davidprentice | 0:b608c7f02f80 | 1996 | (0xB6), 1, 0x25, // SETCOM [4B 00] -2.5V+37*0.02V=-1.76V [-1.00V] |
davidprentice | 0:b608c7f02f80 | 1997 | (0xC0), 6, 0x50, 0x50, 0x01, 0x3C, 0x1E, 0x08, // SETSTBA [73 50 00 3C C4 08] |
davidprentice | 0:b608c7f02f80 | 1998 | (0xB4), 7, 0x02, 0x40, 0x00, 0x2A, 0x2A, 0x0D, 0x78, // SETCYC [02 40 00 2A 2A 0D 96] |
davidprentice | 0:b608c7f02f80 | 1999 | #ifdef SUPPORT_8357D_GAMMA |
davidprentice | 0:b608c7f02f80 | 2000 | // HX8357D_SETGAMMA [0B 0C 11 1D 25 37 43 4B 4E 47 41 39 35 31 2E 21 1C 1D 1D 26 31 44 4E 56 44 3F 39 33 31 2E 28 1D E0 01] |
davidprentice | 0:b608c7f02f80 | 2001 | (0xE0),34, 0x02, 0x0A, 0x11, 0x1D, 0x23, 0x35, 0x41, 0x4B, 0x4B, 0x42, 0x3A, 0x27, 0x1B, 0x08, 0x09, 0x03, 0x02, 0x0A, 0x11, 0x1D, 0x23, 0x35, 0x41, 0x4B, 0x4B, 0x42, 0x3A, 0x27, 0x1B, 0x08, 0x09, 0x03, 0x00, 0x01, |
davidprentice | 0:b608c7f02f80 | 2002 | #endif |
davidprentice | 0:b608c7f02f80 | 2003 | }; |
davidprentice | 0:b608c7f02f80 | 2004 | table8_ads = HX8357_99_regValues, table_size = sizeof(HX8357_99_regValues); |
davidprentice | 0:b608c7f02f80 | 2005 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2006 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 2007 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2008 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 2009 | break; |
davidprentice | 0:b608c7f02f80 | 2010 | |
davidprentice | 0:b608c7f02f80 | 2011 | #ifdef SUPPORT_8230 |
davidprentice | 0:b608c7f02f80 | 2012 | case 0x8230: //thanks Auzman |
davidprentice | 0:b608c7f02f80 | 2013 | _lcd_capable = 0 | REV_SCREEN | INVERT_GS | INVERT_RGB | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 2014 | static const uint16_t UC8230_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2015 | //After pin Reset wait at least 100ms |
davidprentice | 0:b608c7f02f80 | 2016 | TFTLCD_DELAY, 100, //at least 100ms |
davidprentice | 0:b608c7f02f80 | 2017 | 0x0046, 0x0002, //MTP Disable |
davidprentice | 0:b608c7f02f80 | 2018 | 0x0010, 0x1590, //SAP=1, BT=5, APE=1, AP=1 |
davidprentice | 0:b608c7f02f80 | 2019 | 0x0011, 0x0227, //DC1=2, DC0=2, VC=7 |
davidprentice | 0:b608c7f02f80 | 2020 | 0x0012, 0x80ff, //P5VMD=1, PON=7, VRH=15 |
davidprentice | 0:b608c7f02f80 | 2021 | 0x0013, 0x9c31, //VDV=28, VCM=49 |
davidprentice | 0:b608c7f02f80 | 2022 | TFTLCD_DELAY, 10, //at least 10ms |
davidprentice | 0:b608c7f02f80 | 2023 | 0x0002, 0x0300, //set N-line = 1 |
davidprentice | 0:b608c7f02f80 | 2024 | 0x0003, 0x1030, //set GRAM writing direction & BGR=1 |
davidprentice | 0:b608c7f02f80 | 2025 | 0x0060, 0xa700, //GS; gate scan: start position & drive line Q'ty |
davidprentice | 0:b608c7f02f80 | 2026 | 0x0061, 0x0001, //REV, NDL, VLE |
davidprentice | 0:b608c7f02f80 | 2027 | /*--------------------Gamma control------------------------*/ |
davidprentice | 0:b608c7f02f80 | 2028 | 0x0030, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2029 | 0x0031, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2030 | 0x0032, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2031 | 0x0033, 0x0300, |
davidprentice | 0:b608c7f02f80 | 2032 | 0x0034, 0x0003, |
davidprentice | 0:b608c7f02f80 | 2033 | 0x0035, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2034 | 0x0036, 0x1400, |
davidprentice | 0:b608c7f02f80 | 2035 | 0x0037, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2036 | 0x0038, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2037 | 0x0039, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2038 | 0x003a, 0x0300, |
davidprentice | 0:b608c7f02f80 | 2039 | 0x003b, 0x0003, |
davidprentice | 0:b608c7f02f80 | 2040 | 0x003c, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2041 | 0x003d, 0x1400, |
davidprentice | 0:b608c7f02f80 | 2042 | //-----------------------------------------------------------// |
davidprentice | 0:b608c7f02f80 | 2043 | 0x0020, 0x0000, //GRAM horizontal address |
davidprentice | 0:b608c7f02f80 | 2044 | 0x0021, 0x0000, //GRAM vertical address |
davidprentice | 0:b608c7f02f80 | 2045 | //************** Partial Display control*********************// |
davidprentice | 0:b608c7f02f80 | 2046 | 0x0080, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2047 | 0x0081, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2048 | 0x0082, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2049 | 0x0083, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2050 | 0x0084, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2051 | 0x0085, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2052 | //-----------------------------------------------------------// |
davidprentice | 0:b608c7f02f80 | 2053 | 0x0092, 0x0200, |
davidprentice | 0:b608c7f02f80 | 2054 | 0x0093, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2055 | 0x0090, 0x0010, //set clocks/Line |
davidprentice | 0:b608c7f02f80 | 2056 | 0x0000, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2057 | TFTLCD_DELAY, 200, // Delay 200 ms |
davidprentice | 0:b608c7f02f80 | 2058 | 0x0007, 0x0173, //Display on setting |
davidprentice | 0:b608c7f02f80 | 2059 | }; |
davidprentice | 0:b608c7f02f80 | 2060 | init_table16(UC8230_regValues, sizeof(UC8230_regValues)); |
davidprentice | 0:b608c7f02f80 | 2061 | break; |
davidprentice | 0:b608c7f02f80 | 2062 | #endif |
davidprentice | 0:b608c7f02f80 | 2063 | |
davidprentice | 0:b608c7f02f80 | 2064 | #ifdef SUPPORT_9163 |
davidprentice | 0:b608c7f02f80 | 2065 | case 0x9163: // |
davidprentice | 0:b608c7f02f80 | 2066 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2067 | static const uint8_t PROGMEM table9163C[] = { |
davidprentice | 0:b608c7f02f80 | 2068 | // (COMMAND_BYTE), n, data_bytes.... |
davidprentice | 0:b608c7f02f80 | 2069 | 0x26, 1, 0x02, // [01] GAMMASET use CURVE=1, 2, 4, 8 |
davidprentice | 0:b608c7f02f80 | 2070 | 0xB1, 2, 0x08, 0x02, // [0E 14] FRMCTR1 if GM==011 61.7Hz |
davidprentice | 0:b608c7f02f80 | 2071 | 0xB4, 1, 0x07, // [02] INVCTR |
davidprentice | 0:b608c7f02f80 | 2072 | 0xB8, 1, 0x01, // [00] GSCTRL |
davidprentice | 0:b608c7f02f80 | 2073 | 0xC0, 2, 0x0A, 0x02, // [0A 05] PWCTR1 if LCM==10 |
davidprentice | 0:b608c7f02f80 | 2074 | 0xC1, 1, 0x02, // [07] PWCTR2 |
davidprentice | 0:b608c7f02f80 | 2075 | 0xC5, 2, 0x50, 0x63, // [43 4D] VMCTR1 |
davidprentice | 0:b608c7f02f80 | 2076 | 0xC7, 1, 0, // [40] VCOMOFFS |
davidprentice | 0:b608c7f02f80 | 2077 | }; |
davidprentice | 0:b608c7f02f80 | 2078 | table8_ads = table9163C, table_size = sizeof(table9163C); // |
davidprentice | 0:b608c7f02f80 | 2079 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2080 | *p16 = 160; |
davidprentice | 0:b608c7f02f80 | 2081 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2082 | *p16 = 128; |
davidprentice | 0:b608c7f02f80 | 2083 | break; |
davidprentice | 0:b608c7f02f80 | 2084 | #endif |
davidprentice | 0:b608c7f02f80 | 2085 | |
davidprentice | 0:b608c7f02f80 | 2086 | #ifdef SUPPORT_9225 |
davidprentice | 0:b608c7f02f80 | 2087 | #define ILI9225_DRIVER_OUTPUT_CTRL (0x01u) // Driver Output Control |
davidprentice | 0:b608c7f02f80 | 2088 | #define ILI9225_LCD_AC_DRIVING_CTRL (0x02u) // LCD AC Driving Control |
davidprentice | 0:b608c7f02f80 | 2089 | #define ILI9225_ENTRY_MODE (0x03u) // Entry Mode |
davidprentice | 0:b608c7f02f80 | 2090 | #define ILI9225_DISP_CTRL1 (0x07u) // Display Control 1 |
davidprentice | 0:b608c7f02f80 | 2091 | #define ILI9225_BLANK_PERIOD_CTRL1 (0x08u) // Blank Period Control |
davidprentice | 0:b608c7f02f80 | 2092 | #define ILI9225_FRAME_CYCLE_CTRL (0x0Bu) // Frame Cycle Control |
davidprentice | 0:b608c7f02f80 | 2093 | #define ILI9225_INTERFACE_CTRL (0x0Cu) // Interface Control |
davidprentice | 0:b608c7f02f80 | 2094 | #define ILI9225_OSC_CTRL (0x0Fu) // Osc Control |
davidprentice | 0:b608c7f02f80 | 2095 | #define ILI9225_POWER_CTRL1 (0x10u) // Power Control 1 |
davidprentice | 0:b608c7f02f80 | 2096 | #define ILI9225_POWER_CTRL2 (0x11u) // Power Control 2 |
davidprentice | 0:b608c7f02f80 | 2097 | #define ILI9225_POWER_CTRL3 (0x12u) // Power Control 3 |
davidprentice | 0:b608c7f02f80 | 2098 | #define ILI9225_POWER_CTRL4 (0x13u) // Power Control 4 |
davidprentice | 0:b608c7f02f80 | 2099 | #define ILI9225_POWER_CTRL5 (0x14u) // Power Control 5 |
davidprentice | 0:b608c7f02f80 | 2100 | #define ILI9225_VCI_RECYCLING (0x15u) // VCI Recycling |
davidprentice | 0:b608c7f02f80 | 2101 | #define ILI9225_RAM_ADDR_SET1 (0x20u) // Horizontal GRAM Address Set |
davidprentice | 0:b608c7f02f80 | 2102 | #define ILI9225_RAM_ADDR_SET2 (0x21u) // Vertical GRAM Address Set |
davidprentice | 0:b608c7f02f80 | 2103 | #define ILI9225_GRAM_DATA_REG (0x22u) // GRAM Data Register |
davidprentice | 0:b608c7f02f80 | 2104 | #define ILI9225_GATE_SCAN_CTRL (0x30u) // Gate Scan Control Register |
davidprentice | 0:b608c7f02f80 | 2105 | #define ILI9225_VERTICAL_SCROLL_CTRL1 (0x31u) // Vertical Scroll Control 1 Register |
davidprentice | 0:b608c7f02f80 | 2106 | #define ILI9225_VERTICAL_SCROLL_CTRL2 (0x32u) // Vertical Scroll Control 2 Register |
davidprentice | 0:b608c7f02f80 | 2107 | #define ILI9225_VERTICAL_SCROLL_CTRL3 (0x33u) // Vertical Scroll Control 3 Register |
davidprentice | 0:b608c7f02f80 | 2108 | #define ILI9225_PARTIAL_DRIVING_POS1 (0x34u) // Partial Driving Position 1 Register |
davidprentice | 0:b608c7f02f80 | 2109 | #define ILI9225_PARTIAL_DRIVING_POS2 (0x35u) // Partial Driving Position 2 Register |
davidprentice | 0:b608c7f02f80 | 2110 | #define ILI9225_HORIZONTAL_WINDOW_ADDR1 (0x36u) // Horizontal Address END Position HEA |
davidprentice | 0:b608c7f02f80 | 2111 | #define ILI9225_HORIZONTAL_WINDOW_ADDR2 (0x37u) // Horizontal Address START Position HSA |
davidprentice | 0:b608c7f02f80 | 2112 | #define ILI9225_VERTICAL_WINDOW_ADDR1 (0x38u) // Vertical Address END Position VEA |
davidprentice | 0:b608c7f02f80 | 2113 | #define ILI9225_VERTICAL_WINDOW_ADDR2 (0x39u) // Vertical Address START Position VSA |
davidprentice | 0:b608c7f02f80 | 2114 | #define ILI9225_GAMMA_CTRL1 (0x50u) // Gamma Control 1 |
davidprentice | 0:b608c7f02f80 | 2115 | #define ILI9225_GAMMA_CTRL2 (0x51u) // Gamma Control 2 |
davidprentice | 0:b608c7f02f80 | 2116 | #define ILI9225_GAMMA_CTRL3 (0x52u) // Gamma Control 3 |
davidprentice | 0:b608c7f02f80 | 2117 | #define ILI9225_GAMMA_CTRL4 (0x53u) // Gamma Control 4 |
davidprentice | 0:b608c7f02f80 | 2118 | #define ILI9225_GAMMA_CTRL5 (0x54u) // Gamma Control 5 |
davidprentice | 0:b608c7f02f80 | 2119 | #define ILI9225_GAMMA_CTRL6 (0x55u) // Gamma Control 6 |
davidprentice | 0:b608c7f02f80 | 2120 | #define ILI9225_GAMMA_CTRL7 (0x56u) // Gamma Control 7 |
davidprentice | 0:b608c7f02f80 | 2121 | #define ILI9225_GAMMA_CTRL8 (0x57u) // Gamma Control 8 |
davidprentice | 0:b608c7f02f80 | 2122 | #define ILI9225_GAMMA_CTRL9 (0x58u) // Gamma Control 9 |
davidprentice | 0:b608c7f02f80 | 2123 | #define ILI9225_GAMMA_CTRL10 (0x59u) // Gamma Control 10 |
davidprentice | 0:b608c7f02f80 | 2124 | |
davidprentice | 0:b608c7f02f80 | 2125 | #define ILI9225C_INVOFF 0x20 |
davidprentice | 0:b608c7f02f80 | 2126 | #define ILI9225C_INVON 0x21 |
davidprentice | 0:b608c7f02f80 | 2127 | |
davidprentice | 0:b608c7f02f80 | 2128 | case 0x6813: |
davidprentice | 0:b608c7f02f80 | 2129 | case 0x9226: |
davidprentice | 0:b608c7f02f80 | 2130 | _lcd_ID = 0x9225; //fall through |
davidprentice | 0:b608c7f02f80 | 2131 | case 0x9225: |
davidprentice | 0:b608c7f02f80 | 2132 | _lcd_capable = REV_SCREEN | READ_BGR; //thanks tongbajiel |
davidprentice | 0:b608c7f02f80 | 2133 | static const uint16_t ILI9225_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2134 | /* Start Initial Sequence */ |
davidprentice | 0:b608c7f02f80 | 2135 | /* Set SS bit and direction output from S528 to S1 */ |
davidprentice | 0:b608c7f02f80 | 2136 | ILI9225_POWER_CTRL1, 0x0000, // Set SAP,DSTB,STB |
davidprentice | 0:b608c7f02f80 | 2137 | ILI9225_POWER_CTRL2, 0x0000, // Set APON,PON,AON,VCI1EN,VC |
davidprentice | 0:b608c7f02f80 | 2138 | ILI9225_POWER_CTRL3, 0x0000, // Set BT,DC1,DC2,DC3 |
davidprentice | 0:b608c7f02f80 | 2139 | ILI9225_POWER_CTRL4, 0x0000, // Set GVDD |
davidprentice | 0:b608c7f02f80 | 2140 | ILI9225_POWER_CTRL5, 0x0000, // Set VCOMH/VCOML voltage |
davidprentice | 0:b608c7f02f80 | 2141 | TFTLCD_DELAY, 40, |
davidprentice | 0:b608c7f02f80 | 2142 | |
davidprentice | 0:b608c7f02f80 | 2143 | // Power-on sequence |
davidprentice | 0:b608c7f02f80 | 2144 | ILI9225_POWER_CTRL2, 0x0018, // Set APON,PON,AON,VCI1EN,VC |
davidprentice | 0:b608c7f02f80 | 2145 | ILI9225_POWER_CTRL3, 0x6121, // Set BT,DC1,DC2,DC3 |
davidprentice | 0:b608c7f02f80 | 2146 | ILI9225_POWER_CTRL4, 0x006F, // Set GVDD /*007F 0088 */ |
davidprentice | 0:b608c7f02f80 | 2147 | ILI9225_POWER_CTRL5, 0x495F, // Set VCOMH/VCOML voltage |
davidprentice | 0:b608c7f02f80 | 2148 | ILI9225_POWER_CTRL1, 0x0800, // Set SAP,DSTB,STB |
davidprentice | 0:b608c7f02f80 | 2149 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 2150 | ILI9225_POWER_CTRL2, 0x103B, // Set APON,PON,AON,VCI1EN,VC |
davidprentice | 0:b608c7f02f80 | 2151 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2152 | |
davidprentice | 0:b608c7f02f80 | 2153 | ILI9225_DRIVER_OUTPUT_CTRL, 0x011C, // set the display line number and display direction |
davidprentice | 0:b608c7f02f80 | 2154 | ILI9225_LCD_AC_DRIVING_CTRL, 0x0100, // set 1 line inversion |
davidprentice | 0:b608c7f02f80 | 2155 | ILI9225_ENTRY_MODE, 0x1030, // set GRAM write direction and BGR=1. |
davidprentice | 0:b608c7f02f80 | 2156 | ILI9225_DISP_CTRL1, 0x0000, // Display off |
davidprentice | 0:b608c7f02f80 | 2157 | ILI9225_BLANK_PERIOD_CTRL1, 0x0808, // set the back porch and front porch |
davidprentice | 0:b608c7f02f80 | 2158 | ILI9225_FRAME_CYCLE_CTRL, 0x1100, // set the clocks number per line |
davidprentice | 0:b608c7f02f80 | 2159 | ILI9225_INTERFACE_CTRL, 0x0000, // CPU interface |
davidprentice | 0:b608c7f02f80 | 2160 | ILI9225_OSC_CTRL, 0x0D01, // Set Osc /*0e01*/ |
davidprentice | 0:b608c7f02f80 | 2161 | ILI9225_VCI_RECYCLING, 0x0020, // Set VCI recycling |
davidprentice | 0:b608c7f02f80 | 2162 | ILI9225_RAM_ADDR_SET1, 0x0000, // RAM Address |
davidprentice | 0:b608c7f02f80 | 2163 | ILI9225_RAM_ADDR_SET2, 0x0000, // RAM Address |
davidprentice | 0:b608c7f02f80 | 2164 | |
davidprentice | 0:b608c7f02f80 | 2165 | /* Set GRAM area */ |
davidprentice | 0:b608c7f02f80 | 2166 | ILI9225_GATE_SCAN_CTRL, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2167 | ILI9225_VERTICAL_SCROLL_CTRL1, 0x00DB, |
davidprentice | 0:b608c7f02f80 | 2168 | ILI9225_VERTICAL_SCROLL_CTRL2, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2169 | ILI9225_VERTICAL_SCROLL_CTRL3, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2170 | ILI9225_PARTIAL_DRIVING_POS1, 0x00DB, |
davidprentice | 0:b608c7f02f80 | 2171 | ILI9225_PARTIAL_DRIVING_POS2, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2172 | ILI9225_HORIZONTAL_WINDOW_ADDR1, 0x00AF, |
davidprentice | 0:b608c7f02f80 | 2173 | ILI9225_HORIZONTAL_WINDOW_ADDR2, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2174 | ILI9225_VERTICAL_WINDOW_ADDR1, 0x00DB, |
davidprentice | 0:b608c7f02f80 | 2175 | ILI9225_VERTICAL_WINDOW_ADDR2, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2176 | |
davidprentice | 0:b608c7f02f80 | 2177 | /* Set GAMMA curve */ |
davidprentice | 0:b608c7f02f80 | 2178 | ILI9225_GAMMA_CTRL1, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2179 | ILI9225_GAMMA_CTRL2, 0x0808, |
davidprentice | 0:b608c7f02f80 | 2180 | ILI9225_GAMMA_CTRL3, 0x080A, |
davidprentice | 0:b608c7f02f80 | 2181 | ILI9225_GAMMA_CTRL4, 0x000A, |
davidprentice | 0:b608c7f02f80 | 2182 | ILI9225_GAMMA_CTRL5, 0x0A08, |
davidprentice | 0:b608c7f02f80 | 2183 | ILI9225_GAMMA_CTRL6, 0x0808, |
davidprentice | 0:b608c7f02f80 | 2184 | ILI9225_GAMMA_CTRL7, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2185 | ILI9225_GAMMA_CTRL8, 0x0A00, |
davidprentice | 0:b608c7f02f80 | 2186 | ILI9225_GAMMA_CTRL9, 0x0710, |
davidprentice | 0:b608c7f02f80 | 2187 | ILI9225_GAMMA_CTRL10, 0x0710, |
davidprentice | 0:b608c7f02f80 | 2188 | |
davidprentice | 0:b608c7f02f80 | 2189 | ILI9225_DISP_CTRL1, 0x0012, |
davidprentice | 0:b608c7f02f80 | 2190 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2191 | ILI9225_DISP_CTRL1, 0x1017, |
davidprentice | 0:b608c7f02f80 | 2192 | }; |
davidprentice | 0:b608c7f02f80 | 2193 | init_table16(ILI9225_regValues, sizeof(ILI9225_regValues)); |
davidprentice | 0:b608c7f02f80 | 2194 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2195 | *p16 = 220; |
davidprentice | 0:b608c7f02f80 | 2196 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2197 | *p16 = 176; |
davidprentice | 0:b608c7f02f80 | 2198 | break; |
davidprentice | 0:b608c7f02f80 | 2199 | #endif |
davidprentice | 0:b608c7f02f80 | 2200 | |
davidprentice | 0:b608c7f02f80 | 2201 | case 0x0001: |
davidprentice | 0:b608c7f02f80 | 2202 | _lcd_capable = 0 | REV_SCREEN | INVERT_GS; //no RGB bug. thanks Ivo_Deshev |
davidprentice | 0:b608c7f02f80 | 2203 | goto common_9320; |
davidprentice | 0:b608c7f02f80 | 2204 | case 0x5408: |
davidprentice | 0:b608c7f02f80 | 2205 | _lcd_capable = 0 | REV_SCREEN | READ_BGR; //Red 2.4" thanks jorgenv, Ardlab_Gent |
davidprentice | 0:b608c7f02f80 | 2206 | // _lcd_capable = 0 | REV_SCREEN | READ_BGR | INVERT_GS; //Blue 2.8" might be different |
davidprentice | 0:b608c7f02f80 | 2207 | goto common_9320; |
davidprentice | 0:b608c7f02f80 | 2208 | case 0x1505: //R61505 thanks Ravi_kanchan2004. R61505V, R61505W different |
davidprentice | 0:b608c7f02f80 | 2209 | case 0x9320: |
davidprentice | 0:b608c7f02f80 | 2210 | _lcd_capable = 0 | REV_SCREEN | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 2211 | common_9320: |
davidprentice | 0:b608c7f02f80 | 2212 | static const uint16_t ILI9320_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2213 | 0x00e5, 0x8000, |
davidprentice | 0:b608c7f02f80 | 2214 | 0x0000, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2215 | 0x0001, 0x100, |
davidprentice | 0:b608c7f02f80 | 2216 | 0x0002, 0x0700, |
davidprentice | 0:b608c7f02f80 | 2217 | 0x0003, 0x1030, |
davidprentice | 0:b608c7f02f80 | 2218 | 0x0004, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2219 | 0x0008, 0x0202, |
davidprentice | 0:b608c7f02f80 | 2220 | 0x0009, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2221 | 0x000A, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2222 | 0x000C, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2223 | 0x000D, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2224 | 0x000F, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2225 | //-----Power On sequence----------------------- |
davidprentice | 0:b608c7f02f80 | 2226 | 0x0010, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2227 | 0x0011, 0x0007, |
davidprentice | 0:b608c7f02f80 | 2228 | 0x0012, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2229 | 0x0013, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2230 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2231 | 0x0010, 0x17B0, //SAP=1, BT=7, APE=1, AP=3 |
davidprentice | 0:b608c7f02f80 | 2232 | 0x0011, 0x0007, //DC1=0, DC0=0, VC=7 |
davidprentice | 0:b608c7f02f80 | 2233 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 2234 | 0x0012, 0x013A, //VCMR=1, PON=3, VRH=10 |
davidprentice | 0:b608c7f02f80 | 2235 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 2236 | 0x0013, 0x1A00, //VDV=26 |
davidprentice | 0:b608c7f02f80 | 2237 | 0x0029, 0x000c, //VCM=12 |
davidprentice | 0:b608c7f02f80 | 2238 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 2239 | //-----Gamma control----------------------- |
davidprentice | 0:b608c7f02f80 | 2240 | 0x0030, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2241 | 0x0031, 0x0505, |
davidprentice | 0:b608c7f02f80 | 2242 | 0x0032, 0x0004, |
davidprentice | 0:b608c7f02f80 | 2243 | 0x0035, 0x0006, |
davidprentice | 0:b608c7f02f80 | 2244 | 0x0036, 0x0707, |
davidprentice | 0:b608c7f02f80 | 2245 | 0x0037, 0x0105, |
davidprentice | 0:b608c7f02f80 | 2246 | 0x0038, 0x0002, |
davidprentice | 0:b608c7f02f80 | 2247 | 0x0039, 0x0707, |
davidprentice | 0:b608c7f02f80 | 2248 | 0x003C, 0x0704, |
davidprentice | 0:b608c7f02f80 | 2249 | 0x003D, 0x0807, |
davidprentice | 0:b608c7f02f80 | 2250 | //-----Set RAM area----------------------- |
davidprentice | 0:b608c7f02f80 | 2251 | 0x0060, 0xA700, //GS=1 |
davidprentice | 0:b608c7f02f80 | 2252 | 0x0061, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2253 | 0x006A, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2254 | 0x0021, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2255 | 0x0020, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2256 | //-----Partial Display Control------------ |
davidprentice | 0:b608c7f02f80 | 2257 | 0x0080, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2258 | 0x0081, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2259 | 0x0082, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2260 | 0x0083, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2261 | 0x0084, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2262 | 0x0085, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2263 | //-----Panel Control---------------------- |
davidprentice | 0:b608c7f02f80 | 2264 | 0x0090, 0x0010, |
davidprentice | 0:b608c7f02f80 | 2265 | 0x0092, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2266 | 0x0093, 0x0003, |
davidprentice | 0:b608c7f02f80 | 2267 | 0x0095, 0x0110, |
davidprentice | 0:b608c7f02f80 | 2268 | 0x0097, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2269 | 0x0098, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2270 | //-----Display on----------------------- |
davidprentice | 0:b608c7f02f80 | 2271 | 0x0007, 0x0173, |
davidprentice | 0:b608c7f02f80 | 2272 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2273 | }; |
davidprentice | 0:b608c7f02f80 | 2274 | init_table16(ILI9320_regValues, sizeof(ILI9320_regValues)); |
davidprentice | 0:b608c7f02f80 | 2275 | break; |
davidprentice | 0:b608c7f02f80 | 2276 | case 0x6809: |
davidprentice | 0:b608c7f02f80 | 2277 | _lcd_capable = 0 | REV_SCREEN | INVERT_GS | AUTO_READINC; |
davidprentice | 0:b608c7f02f80 | 2278 | goto common_93x5; |
davidprentice | 0:b608c7f02f80 | 2279 | case 0x9328: |
davidprentice | 0:b608c7f02f80 | 2280 | case 0x9325: |
davidprentice | 0:b608c7f02f80 | 2281 | _lcd_capable = 0 | REV_SCREEN | INVERT_GS; |
davidprentice | 0:b608c7f02f80 | 2282 | goto common_93x5; |
davidprentice | 0:b608c7f02f80 | 2283 | case 0x9331: |
davidprentice | 0:b608c7f02f80 | 2284 | case 0x9335: |
davidprentice | 0:b608c7f02f80 | 2285 | _lcd_capable = 0 | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 2286 | common_93x5: |
davidprentice | 0:b608c7f02f80 | 2287 | static const uint16_t ILI9325_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2288 | 0x00E5, 0x78F0, // set SRAM internal timing |
davidprentice | 0:b608c7f02f80 | 2289 | 0x0001, 0x0100, // set Driver Output Control |
davidprentice | 0:b608c7f02f80 | 2290 | 0x0002, 0x0200, // set 1 line inversion |
davidprentice | 0:b608c7f02f80 | 2291 | 0x0003, 0x1030, // set GRAM write direction and BGR=1. |
davidprentice | 0:b608c7f02f80 | 2292 | 0x0004, 0x0000, // Resize register |
davidprentice | 0:b608c7f02f80 | 2293 | 0x0005, 0x0000, // .kbv 16bits Data Format Selection |
davidprentice | 0:b608c7f02f80 | 2294 | 0x0008, 0x0207, // set the back porch and front porch |
davidprentice | 0:b608c7f02f80 | 2295 | 0x0009, 0x0000, // set non-display area refresh cycle ISC[3:0] |
davidprentice | 0:b608c7f02f80 | 2296 | 0x000A, 0x0000, // FMARK function |
davidprentice | 0:b608c7f02f80 | 2297 | 0x000C, 0x0000, // RGB interface setting |
davidprentice | 0:b608c7f02f80 | 2298 | 0x000D, 0x0000, // Frame marker Position |
davidprentice | 0:b608c7f02f80 | 2299 | 0x000F, 0x0000, // RGB interface polarity |
davidprentice | 0:b608c7f02f80 | 2300 | // ----------- Power On sequence ----------- // |
davidprentice | 0:b608c7f02f80 | 2301 | 0x0010, 0x0000, // SAP, BT[3:0], AP, DSTB, SLP, STB |
davidprentice | 0:b608c7f02f80 | 2302 | 0x0011, 0x0007, // DC1[2:0], DC0[2:0], VC[2:0] |
davidprentice | 0:b608c7f02f80 | 2303 | 0x0012, 0x0000, // VREG1OUT voltage |
davidprentice | 0:b608c7f02f80 | 2304 | 0x0013, 0x0000, // VDV[4:0] for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 2305 | 0x0007, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2306 | TFTLCD_DELAY, 200, // Dis-charge capacitor power voltage |
davidprentice | 0:b608c7f02f80 | 2307 | 0x0010, 0x1690, // SAP=1, BT=6, APE=1, AP=1, DSTB=0, SLP=0, STB=0 |
davidprentice | 0:b608c7f02f80 | 2308 | 0x0011, 0x0227, // DC1=2, DC0=2, VC=7 |
davidprentice | 0:b608c7f02f80 | 2309 | TFTLCD_DELAY, 50, // wait_ms 50ms |
davidprentice | 0:b608c7f02f80 | 2310 | 0x0012, 0x000D, // VCIRE=1, PON=0, VRH=5 |
davidprentice | 0:b608c7f02f80 | 2311 | TFTLCD_DELAY, 50, // wait_ms 50ms |
davidprentice | 0:b608c7f02f80 | 2312 | 0x0013, 0x1200, // VDV=28 for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 2313 | 0x0029, 0x000A, // VCM=10 for VCOMH |
davidprentice | 0:b608c7f02f80 | 2314 | 0x002B, 0x000D, // Set Frame Rate |
davidprentice | 0:b608c7f02f80 | 2315 | TFTLCD_DELAY, 50, // wait_ms 50ms |
davidprentice | 0:b608c7f02f80 | 2316 | 0x0020, 0x0000, // GRAM horizontal Address |
davidprentice | 0:b608c7f02f80 | 2317 | 0x0021, 0x0000, // GRAM Vertical Address |
davidprentice | 0:b608c7f02f80 | 2318 | // ----------- Adjust the Gamma Curve ----------// |
davidprentice | 0:b608c7f02f80 | 2319 | |
davidprentice | 0:b608c7f02f80 | 2320 | 0x0030, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2321 | 0x0031, 0x0404, |
davidprentice | 0:b608c7f02f80 | 2322 | 0x0032, 0x0003, |
davidprentice | 0:b608c7f02f80 | 2323 | 0x0035, 0x0405, |
davidprentice | 0:b608c7f02f80 | 2324 | 0x0036, 0x0808, |
davidprentice | 0:b608c7f02f80 | 2325 | 0x0037, 0x0407, |
davidprentice | 0:b608c7f02f80 | 2326 | 0x0038, 0x0303, |
davidprentice | 0:b608c7f02f80 | 2327 | 0x0039, 0x0707, |
davidprentice | 0:b608c7f02f80 | 2328 | 0x003C, 0x0504, |
davidprentice | 0:b608c7f02f80 | 2329 | 0x003D, 0x0808, |
davidprentice | 0:b608c7f02f80 | 2330 | |
davidprentice | 0:b608c7f02f80 | 2331 | //------------------ Set GRAM area ---------------// |
davidprentice | 0:b608c7f02f80 | 2332 | 0x0060, 0x2700, // Gate Scan Line GS=0 [0xA700] |
davidprentice | 0:b608c7f02f80 | 2333 | 0x0061, 0x0001, // NDL,VLE, REV .kbv |
davidprentice | 0:b608c7f02f80 | 2334 | 0x006A, 0x0000, // set scrolling line |
davidprentice | 0:b608c7f02f80 | 2335 | //-------------- Partial Display Control ---------// |
davidprentice | 0:b608c7f02f80 | 2336 | 0x0080, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2337 | 0x0081, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2338 | 0x0082, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2339 | 0x0083, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2340 | 0x0084, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2341 | 0x0085, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2342 | //-------------- Panel Control -------------------// |
davidprentice | 0:b608c7f02f80 | 2343 | 0x0090, 0x0010, |
davidprentice | 0:b608c7f02f80 | 2344 | 0x0092, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2345 | 0x0007, 0x0133, // 262K color and display ON |
davidprentice | 0:b608c7f02f80 | 2346 | }; |
davidprentice | 0:b608c7f02f80 | 2347 | init_table16(ILI9325_regValues, sizeof(ILI9325_regValues)); |
davidprentice | 0:b608c7f02f80 | 2348 | break; |
davidprentice | 0:b608c7f02f80 | 2349 | |
davidprentice | 0:b608c7f02f80 | 2350 | #if defined(SUPPORT_9326_5420) |
davidprentice | 0:b608c7f02f80 | 2351 | case 0x5420: |
davidprentice | 0:b608c7f02f80 | 2352 | case 0x9326: |
davidprentice | 0:b608c7f02f80 | 2353 | _lcd_capable = REV_SCREEN | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 2354 | static const uint16_t ILI9326_CPT28_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2355 | //************* Start Initial Sequence **********// |
davidprentice | 0:b608c7f02f80 | 2356 | 0x0702, 0x3008, // Set internal timing, don’t change this value |
davidprentice | 0:b608c7f02f80 | 2357 | 0x0705, 0x0036, // Set internal timing, don’t change this value |
davidprentice | 0:b608c7f02f80 | 2358 | 0x070B, 0x1213, // Set internal timing, don’t change this value |
davidprentice | 0:b608c7f02f80 | 2359 | 0x0001, 0x0100, // set SS and SM bit |
davidprentice | 0:b608c7f02f80 | 2360 | 0x0002, 0x0100, // set 1 line inversion |
davidprentice | 0:b608c7f02f80 | 2361 | 0x0003, 0x1030, // set GRAM write direction and BGR=1. |
davidprentice | 0:b608c7f02f80 | 2362 | 0x0008, 0x0202, // set the back porch and front porch |
davidprentice | 0:b608c7f02f80 | 2363 | 0x0009, 0x0000, // set non-display area refresh cycle ISC[3:0] |
davidprentice | 0:b608c7f02f80 | 2364 | 0x000C, 0x0000, // RGB interface setting |
davidprentice | 0:b608c7f02f80 | 2365 | 0x000F, 0x0000, // RGB interface polarity |
davidprentice | 0:b608c7f02f80 | 2366 | //*************Power On sequence ****************// |
davidprentice | 0:b608c7f02f80 | 2367 | 0x0100, 0x0000, // SAP, BT[3:0], AP, DSTB, SLP, STB |
davidprentice | 0:b608c7f02f80 | 2368 | 0x0102, 0x0000, // VREG1OUT voltage |
davidprentice | 0:b608c7f02f80 | 2369 | 0x0103, 0x0000, // VDV[4:0] for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 2370 | TFTLCD_DELAY, 200, // Dis-charge capacitor power voltage |
davidprentice | 0:b608c7f02f80 | 2371 | 0x0100, 0x1190, // SAP, BT[3:0], AP, DSTB, SLP, STB |
davidprentice | 0:b608c7f02f80 | 2372 | 0x0101, 0x0227, // DC1[2:0], DC0[2:0], VC[2:0] |
davidprentice | 0:b608c7f02f80 | 2373 | TFTLCD_DELAY, 50, // Delay 50ms |
davidprentice | 0:b608c7f02f80 | 2374 | 0x0102, 0x01BD, // VREG1OUT voltage |
davidprentice | 0:b608c7f02f80 | 2375 | TFTLCD_DELAY, 50, // Delay 50ms |
davidprentice | 0:b608c7f02f80 | 2376 | 0x0103, 0x2D00, // VDV[4:0] for VCOM amplitude |
davidprentice | 0:b608c7f02f80 | 2377 | 0x0281, 0x000E, // VCM[5:0] for VCOMH |
davidprentice | 0:b608c7f02f80 | 2378 | TFTLCD_DELAY, 50, // |
davidprentice | 0:b608c7f02f80 | 2379 | 0x0200, 0x0000, // GRAM horizontal Address |
davidprentice | 0:b608c7f02f80 | 2380 | 0x0201, 0x0000, // GRAM Vertical Address |
davidprentice | 0:b608c7f02f80 | 2381 | // ----------- Adjust the Gamma Curve ----------// |
davidprentice | 0:b608c7f02f80 | 2382 | 0x0300, 0x0000, // |
davidprentice | 0:b608c7f02f80 | 2383 | 0x0301, 0x0707, // |
davidprentice | 0:b608c7f02f80 | 2384 | 0x0302, 0x0606, // |
davidprentice | 0:b608c7f02f80 | 2385 | 0x0305, 0x0000, // |
davidprentice | 0:b608c7f02f80 | 2386 | 0x0306, 0x0D00, // |
davidprentice | 0:b608c7f02f80 | 2387 | 0x0307, 0x0706, // |
davidprentice | 0:b608c7f02f80 | 2388 | 0x0308, 0x0005, // |
davidprentice | 0:b608c7f02f80 | 2389 | 0x0309, 0x0007, // |
davidprentice | 0:b608c7f02f80 | 2390 | 0x030C, 0x0000, // |
davidprentice | 0:b608c7f02f80 | 2391 | 0x030D, 0x000A, // |
davidprentice | 0:b608c7f02f80 | 2392 | //------------------ Set GRAM area ---------------// |
davidprentice | 0:b608c7f02f80 | 2393 | 0x0400, 0x3100, // Gate Scan Line 400 lines |
davidprentice | 0:b608c7f02f80 | 2394 | 0x0401, 0x0001, // NDL,VLE, REV |
davidprentice | 0:b608c7f02f80 | 2395 | 0x0404, 0x0000, // set scrolling line |
davidprentice | 0:b608c7f02f80 | 2396 | //-------------- Partial Display Control ---------// |
davidprentice | 0:b608c7f02f80 | 2397 | 0x0500, 0x0000, // Partial Image 1 Display Position |
davidprentice | 0:b608c7f02f80 | 2398 | 0x0501, 0x0000, // Partial Image 1 RAM Start/End Address |
davidprentice | 0:b608c7f02f80 | 2399 | 0x0502, 0x0000, // Partial Image 1 RAM Start/End Address |
davidprentice | 0:b608c7f02f80 | 2400 | 0x0503, 0x0000, // Partial Image 2 Display Position |
davidprentice | 0:b608c7f02f80 | 2401 | 0x0504, 0x0000, // Partial Image 2 RAM Start/End Address |
davidprentice | 0:b608c7f02f80 | 2402 | 0x0505, 0x0000, // Partial Image 2 RAM Start/End Address |
davidprentice | 0:b608c7f02f80 | 2403 | //-------------- Panel Control -------------------// |
davidprentice | 0:b608c7f02f80 | 2404 | 0x0010, 0x0010, // DIVI[1:0];RTNI[4:0] |
davidprentice | 0:b608c7f02f80 | 2405 | 0x0011, 0x0600, // NOWI[2:0];SDTI[2:0] |
davidprentice | 0:b608c7f02f80 | 2406 | 0x0020, 0x0002, // DIVE[1:0];RTNE[5:0] |
davidprentice | 0:b608c7f02f80 | 2407 | 0x0007, 0x0173, // 262K color and display ON |
davidprentice | 0:b608c7f02f80 | 2408 | }; |
davidprentice | 0:b608c7f02f80 | 2409 | init_table16(ILI9326_CPT28_regValues, sizeof(ILI9326_CPT28_regValues)); |
davidprentice | 0:b608c7f02f80 | 2410 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2411 | *p16 = 400; |
davidprentice | 0:b608c7f02f80 | 2412 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2413 | *p16 = 240; |
davidprentice | 0:b608c7f02f80 | 2414 | break; |
davidprentice | 0:b608c7f02f80 | 2415 | #endif |
davidprentice | 0:b608c7f02f80 | 2416 | |
davidprentice | 0:b608c7f02f80 | 2417 | case 0x9327: |
davidprentice | 0:b608c7f02f80 | 2418 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 2419 | static const uint8_t ILI9327_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2420 | 0xB0, 1, 0x00, //Disable Protect for cmds B1-DF, E0-EF, F0-FF |
davidprentice | 0:b608c7f02f80 | 2421 | // 0xE0, 1, 0x20, //NV Memory Write [00] |
davidprentice | 0:b608c7f02f80 | 2422 | // 0xD1, 3, 0x00, 0x71, 0x19, //VCOM control [00 40 0F] |
davidprentice | 0:b608c7f02f80 | 2423 | // 0xD0, 3, 0x07, 0x01, 0x08, //Power Setting [07 04 8C] |
davidprentice | 0:b608c7f02f80 | 2424 | 0xC1, 4, 0x10, 0x10, 0x02, 0x02, //Display Timing [10 10 02 02] |
davidprentice | 0:b608c7f02f80 | 2425 | 0xC0, 6, 0x00, 0x35, 0x00, 0x00, 0x01, 0x02, //Panel Drive [00 35 00 00 01 02 REV=0,GS=0,SS=0 |
davidprentice | 0:b608c7f02f80 | 2426 | 0xC5, 1, 0x04, //Frame Rate [04] |
davidprentice | 0:b608c7f02f80 | 2427 | 0xD2, 2, 0x01, 0x04, //Power Setting [01 44] |
davidprentice | 0:b608c7f02f80 | 2428 | // 0xC8, 15, 0x04, 0x67, 0x35, 0x04, 0x08, 0x06, 0x24, 0x01, 0x37, 0x40, 0x03, 0x10, 0x08, 0x80, 0x00, |
davidprentice | 0:b608c7f02f80 | 2429 | // 0xC8, 15, 0x00, 0x77, 0x77, 0x04, 0x04, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, |
davidprentice | 0:b608c7f02f80 | 2430 | 0xCA, 1, 0x00, //DGC LUT ??? |
davidprentice | 0:b608c7f02f80 | 2431 | 0xEA, 1, 0x80, //3-Gamma Function Enable |
davidprentice | 0:b608c7f02f80 | 2432 | // 0xB0, 1, 0x03, //Enable Protect |
davidprentice | 0:b608c7f02f80 | 2433 | }; |
davidprentice | 0:b608c7f02f80 | 2434 | table8_ads = ILI9327_regValues, table_size = sizeof(ILI9327_regValues); |
davidprentice | 0:b608c7f02f80 | 2435 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2436 | *p16 = 400; |
davidprentice | 0:b608c7f02f80 | 2437 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2438 | *p16 = 240; |
davidprentice | 0:b608c7f02f80 | 2439 | break; |
davidprentice | 0:b608c7f02f80 | 2440 | case 0x1602: |
davidprentice | 0:b608c7f02f80 | 2441 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; //does not readGRAM |
davidprentice | 0:b608c7f02f80 | 2442 | static const uint8_t XX1602_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2443 | 0xB8, 1, 0x01, //GS [00] |
davidprentice | 0:b608c7f02f80 | 2444 | 0xC0, 1, 0x0E, //??Power [0A] |
davidprentice | 0:b608c7f02f80 | 2445 | }; |
davidprentice | 0:b608c7f02f80 | 2446 | table8_ads = XX1602_regValues, table_size = sizeof(XX1602_regValues); |
davidprentice | 0:b608c7f02f80 | 2447 | break; |
davidprentice | 0:b608c7f02f80 | 2448 | |
davidprentice | 0:b608c7f02f80 | 2449 | case 0x2053: //weird from BangGood |
davidprentice | 0:b608c7f02f80 | 2450 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 2451 | goto common_9329; |
davidprentice | 0:b608c7f02f80 | 2452 | case 0xAC11: |
davidprentice | 0:b608c7f02f80 | 2453 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN; //thanks viliam |
davidprentice | 0:b608c7f02f80 | 2454 | goto common_9329; |
davidprentice | 0:b608c7f02f80 | 2455 | case 0x9302: |
davidprentice | 0:b608c7f02f80 | 2456 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; |
davidprentice | 0:b608c7f02f80 | 2457 | goto common_9329; |
davidprentice | 0:b608c7f02f80 | 2458 | case 0x9338: |
davidprentice | 0:b608c7f02f80 | 2459 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2460 | goto common_9329; |
davidprentice | 0:b608c7f02f80 | 2461 | case 0x9329: |
davidprentice | 0:b608c7f02f80 | 2462 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_SS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 2463 | common_9329: |
davidprentice | 0:b608c7f02f80 | 2464 | static const uint8_t ILI9329_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2465 | // 0xF6, 3, 0x01, 0x01, 0x00, //Interface Control needs EXTC=1 MX_EOR=1, TM=0, RIM=0 |
davidprentice | 0:b608c7f02f80 | 2466 | // 0xB6, 3, 0x0A, 0x82, 0x27, //Display Function [0A 82 27] |
davidprentice | 0:b608c7f02f80 | 2467 | // 0xB7, 1, 0x06, //Entry Mode Set [06] |
davidprentice | 0:b608c7f02f80 | 2468 | 0x36, 1, 0x00, //Memory Access [00] pointless but stops an empty array |
davidprentice | 0:b608c7f02f80 | 2469 | }; |
davidprentice | 0:b608c7f02f80 | 2470 | table8_ads = ILI9329_regValues, table_size = sizeof(ILI9329_regValues); |
davidprentice | 0:b608c7f02f80 | 2471 | break; |
davidprentice | 0:b608c7f02f80 | 2472 | |
davidprentice | 0:b608c7f02f80 | 2473 | case 0x9340: //ILI9340 thanks Ravi_kanchan2004. |
davidprentice | 0:b608c7f02f80 | 2474 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 2475 | goto common_9341; |
davidprentice | 0:b608c7f02f80 | 2476 | case 0x9341: |
davidprentice | 0:b608c7f02f80 | 2477 | common_9341: |
davidprentice | 0:b608c7f02f80 | 2478 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2479 | static const uint8_t ILI9341_regValues_2_4[] PROGMEM = { // BOE 2.4" |
davidprentice | 0:b608c7f02f80 | 2480 | 0xF6, 3, 0x01, 0x01, 0x00, //Interface Control needs EXTC=1 MV_EOR=0, TM=0, RIM=0 |
davidprentice | 0:b608c7f02f80 | 2481 | 0xCF, 3, 0x00, 0x81, 0x30, //Power Control B [00 81 30] |
davidprentice | 0:b608c7f02f80 | 2482 | 0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01] |
davidprentice | 0:b608c7f02f80 | 2483 | 0xE8, 3, 0x85, 0x10, 0x78, //Driver Timing A [04 11 7A] |
davidprentice | 0:b608c7f02f80 | 2484 | 0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02] |
davidprentice | 0:b608c7f02f80 | 2485 | 0xF7, 1, 0x20, //Pump Ratio [10] |
davidprentice | 0:b608c7f02f80 | 2486 | 0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00] |
davidprentice | 0:b608c7f02f80 | 2487 | 0xB0, 1, 0x00, //RGB Signal [00] |
davidprentice | 0:b608c7f02f80 | 2488 | 0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B] |
davidprentice | 0:b608c7f02f80 | 2489 | // 0xB6, 2, 0x0A, 0xA2, 0x27, //Display Function [0A 82 27 XX] .kbv SS=1 |
davidprentice | 0:b608c7f02f80 | 2490 | 0xB4, 1, 0x00, //Inversion Control [02] .kbv NLA=1, NLB=1, NLC=1 |
davidprentice | 0:b608c7f02f80 | 2491 | 0xC0, 1, 0x21, //Power Control 1 [26] |
davidprentice | 0:b608c7f02f80 | 2492 | 0xC1, 1, 0x11, //Power Control 2 [00] |
davidprentice | 0:b608c7f02f80 | 2493 | 0xC5, 2, 0x3F, 0x3C, //VCOM 1 [31 3C] |
davidprentice | 0:b608c7f02f80 | 2494 | 0xC7, 1, 0xB5, //VCOM 2 [C0] |
davidprentice | 0:b608c7f02f80 | 2495 | 0x36, 1, 0x48, //Memory Access [00] |
davidprentice | 0:b608c7f02f80 | 2496 | 0xF2, 1, 0x00, //Enable 3G [02] |
davidprentice | 0:b608c7f02f80 | 2497 | 0x26, 1, 0x01, //Gamma Set [01] |
davidprentice | 0:b608c7f02f80 | 2498 | 0xE0, 15, 0x0f, 0x26, 0x24, 0x0b, 0x0e, 0x09, 0x54, 0xa8, 0x46, 0x0c, 0x17, 0x09, 0x0f, 0x07, 0x00, |
davidprentice | 0:b608c7f02f80 | 2499 | 0xE1, 15, 0x00, 0x19, 0x1b, 0x04, 0x10, 0x07, 0x2a, 0x47, 0x39, 0x03, 0x06, 0x06, 0x30, 0x38, 0x0f, |
davidprentice | 0:b608c7f02f80 | 2500 | }; |
davidprentice | 0:b608c7f02f80 | 2501 | static const uint8_t ILI9341_regValues_ada[] PROGMEM = { // Adafruit_TFTLCD only works with EXTC=0 |
davidprentice | 0:b608c7f02f80 | 2502 | // 0xF6, 3, 0x00, 0x01, 0x00, //Interface Control needs EXTC=1 TM=0, RIM=0 |
davidprentice | 0:b608c7f02f80 | 2503 | // 0xF6, 3, 0x01, 0x01, 0x03, //Interface Control needs EXTC=1 RM=1, RIM=1 |
davidprentice | 0:b608c7f02f80 | 2504 | 0xF6, 3, 0x09, 0x01, 0x03, //Interface Control needs EXTC=1 RM=0, RIM=1 |
davidprentice | 0:b608c7f02f80 | 2505 | 0xB0, 1, 0x40, //RGB Signal [40] RCM=2 |
davidprentice | 0:b608c7f02f80 | 2506 | 0xB4, 1, 0x00, //Inversion Control [02] .kbv NLA=1, NLB=1, NLC=1 |
davidprentice | 0:b608c7f02f80 | 2507 | 0xC0, 1, 0x23, //Power Control 1 [26] |
davidprentice | 0:b608c7f02f80 | 2508 | 0xC1, 1, 0x10, //Power Control 2 [00] |
davidprentice | 0:b608c7f02f80 | 2509 | 0xC5, 2, 0x2B, 0x2B, //VCOM 1 [31 3C] |
davidprentice | 0:b608c7f02f80 | 2510 | 0xC7, 1, 0xC0, //VCOM 2 [C0] |
davidprentice | 0:b608c7f02f80 | 2511 | 0x36, 1, 0x88, //Memory Access [00] |
davidprentice | 0:b608c7f02f80 | 2512 | 0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B] |
davidprentice | 0:b608c7f02f80 | 2513 | 0xB7, 1, 0x07, //Entry Mode [00] |
davidprentice | 0:b608c7f02f80 | 2514 | }; |
davidprentice | 0:b608c7f02f80 | 2515 | table8_ads = ILI9341_regValues_2_4, table_size = sizeof(ILI9341_regValues_2_4); // |
davidprentice | 0:b608c7f02f80 | 2516 | break; |
davidprentice | 0:b608c7f02f80 | 2517 | #if defined(SUPPORT_9342) |
davidprentice | 0:b608c7f02f80 | 2518 | case 0x9342: |
davidprentice | 0:b608c7f02f80 | 2519 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS | INVERT_GS | REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 2520 | static const uint8_t ILI9342_regValues_CPT24[] PROGMEM = { //CPT 2.4" |
davidprentice | 0:b608c7f02f80 | 2521 | (0xB9), 3, 0xFF, 0x93, 0x42, //[00 00 00] |
davidprentice | 0:b608c7f02f80 | 2522 | (0xC0), 2, 0x1D, 0x0A, //[26 09] |
davidprentice | 0:b608c7f02f80 | 2523 | (0xC1), 1, 0x02, //[10] |
davidprentice | 0:b608c7f02f80 | 2524 | (0xC5), 2, 0x2F, 0x2F, //[31 3C] |
davidprentice | 0:b608c7f02f80 | 2525 | (0xC7), 1, 0xC3, //[C0] |
davidprentice | 0:b608c7f02f80 | 2526 | (0xB8), 1, 0x0B, //[07] |
davidprentice | 0:b608c7f02f80 | 2527 | (0xE0), 15, 0x0F, 0x33, 0x30, 0x0C, 0x0F, 0x08, 0x5D, 0x66, 0x4A, 0x07, 0x13, 0x05, 0x1B, 0x0E, 0x08, |
davidprentice | 0:b608c7f02f80 | 2528 | (0xE1), 15, 0x08, 0x0E, 0x11, 0x02, 0x0E, 0x02, 0x24, 0x33, 0x37, 0x03, 0x0A, 0x09, 0x26, 0x33, 0x0F, |
davidprentice | 0:b608c7f02f80 | 2529 | }; |
davidprentice | 0:b608c7f02f80 | 2530 | static const uint8_t ILI9342_regValues_Tianma23[] PROGMEM = { //Tianma 2.3" |
davidprentice | 0:b608c7f02f80 | 2531 | (0xB9), 3, 0xFF, 0x93, 0x42, |
davidprentice | 0:b608c7f02f80 | 2532 | (0xC0), 2, 0x1D, 0x0A, |
davidprentice | 0:b608c7f02f80 | 2533 | (0xC1), 1, 0x01, |
davidprentice | 0:b608c7f02f80 | 2534 | (0xC5), 2, 0x2C, 0x2C, |
davidprentice | 0:b608c7f02f80 | 2535 | (0xC7), 1, 0xC6, |
davidprentice | 0:b608c7f02f80 | 2536 | (0xB8), 1, 0x09, |
davidprentice | 0:b608c7f02f80 | 2537 | (0xE0), 15, 0x0F, 0x26, 0x21, 0x07, 0x0A, 0x03, 0x4E, 0x62, 0x3E, 0x0B, 0x11, 0x00, 0x08, 0x02, 0x00, |
davidprentice | 0:b608c7f02f80 | 2538 | (0xE1), 15, 0x00, 0x19, 0x1E, 0x03, 0x0E, 0x03, 0x30, 0x23, 0x41, 0x03, 0x0B, 0x07, 0x2F, 0x36, 0x0F, |
davidprentice | 0:b608c7f02f80 | 2539 | }; |
davidprentice | 0:b608c7f02f80 | 2540 | static const uint8_t ILI9342_regValues_HSD23[] PROGMEM = { //HSD 2.3" |
davidprentice | 0:b608c7f02f80 | 2541 | (0xB9), 3, 0xFF, 0x93, 0x42, |
davidprentice | 0:b608c7f02f80 | 2542 | (0xC0), 2, 0x1D, 0x0A, |
davidprentice | 0:b608c7f02f80 | 2543 | (0xC1), 1, 0x02, |
davidprentice | 0:b608c7f02f80 | 2544 | (0xC5), 2, 0x2F, 0x27, |
davidprentice | 0:b608c7f02f80 | 2545 | (0xC7), 1, 0xA4, |
davidprentice | 0:b608c7f02f80 | 2546 | (0xB8), 1, 0x0B, |
davidprentice | 0:b608c7f02f80 | 2547 | (0xE0), 15, 0x0F, 0x24, 0x21, 0x0C, 0x0F, 0x06, 0x50, 0x75, 0x3F, 0x07, 0x12, 0x05, 0x11, 0x0B, 0x08, |
davidprentice | 0:b608c7f02f80 | 2548 | (0xE1), 15, 0x08, 0x1D, 0x20, 0x02, 0x0E, 0x04, 0x31, 0x24, 0x42, 0x03, 0x0B, 0x09, 0x30, 0x36, 0x0F, |
davidprentice | 0:b608c7f02f80 | 2549 | }; |
davidprentice | 0:b608c7f02f80 | 2550 | table8_ads = ILI9342_regValues_CPT24, table_size = sizeof(ILI9342_regValues_CPT24); // |
davidprentice | 0:b608c7f02f80 | 2551 | // table8_ads = ILI9342_regValues_Tianma23, table_size = sizeof(ILI9342_regValues_Tianma23); // |
davidprentice | 0:b608c7f02f80 | 2552 | // table8_ads = ILI9342_regValues_HSD23, table_size = sizeof(ILI9342_regValues_HSD23); // |
davidprentice | 0:b608c7f02f80 | 2553 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2554 | *p16 = 240; |
davidprentice | 0:b608c7f02f80 | 2555 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2556 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 2557 | break; |
davidprentice | 0:b608c7f02f80 | 2558 | #endif |
davidprentice | 0:b608c7f02f80 | 2559 | case 0x1581: //no BGR in MADCTL. set BGR in Panel Control |
davidprentice | 0:b608c7f02f80 | 2560 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; //thanks zdravke |
davidprentice | 0:b608c7f02f80 | 2561 | goto common_9481; |
davidprentice | 0:b608c7f02f80 | 2562 | case 0x9481: |
davidprentice | 0:b608c7f02f80 | 2563 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_BGR; |
davidprentice | 0:b608c7f02f80 | 2564 | common_9481: |
davidprentice | 0:b608c7f02f80 | 2565 | static const uint8_t ILI9481_regValues[] PROGMEM = { // Atmel MaxTouch |
davidprentice | 0:b608c7f02f80 | 2566 | 0xB0, 1, 0x00, // unlocks E0, F0 |
davidprentice | 0:b608c7f02f80 | 2567 | 0xB3, 4, 0x02, 0x00, 0x00, 0x00, //Frame Memory, interface [02 00 00 00] |
davidprentice | 0:b608c7f02f80 | 2568 | 0xB4, 1, 0x00, // Frame mode [00] |
davidprentice | 0:b608c7f02f80 | 2569 | 0xD0, 3, 0x07, 0x42, 0x18, // Set Power [00 43 18] x1.00, x6, x3 |
davidprentice | 0:b608c7f02f80 | 2570 | 0xD1, 3, 0x00, 0x07, 0x10, // Set VCOM [00 00 00] x0.72, x1.02 |
davidprentice | 0:b608c7f02f80 | 2571 | 0xD2, 2, 0x01, 0x02, // Set Power for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2572 | 0xD3, 2, 0x01, 0x02, // Set Power for Partial Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2573 | 0xD4, 2, 0x01, 0x02, // Set Power for Idle Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2574 | 0xC0, 5, 0x12, 0x3B, 0x00, 0x02, 0x11, //Panel Driving BGR for 1581 [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2575 | 0xC1, 3, 0x10, 0x10, 0x88, // Display Timing Normal [10 10 88] |
davidprentice | 0:b608c7f02f80 | 2576 | 0xC5, 1, 0x03, //Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2577 | 0xC6, 1, 0x02, //Interface Control [02] |
davidprentice | 0:b608c7f02f80 | 2578 | 0xC8, 12, 0x00, 0x32, 0x36, 0x45, 0x06, 0x16, 0x37, 0x75, 0x77, 0x54, 0x0C, 0x00, |
davidprentice | 0:b608c7f02f80 | 2579 | 0xCC, 1, 0x00, //Panel Control [00] |
davidprentice | 0:b608c7f02f80 | 2580 | }; |
davidprentice | 0:b608c7f02f80 | 2581 | static const uint8_t ILI9481_CPT29_regValues[] PROGMEM = { // 320x430 |
davidprentice | 0:b608c7f02f80 | 2582 | 0xB0, 1, 0x00, |
davidprentice | 0:b608c7f02f80 | 2583 | 0xD0, 3, 0x07, 0x42, 0x1C, // Set Power [00 43 18] |
davidprentice | 0:b608c7f02f80 | 2584 | 0xD1, 3, 0x00, 0x02, 0x0F, // Set VCOM [00 00 00] x0.695, x1.00 |
davidprentice | 0:b608c7f02f80 | 2585 | 0xD2, 2, 0x01, 0x11, // Set Power for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2586 | 0xC0, 5, 0x10, 0x35, 0x00, 0x02, 0x11, //Set Panel Driving [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2587 | 0xC5, 1, 0x03, //Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2588 | 0xC8, 12, 0x00, 0x30, 0x36, 0x45, 0x04, 0x16, 0x37, 0x75, 0x77, 0x54, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2589 | 0xE4, 1, 0xA0, |
davidprentice | 0:b608c7f02f80 | 2590 | 0xF0, 1, 0x01, |
davidprentice | 0:b608c7f02f80 | 2591 | 0xF3, 2, 0x02, 0x1A, |
davidprentice | 0:b608c7f02f80 | 2592 | }; |
davidprentice | 0:b608c7f02f80 | 2593 | static const uint8_t ILI9481_PVI35_regValues[] PROGMEM = { // 320x480 |
davidprentice | 0:b608c7f02f80 | 2594 | 0xB0, 1, 0x00, |
davidprentice | 0:b608c7f02f80 | 2595 | 0xD0, 3, 0x07, 0x41, 0x1D, // Set Power [00 43 18] |
davidprentice | 0:b608c7f02f80 | 2596 | 0xD1, 3, 0x00, 0x2B, 0x1F, // Set VCOM [00 00 00] x0.900, x1.32 |
davidprentice | 0:b608c7f02f80 | 2597 | 0xD2, 2, 0x01, 0x11, // Set Power for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2598 | 0xC0, 5, 0x10, 0x3B, 0x00, 0x02, 0x11, //Set Panel Driving [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2599 | 0xC5, 1, 0x03, //Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2600 | 0xC8, 12, 0x00, 0x14, 0x33, 0x10, 0x00, 0x16, 0x44, 0x36, 0x77, 0x00, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2601 | 0xE4, 1, 0xA0, |
davidprentice | 0:b608c7f02f80 | 2602 | 0xF0, 1, 0x01, |
davidprentice | 0:b608c7f02f80 | 2603 | 0xF3, 2, 0x40, 0x0A, |
davidprentice | 0:b608c7f02f80 | 2604 | }; |
davidprentice | 0:b608c7f02f80 | 2605 | static const uint8_t ILI9481_AUO317_regValues[] PROGMEM = { // 320x480 |
davidprentice | 0:b608c7f02f80 | 2606 | 0xB0, 1, 0x00, |
davidprentice | 0:b608c7f02f80 | 2607 | 0xD0, 3, 0x07, 0x40, 0x1D, // Set Power [00 43 18] |
davidprentice | 0:b608c7f02f80 | 2608 | 0xD1, 3, 0x00, 0x18, 0x13, // Set VCOM [00 00 00] x0.805, x1.08 |
davidprentice | 0:b608c7f02f80 | 2609 | 0xD2, 2, 0x01, 0x11, // Set Power for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2610 | 0xC0, 5, 0x10, 0x3B, 0x00, 0x02, 0x11, //Set Panel Driving [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2611 | 0xC5, 1, 0x03, //Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2612 | 0xC8, 12, 0x00, 0x44, 0x06, 0x44, 0x0A, 0x08, 0x17, 0x33, 0x77, 0x44, 0x08, 0x0C, |
davidprentice | 0:b608c7f02f80 | 2613 | 0xE4, 1, 0xA0, |
davidprentice | 0:b608c7f02f80 | 2614 | 0xF0, 1, 0x01, |
davidprentice | 0:b608c7f02f80 | 2615 | }; |
davidprentice | 0:b608c7f02f80 | 2616 | static const uint8_t ILI9481_CMO35_regValues[] PROGMEM = { // 320480 |
davidprentice | 0:b608c7f02f80 | 2617 | 0xB0, 1, 0x00, |
davidprentice | 0:b608c7f02f80 | 2618 | 0xD0, 3, 0x07, 0x41, 0x1D, // Set Power [00 43 18] 07,41,1D |
davidprentice | 0:b608c7f02f80 | 2619 | 0xD1, 3, 0x00, 0x1C, 0x1F, // Set VCOM [00 00 00] x0.825, x1.32 1C,1F |
davidprentice | 0:b608c7f02f80 | 2620 | 0xD2, 2, 0x01, 0x11, // Set Power for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2621 | 0xC0, 5, 0x10, 0x3B, 0x00, 0x02, 0x11, //Set Panel Driving [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2622 | 0xC5, 1, 0x03, //Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2623 | 0xC6, 1, 0x83, |
davidprentice | 0:b608c7f02f80 | 2624 | 0xC8, 12, 0x00, 0x26, 0x21, 0x00, 0x00, 0x1F, 0x65, 0x23, 0x77, 0x00, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2625 | 0xF0, 1, 0x01, //? |
davidprentice | 0:b608c7f02f80 | 2626 | 0xE4, 1, 0xA0, //?SETCABC on Himax |
davidprentice | 0:b608c7f02f80 | 2627 | 0x36, 1, 0x48, //Memory Access [00] |
davidprentice | 0:b608c7f02f80 | 2628 | 0xB4, 1, 0x11, |
davidprentice | 0:b608c7f02f80 | 2629 | }; |
davidprentice | 0:b608c7f02f80 | 2630 | static const uint8_t ILI9481_RGB_regValues[] PROGMEM = { // 320x480 |
davidprentice | 0:b608c7f02f80 | 2631 | 0xB0, 1, 0x00, |
davidprentice | 0:b608c7f02f80 | 2632 | 0xD0, 3, 0x07, 0x41, 0x1D, // SETPOWER [00 43 18] |
davidprentice | 0:b608c7f02f80 | 2633 | 0xD1, 3, 0x00, 0x2B, 0x1F, // SETVCOM [00 00 00] x0.900, x1.32 |
davidprentice | 0:b608c7f02f80 | 2634 | 0xD2, 2, 0x01, 0x11, // SETNORPOW for Normal Mode [01 22] |
davidprentice | 0:b608c7f02f80 | 2635 | 0xC0, 6, 0x10, 0x3B, 0x00, 0x02, 0x11, 0x00, //SETPANEL [10 3B 00 02 11] |
davidprentice | 0:b608c7f02f80 | 2636 | 0xC5, 1, 0x03, //SETOSC Frame Rate [03] |
davidprentice | 0:b608c7f02f80 | 2637 | 0xC6, 1, 0x80, //SETRGB interface control |
davidprentice | 0:b608c7f02f80 | 2638 | 0xC8, 12, 0x00, 0x14, 0x33, 0x10, 0x00, 0x16, 0x44, 0x36, 0x77, 0x00, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2639 | 0xF3, 2, 0x40, 0x0A, |
davidprentice | 0:b608c7f02f80 | 2640 | 0xF0, 1, 0x08, |
davidprentice | 0:b608c7f02f80 | 2641 | 0xF6, 1, 0x84, |
davidprentice | 0:b608c7f02f80 | 2642 | 0xF7, 1, 0x80, |
davidprentice | 0:b608c7f02f80 | 2643 | 0x0C, 2, 0x00, 0x55, //RDCOLMOD |
davidprentice | 0:b608c7f02f80 | 2644 | 0xB4, 1, 0x00, //SETDISPLAY |
davidprentice | 0:b608c7f02f80 | 2645 | // 0xB3, 4, 0x00, 0x01, 0x06, 0x01, //SETGRAM simple example |
davidprentice | 0:b608c7f02f80 | 2646 | 0xB3, 4, 0x00, 0x01, 0x06, 0x30, //jpegs example |
davidprentice | 0:b608c7f02f80 | 2647 | }; |
davidprentice | 0:b608c7f02f80 | 2648 | table8_ads = ILI9481_regValues, table_size = sizeof(ILI9481_regValues); |
davidprentice | 0:b608c7f02f80 | 2649 | // table8_ads = ILI9481_CPT29_regValues, table_size = sizeof(ILI9481_CPT29_regValues); |
davidprentice | 0:b608c7f02f80 | 2650 | // table8_ads = ILI9481_PVI35_regValues, table_size = sizeof(ILI9481_PVI35_regValues); |
davidprentice | 0:b608c7f02f80 | 2651 | // table8_ads = ILI9481_AUO317_regValues, table_size = sizeof(ILI9481_AUO317_regValues); |
davidprentice | 0:b608c7f02f80 | 2652 | // table8_ads = ILI9481_CMO35_regValues, table_size = sizeof(ILI9481_CMO35_regValues); |
davidprentice | 0:b608c7f02f80 | 2653 | // table8_ads = ILI9481_RGB_regValues, table_size = sizeof(ILI9481_RGB_regValues); |
davidprentice | 0:b608c7f02f80 | 2654 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2655 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 2656 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2657 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 2658 | break; |
davidprentice | 0:b608c7f02f80 | 2659 | case 0x9486: |
davidprentice | 0:b608c7f02f80 | 2660 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; //Red 3.5", Blue 3.5" |
davidprentice | 0:b608c7f02f80 | 2661 | // _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN; //old Red 3.5" |
davidprentice | 0:b608c7f02f80 | 2662 | static const uint8_t ILI9486_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2663 | /* |
davidprentice | 0:b608c7f02f80 | 2664 | 0xF2, 9, 0x1C, 0xA3, 0x32, 0x02, 0xB2, 0x12, 0xFF, 0x12, 0x00, //f.k |
davidprentice | 0:b608c7f02f80 | 2665 | 0xF1, 2, 0x36, 0xA4, // |
davidprentice | 0:b608c7f02f80 | 2666 | 0xF8, 2, 0x21, 0x04, // |
davidprentice | 0:b608c7f02f80 | 2667 | 0xF9, 2, 0x00, 0x08, // |
davidprentice | 0:b608c7f02f80 | 2668 | */ |
davidprentice | 0:b608c7f02f80 | 2669 | 0xC0, 2, 0x0d, 0x0d, //Power Control 1 [0E 0E] |
davidprentice | 0:b608c7f02f80 | 2670 | 0xC1, 2, 0x43, 0x00, //Power Control 2 [43 00] |
davidprentice | 0:b608c7f02f80 | 2671 | 0xC2, 1, 0x00, //Power Control 3 [33] |
davidprentice | 0:b608c7f02f80 | 2672 | 0xC5, 4, 0x00, 0x48, 0x00, 0x48, //VCOM Control 1 [00 40 00 40] |
davidprentice | 0:b608c7f02f80 | 2673 | 0xB4, 1, 0x00, //Inversion Control [00] |
davidprentice | 0:b608c7f02f80 | 2674 | 0xB6, 3, 0x02, 0x02, 0x3B, // Display Function Control [02 02 3B] |
davidprentice | 0:b608c7f02f80 | 2675 | #define GAMMA9486 4 |
davidprentice | 0:b608c7f02f80 | 2676 | #if GAMMA9486 == 0 |
davidprentice | 0:b608c7f02f80 | 2677 | // default GAMMA terrible |
davidprentice | 0:b608c7f02f80 | 2678 | #elif GAMMA9486 == 1 |
davidprentice | 0:b608c7f02f80 | 2679 | // GAMMA f.k. bad |
davidprentice | 0:b608c7f02f80 | 2680 | 0xE0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00, |
davidprentice | 0:b608c7f02f80 | 2681 | 0xE1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f, |
davidprentice | 0:b608c7f02f80 | 2682 | #elif GAMMA9486 == 2 |
davidprentice | 0:b608c7f02f80 | 2683 | // 1.2 CPT 3.5 Inch Initial Code not bad |
davidprentice | 0:b608c7f02f80 | 2684 | 0xE0, 15, 0x0F, 0x1B, 0x18, 0x0B, 0x0E, 0x09, 0x47, 0x94, 0x35, 0x0A, 0x13, 0x05, 0x08, 0x03, 0x00, |
davidprentice | 0:b608c7f02f80 | 2685 | 0xE1, 15, 0x0F, 0x3A, 0x37, 0x0B, 0x0C, 0x05, 0x4A, 0x24, 0x39, 0x07, 0x10, 0x04, 0x27, 0x25, 0x00, |
davidprentice | 0:b608c7f02f80 | 2686 | #elif GAMMA9486 == 3 |
davidprentice | 0:b608c7f02f80 | 2687 | // 2.2 HSD 3.5 Inch Initial Code not bad |
davidprentice | 0:b608c7f02f80 | 2688 | 0xE0, 15, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, |
davidprentice | 0:b608c7f02f80 | 2689 | 0xE1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, |
davidprentice | 0:b608c7f02f80 | 2690 | #elif GAMMA9486 == 4 |
davidprentice | 0:b608c7f02f80 | 2691 | // 3.2 TM 3.2 Inch Initial Code not bad |
davidprentice | 0:b608c7f02f80 | 2692 | 0xE0, 15, 0x0F, 0x21, 0x1C, 0x0B, 0x0E, 0x08, 0x49, 0x98, 0x38, 0x09, 0x11, 0x03, 0x14, 0x10, 0x00, |
davidprentice | 0:b608c7f02f80 | 2693 | 0xE1, 15, 0x0F, 0x2F, 0x2B, 0x0C, 0x0E, 0x06, 0x47, 0x76, 0x37, 0x07, 0x11, 0x04, 0x23, 0x1E, 0x00, |
davidprentice | 0:b608c7f02f80 | 2694 | #elif GAMMA9486 == 5 |
davidprentice | 0:b608c7f02f80 | 2695 | // 4.2 WTK 3.5 Inch Initial Code too white |
davidprentice | 0:b608c7f02f80 | 2696 | 0xE0, 15, 0x0F, 0x10, 0x08, 0x05, 0x09, 0x05, 0x37, 0x98, 0x26, 0x07, 0x0F, 0x02, 0x09, 0x07, 0x00, |
davidprentice | 0:b608c7f02f80 | 2697 | 0xE1, 15, 0x0F, 0x38, 0x36, 0x0D, 0x10, 0x08, 0x59, 0x76, 0x48, 0x0A, 0x16, 0x0A, 0x37, 0x2F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2698 | #endif |
davidprentice | 0:b608c7f02f80 | 2699 | }; |
davidprentice | 0:b608c7f02f80 | 2700 | table8_ads = ILI9486_regValues, table_size = sizeof(ILI9486_regValues); |
davidprentice | 0:b608c7f02f80 | 2701 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2702 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 2703 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2704 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 2705 | break; |
davidprentice | 0:b608c7f02f80 | 2706 | case 0x7796: |
davidprentice | 0:b608c7f02f80 | 2707 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS; //thanks to safari1 |
davidprentice | 0:b608c7f02f80 | 2708 | goto common_9488; |
davidprentice | 0:b608c7f02f80 | 2709 | case 0x9487: //with thanks to Charlyf |
davidprentice | 0:b608c7f02f80 | 2710 | case 0x9488: |
davidprentice | 0:b608c7f02f80 | 2711 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2712 | common_9488: |
davidprentice | 0:b608c7f02f80 | 2713 | static const uint8_t ILI9488_regValues_max[] PROGMEM = { // Atmel MaxTouch |
davidprentice | 0:b608c7f02f80 | 2714 | 0xC0, 2, 0x10, 0x10, //Power Control 1 [0E 0E] |
davidprentice | 0:b608c7f02f80 | 2715 | 0xC1, 1, 0x41, //Power Control 2 [43] |
davidprentice | 0:b608c7f02f80 | 2716 | 0xC5, 4, 0x00, 0x22, 0x80, 0x40, //VCOM Control 1 [00 40 00 40] |
davidprentice | 0:b608c7f02f80 | 2717 | 0x36, 1, 0x68, //Memory Access [00] |
davidprentice | 0:b608c7f02f80 | 2718 | 0xB0, 1, 0x00, //Interface [00] |
davidprentice | 0:b608c7f02f80 | 2719 | 0xB1, 2, 0xB0, 0x11, //Frame Rate Control [B0 11] |
davidprentice | 0:b608c7f02f80 | 2720 | 0xB4, 1, 0x02, //Inversion Control [02] |
davidprentice | 0:b608c7f02f80 | 2721 | 0xB6, 3, 0x02, 0x02, 0x3B, // Display Function Control [02 02 3B] .kbv NL=480 |
davidprentice | 0:b608c7f02f80 | 2722 | 0xB7, 1, 0xC6, //Entry Mode [06] |
davidprentice | 0:b608c7f02f80 | 2723 | 0x3A, 1, 0x55, //Interlace Pixel Format [XX] |
davidprentice | 0:b608c7f02f80 | 2724 | 0xF7, 4, 0xA9, 0x51, 0x2C, 0x82, //Adjustment Control 3 [A9 51 2C 82] |
davidprentice | 0:b608c7f02f80 | 2725 | }; |
davidprentice | 0:b608c7f02f80 | 2726 | table8_ads = ILI9488_regValues_max, table_size = sizeof(ILI9488_regValues_max); |
davidprentice | 0:b608c7f02f80 | 2727 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2728 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 2729 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2730 | *p16 = 320; |
davidprentice | 0:b608c7f02f80 | 2731 | break; |
davidprentice | 0:b608c7f02f80 | 2732 | case 0xB505: //R61505V |
davidprentice | 0:b608c7f02f80 | 2733 | case 0xC505: //R61505W |
davidprentice | 0:b608c7f02f80 | 2734 | _lcd_capable = 0 | REV_SCREEN | READ_LOWHIGH; |
davidprentice | 0:b608c7f02f80 | 2735 | static const uint16_t R61505V_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2736 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2737 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2738 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2739 | 0x0000, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2740 | 0x00A4, 0x0001, //CALB=1 |
davidprentice | 0:b608c7f02f80 | 2741 | TFTLCD_DELAY, 10, |
davidprentice | 0:b608c7f02f80 | 2742 | 0x0060, 0x2700, //NL |
davidprentice | 0:b608c7f02f80 | 2743 | 0x0008, 0x0808, //FP & BP |
davidprentice | 0:b608c7f02f80 | 2744 | 0x0030, 0x0214, //Gamma settings |
davidprentice | 0:b608c7f02f80 | 2745 | 0x0031, 0x3715, |
davidprentice | 0:b608c7f02f80 | 2746 | 0x0032, 0x0604, |
davidprentice | 0:b608c7f02f80 | 2747 | 0x0033, 0x0E16, |
davidprentice | 0:b608c7f02f80 | 2748 | 0x0034, 0x2211, |
davidprentice | 0:b608c7f02f80 | 2749 | 0x0035, 0x1500, |
davidprentice | 0:b608c7f02f80 | 2750 | 0x0036, 0x8507, |
davidprentice | 0:b608c7f02f80 | 2751 | 0x0037, 0x1407, |
davidprentice | 0:b608c7f02f80 | 2752 | 0x0038, 0x1403, |
davidprentice | 0:b608c7f02f80 | 2753 | 0x0039, 0x0020, |
davidprentice | 0:b608c7f02f80 | 2754 | 0x0090, 0x0015, //DIVI & RTNI |
davidprentice | 0:b608c7f02f80 | 2755 | 0x0010, 0x0410, //BT=4,AP=1 |
davidprentice | 0:b608c7f02f80 | 2756 | 0x0011, 0x0237, //DC1=2,DC0=3, VC=7 |
davidprentice | 0:b608c7f02f80 | 2757 | 0x0029, 0x0046, //VCM1=70 |
davidprentice | 0:b608c7f02f80 | 2758 | 0x002A, 0x0046, //VCMSEL=0,VCM2=70 |
davidprentice | 0:b608c7f02f80 | 2759 | // Sleep mode IN sequence |
davidprentice | 0:b608c7f02f80 | 2760 | 0x0007, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2761 | //0x0012, 0x0000, //PSON=0,PON=0 |
davidprentice | 0:b608c7f02f80 | 2762 | // Sleep mode EXIT sequence |
davidprentice | 0:b608c7f02f80 | 2763 | 0x0012, 0x0189, //VCMR=1,PSON=0,PON=0,VRH=9 |
davidprentice | 0:b608c7f02f80 | 2764 | 0x0013, 0x1100, //VDV=17 |
davidprentice | 0:b608c7f02f80 | 2765 | TFTLCD_DELAY, 150, |
davidprentice | 0:b608c7f02f80 | 2766 | 0x0012, 0x01B9, //VCMR=1,PSON=1,PON=1,VRH=9 [018F] |
davidprentice | 0:b608c7f02f80 | 2767 | 0x0001, 0x0100, //SS=1 Other mode settings |
davidprentice | 0:b608c7f02f80 | 2768 | 0x0002, 0x0200, //BC0=1--Line inversion |
davidprentice | 0:b608c7f02f80 | 2769 | 0x0003, 0x1030, |
davidprentice | 0:b608c7f02f80 | 2770 | 0x0009, 0x0001, //ISC=1 [0000] |
davidprentice | 0:b608c7f02f80 | 2771 | 0x000A, 0x0000, // [0000] |
davidprentice | 0:b608c7f02f80 | 2772 | // 0x000C, 0x0001, //RIM=1 [0000] |
davidprentice | 0:b608c7f02f80 | 2773 | 0x000D, 0x0000, // [0000] |
davidprentice | 0:b608c7f02f80 | 2774 | 0x000E, 0x0030, //VEM=3 VCOM equalize [0000] |
davidprentice | 0:b608c7f02f80 | 2775 | 0x0061, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2776 | 0x006A, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2777 | 0x0080, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2778 | 0x0081, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2779 | 0x0082, 0x005F, |
davidprentice | 0:b608c7f02f80 | 2780 | 0x0092, 0x0100, |
davidprentice | 0:b608c7f02f80 | 2781 | 0x0093, 0x0701, |
davidprentice | 0:b608c7f02f80 | 2782 | TFTLCD_DELAY, 80, |
davidprentice | 0:b608c7f02f80 | 2783 | 0x0007, 0x0100, //BASEE=1--Display On |
davidprentice | 0:b608c7f02f80 | 2784 | }; |
davidprentice | 0:b608c7f02f80 | 2785 | init_table16(R61505V_regValues, sizeof(R61505V_regValues)); |
davidprentice | 0:b608c7f02f80 | 2786 | break; |
davidprentice | 0:b608c7f02f80 | 2787 | |
davidprentice | 0:b608c7f02f80 | 2788 | #if defined(SUPPORT_B509_7793) |
davidprentice | 0:b608c7f02f80 | 2789 | case 0x7793: |
davidprentice | 0:b608c7f02f80 | 2790 | case 0xB509: |
davidprentice | 0:b608c7f02f80 | 2791 | _lcd_capable = REV_SCREEN; |
davidprentice | 0:b608c7f02f80 | 2792 | static const uint16_t R61509V_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2793 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2794 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2795 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2796 | 0x0000, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2797 | TFTLCD_DELAY, 15, |
davidprentice | 0:b608c7f02f80 | 2798 | 0x0400, 0x6200, //NL=0x31 (49) i.e. 400 rows |
davidprentice | 0:b608c7f02f80 | 2799 | 0x0008, 0x0808, |
davidprentice | 0:b608c7f02f80 | 2800 | //gamma |
davidprentice | 0:b608c7f02f80 | 2801 | 0x0300, 0x0C00, |
davidprentice | 0:b608c7f02f80 | 2802 | 0x0301, 0x5A0B, |
davidprentice | 0:b608c7f02f80 | 2803 | 0x0302, 0x0906, |
davidprentice | 0:b608c7f02f80 | 2804 | 0x0303, 0x1017, |
davidprentice | 0:b608c7f02f80 | 2805 | 0x0304, 0x2300, |
davidprentice | 0:b608c7f02f80 | 2806 | 0x0305, 0x1700, |
davidprentice | 0:b608c7f02f80 | 2807 | 0x0306, 0x6309, |
davidprentice | 0:b608c7f02f80 | 2808 | 0x0307, 0x0C09, |
davidprentice | 0:b608c7f02f80 | 2809 | 0x0308, 0x100C, |
davidprentice | 0:b608c7f02f80 | 2810 | 0x0309, 0x2232, |
davidprentice | 0:b608c7f02f80 | 2811 | |
davidprentice | 0:b608c7f02f80 | 2812 | 0x0010, 0x0016, //69.5Hz 0016 |
davidprentice | 0:b608c7f02f80 | 2813 | 0x0011, 0x0101, |
davidprentice | 0:b608c7f02f80 | 2814 | 0x0012, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2815 | 0x0013, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2816 | |
davidprentice | 0:b608c7f02f80 | 2817 | 0x0100, 0x0330, //BT,AP |
davidprentice | 0:b608c7f02f80 | 2818 | 0x0101, 0x0237, //DC0,DC1,VC |
davidprentice | 0:b608c7f02f80 | 2819 | 0x0103, 0x0D00, //VDV |
davidprentice | 0:b608c7f02f80 | 2820 | 0x0280, 0x6100, //VCM |
davidprentice | 0:b608c7f02f80 | 2821 | 0x0102, 0xC1B0, //VRH,VCMR,PSON,PON |
davidprentice | 0:b608c7f02f80 | 2822 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2823 | |
davidprentice | 0:b608c7f02f80 | 2824 | 0x0001, 0x0100, |
davidprentice | 0:b608c7f02f80 | 2825 | 0x0002, 0x0100, |
davidprentice | 0:b608c7f02f80 | 2826 | 0x0003, 0x1030, //1030 |
davidprentice | 0:b608c7f02f80 | 2827 | 0x0009, 0x0001, |
davidprentice | 0:b608c7f02f80 | 2828 | 0x000C, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2829 | 0x0090, 0x8000, |
davidprentice | 0:b608c7f02f80 | 2830 | 0x000F, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2831 | |
davidprentice | 0:b608c7f02f80 | 2832 | 0x0210, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2833 | 0x0211, 0x00EF, |
davidprentice | 0:b608c7f02f80 | 2834 | 0x0212, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2835 | 0x0213, 0x018F, //432=01AF,400=018F |
davidprentice | 0:b608c7f02f80 | 2836 | 0x0500, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2837 | 0x0501, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2838 | 0x0502, 0x005F, //??? |
davidprentice | 0:b608c7f02f80 | 2839 | 0x0401, 0x0001, //REV=1 |
davidprentice | 0:b608c7f02f80 | 2840 | 0x0404, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2841 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2842 | |
davidprentice | 0:b608c7f02f80 | 2843 | 0x0007, 0x0100, //BASEE |
davidprentice | 0:b608c7f02f80 | 2844 | TFTLCD_DELAY, 50, |
davidprentice | 0:b608c7f02f80 | 2845 | |
davidprentice | 0:b608c7f02f80 | 2846 | 0x0200, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2847 | 0x0201, 0x0000, |
davidprentice | 0:b608c7f02f80 | 2848 | }; |
davidprentice | 0:b608c7f02f80 | 2849 | init_table16(R61509V_regValues, sizeof(R61509V_regValues)); |
davidprentice | 0:b608c7f02f80 | 2850 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2851 | *p16 = 400; |
davidprentice | 0:b608c7f02f80 | 2852 | break; |
davidprentice | 0:b608c7f02f80 | 2853 | #endif |
davidprentice | 0:b608c7f02f80 | 2854 | |
davidprentice | 0:b608c7f02f80 | 2855 | #ifdef SUPPORT_9806 |
davidprentice | 0:b608c7f02f80 | 2856 | case 0x9806: |
davidprentice | 0:b608c7f02f80 | 2857 | _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2858 | // from ZinggJM |
davidprentice | 0:b608c7f02f80 | 2859 | static const uint8_t ILI9806_regValues[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2860 | (0xFF), 3, /* EXTC Command Set enable register*/ 0xFF, 0x98, 0x06, |
davidprentice | 0:b608c7f02f80 | 2861 | (0xBA), 1, /* SPI Interface Setting*/0xE0, |
davidprentice | 0:b608c7f02f80 | 2862 | (0xBC), 21, /* GIP 1*/0x03, 0x0F, 0x63, 0x69, 0x01, 0x01, 0x1B, 0x11, 0x70, 0x73, 0xFF, 0xFF, 0x08, 0x09, 0x05, 0x00, 0xEE, 0xE2, 0x01, 0x00, 0xC1, |
davidprentice | 0:b608c7f02f80 | 2863 | (0xBD), 8, /* GIP 2*/0x01, 0x23, 0x45, 0x67, 0x01, 0x23, 0x45, 0x67, |
davidprentice | 0:b608c7f02f80 | 2864 | (0xBE), 9, /* GIP 3*/0x00, 0x22, 0x27, 0x6A, 0xBC, 0xD8, 0x92, 0x22, 0x22, |
davidprentice | 0:b608c7f02f80 | 2865 | (0xC7), 1, /* Vcom*/0x1E, |
davidprentice | 0:b608c7f02f80 | 2866 | (0xED), 3, /* EN_volt_reg*/0x7F, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2867 | (0xC0), 3, /* Power Control 1*/0xE3, 0x0B, 0x00, |
davidprentice | 0:b608c7f02f80 | 2868 | (0xFC), 1, 0x08, |
davidprentice | 0:b608c7f02f80 | 2869 | (0xDF), 6, /* Engineering Setting*/0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
davidprentice | 0:b608c7f02f80 | 2870 | (0xF3), 1, /* DVDD Voltage Setting*/0x74, |
davidprentice | 0:b608c7f02f80 | 2871 | (0xB4), 3, /* Display Inversion Control*/0x00, 0x00, 0x00, |
davidprentice | 0:b608c7f02f80 | 2872 | (0xF7), 1, /* 480x854*/0x81, |
davidprentice | 0:b608c7f02f80 | 2873 | (0xB1), 3, /* Frame Rate*/0x00, 0x10, 0x14, |
davidprentice | 0:b608c7f02f80 | 2874 | (0xF1), 3, /* Panel Timing Control*/0x29, 0x8A, 0x07, |
davidprentice | 0:b608c7f02f80 | 2875 | (0xF2), 4, /*Panel Timing Control*/0x40, 0xD2, 0x50, 0x28, |
davidprentice | 0:b608c7f02f80 | 2876 | (0xC1), 4, /* Power Control 2*/0x17, 0x85, 0x85, 0x20, |
davidprentice | 0:b608c7f02f80 | 2877 | (0xE0), 16, 0x00, 0x0C, 0x15, 0x0D, 0x0F, 0x0C, 0x07, 0x05, 0x07, 0x0B, 0x10, 0x10, 0x0D, 0x17, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2878 | (0xE1), 16, 0x00, 0x0D, 0x15, 0x0E, 0x10, 0x0D, 0x08, 0x06, 0x07, 0x0C, 0x11, 0x11, 0x0E, 0x17, 0x0F, 0x00, |
davidprentice | 0:b608c7f02f80 | 2879 | (0x35), 1, /*Tearing Effect ON*/0x00, |
davidprentice | 0:b608c7f02f80 | 2880 | }; |
davidprentice | 0:b608c7f02f80 | 2881 | table8_ads = ILI9806_regValues, table_size = sizeof(ILI9806_regValues); |
davidprentice | 0:b608c7f02f80 | 2882 | p16 = (int16_t *) & HEIGHT; |
davidprentice | 0:b608c7f02f80 | 2883 | *p16 = 480; |
davidprentice | 0:b608c7f02f80 | 2884 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2885 | *p16 = 854; |
davidprentice | 0:b608c7f02f80 | 2886 | break; |
davidprentice | 0:b608c7f02f80 | 2887 | #endif |
davidprentice | 0:b608c7f02f80 | 2888 | default: |
davidprentice | 0:b608c7f02f80 | 2889 | p16 = (int16_t *) & WIDTH; |
davidprentice | 0:b608c7f02f80 | 2890 | *p16 = 0; //error value for WIDTH |
davidprentice | 0:b608c7f02f80 | 2891 | break; |
davidprentice | 0:b608c7f02f80 | 2892 | } |
davidprentice | 0:b608c7f02f80 | 2893 | _lcd_rev = ((_lcd_capable & REV_SCREEN) != 0); |
davidprentice | 0:b608c7f02f80 | 2894 | if (table8_ads != NULL) { |
davidprentice | 0:b608c7f02f80 | 2895 | static const uint8_t reset_off[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2896 | 0x01, 0, //Soft Reset |
davidprentice | 0:b608c7f02f80 | 2897 | TFTLCD_DELAY8, 150, // .kbv will power up with ONLY reset, sleep out, display on |
davidprentice | 0:b608c7f02f80 | 2898 | 0x28, 0, //Display Off |
davidprentice | 0:b608c7f02f80 | 2899 | 0x3A, 1, 0x55, //Pixel read=565, write=565. |
davidprentice | 0:b608c7f02f80 | 2900 | }; |
davidprentice | 0:b608c7f02f80 | 2901 | static const uint8_t wake_on[] PROGMEM = { |
davidprentice | 0:b608c7f02f80 | 2902 | 0x11, 0, //Sleep Out |
davidprentice | 0:b608c7f02f80 | 2903 | TFTLCD_DELAY8, 150, |
davidprentice | 0:b608c7f02f80 | 2904 | 0x29, 0, //Display On |
davidprentice | 0:b608c7f02f80 | 2905 | }; |
davidprentice | 0:b608c7f02f80 | 2906 | init_table(&reset_off, sizeof(reset_off)); |
davidprentice | 0:b608c7f02f80 | 2907 | init_table(table8_ads, table_size); //can change PIXFMT |
davidprentice | 0:b608c7f02f80 | 2908 | init_table(&wake_on, sizeof(wake_on)); |
davidprentice | 0:b608c7f02f80 | 2909 | } |
davidprentice | 0:b608c7f02f80 | 2910 | setRotation(0); //PORTRAIT |
davidprentice | 0:b608c7f02f80 | 2911 | invertDisplay(false); |
davidprentice | 0:b608c7f02f80 | 2912 | #if defined(SUPPORT_9488_555) |
davidprentice | 0:b608c7f02f80 | 2913 | if (_lcd_ID == 0x9488) { |
davidprentice | 0:b608c7f02f80 | 2914 | is555 = 0; |
davidprentice | 0:b608c7f02f80 | 2915 | drawPixel(0, 0, 0xFFE0); |
davidprentice | 0:b608c7f02f80 | 2916 | if (readPixel(0, 0) == 0xFF1F) { |
davidprentice | 0:b608c7f02f80 | 2917 | uint8_t pixfmt = 0x06; |
davidprentice | 0:b608c7f02f80 | 2918 | pushCommand(0x3A, &pixfmt, 1); |
davidprentice | 0:b608c7f02f80 | 2919 | _lcd_capable &= ~READ_24BITS; |
davidprentice | 0:b608c7f02f80 | 2920 | is555 = 1; |
davidprentice | 0:b608c7f02f80 | 2921 | } |
davidprentice | 0:b608c7f02f80 | 2922 | } |
davidprentice | 0:b608c7f02f80 | 2923 | #endif |
davidprentice | 0:b608c7f02f80 | 2924 | } |