mirror of
https://github.com/YuzuZensai/MCUFRIEND_kbv.git
synced 2026-01-30 12:22:43 +00:00
implement pushCommand()
This commit is contained in:
@@ -78,7 +78,6 @@ void MCUFRIEND_kbv::WriteCmdData(uint16_t cmd, uint16_t dat)
|
||||
}
|
||||
|
||||
static void WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t * block)
|
||||
//void MCUFRIEND_kbv::WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t * block)
|
||||
{
|
||||
CS_ACTIVE;
|
||||
WriteCmd(cmd);
|
||||
@@ -101,6 +100,9 @@ static inline void WriteCmdParam4(uint8_t cmd, uint8_t d1, uint8_t d2, uint8_t d
|
||||
WriteCmdParamN(cmd, 4, d);
|
||||
}
|
||||
|
||||
//#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);}
|
||||
void MCUFRIEND_kbv::pushCommand(uint16_t cmd, int8_t N, uint8_t * block) { WriteCmdParamN(cmd, N, block); }
|
||||
|
||||
static uint16_t read16bits(void)
|
||||
{
|
||||
uint16_t ret;
|
||||
@@ -1665,7 +1667,7 @@ void MCUFRIEND_kbv::begin(uint16_t ID)
|
||||
case 0x9486:
|
||||
_lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN;
|
||||
static const uint8_t ILI9486_regValues[] PROGMEM = {
|
||||
0x01, 0, //Soft Reset
|
||||
0x01, 0, //Soft Reset
|
||||
TFTLCD_DELAY8, 50,
|
||||
0x28, 0, //Display Off
|
||||
0xC0, 2, 0x0d, 0x0d, //Power Control 1 [0x0E0E]
|
||||
@@ -1673,10 +1675,32 @@ void MCUFRIEND_kbv::begin(uint16_t ID)
|
||||
0xC2, 1, 0x00, //Power Control 3
|
||||
0xC5, 4, 0x00, 0x48, 0x00, 0x48, //VCOM Control 1 [0x00400040]
|
||||
0xB4, 1, 0x00, //Inversion Control
|
||||
0xB6, 3, 0x00, 0x02, 0x3B, // Display Function Control .kbv GS=0,SS=0
|
||||
0xB6, 3, 0x00, 0x02, 0x3B, // Display Function Control .kbv GS=0,SS=0
|
||||
#define GAMMA9486 4
|
||||
#if GAMMA9486 == 0
|
||||
// default GAMMA terrible
|
||||
#elif GAMMA9486 == 1
|
||||
// GAMMA f.k. bad
|
||||
0xE0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00,
|
||||
0xE1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f,
|
||||
0x20, 0, // Display Inversion OFF
|
||||
#elif GAMMA9486 == 2
|
||||
// 1.2 CPT 3.5 Inch Initial Code not bad
|
||||
0xE0, 15, 0x0F, 0x1B, 0x18, 0x0B, 0x0E, 0x09, 0x47, 0x94, 0x35, 0x0A, 0x13, 0x05, 0x08, 0x03, 0x00,
|
||||
0xE1, 15, 0x0F, 0x3A, 0x37, 0x0B, 0x0C, 0x05, 0x4A, 0x24, 0x39, 0x07, 0x10, 0x04, 0x27, 0x25, 0x00,
|
||||
#elif GAMMA9486 == 3
|
||||
// 2.2 HSD 3.5 Inch Initial Code not bad
|
||||
0xE0, 15, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00,
|
||||
0xE1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00,
|
||||
#elif GAMMA9486 == 4
|
||||
// 3.2 TM 3.2 Inch Initial Code not bad
|
||||
0xE0, 15, 0x0F, 0x21, 0x1C, 0x0B, 0x0E, 0x08, 0x49, 0x98, 0x38, 0x09, 0x11, 0x03, 0x14, 0x10, 0x00,
|
||||
0xE1, 15, 0x0F, 0x2F, 0x2B, 0x0C, 0x0E, 0x06, 0x47, 0x76, 0x37, 0x07, 0x11, 0x04, 0x23, 0x1E, 0x00,
|
||||
#elif GAMMA9486 == 5
|
||||
// 4.2 WTK 3.5 Inch Initial Code too white
|
||||
0xE0, 15, 0x0F, 0x10, 0x08, 0x05, 0x09, 0x05, 0x37, 0x98, 0x26, 0x07, 0x0F, 0x02, 0x09, 0x07, 0x00,
|
||||
0xE1, 15, 0x0F, 0x38, 0x36, 0x0D, 0x10, 0x08, 0x59, 0x76, 0x48, 0x0A, 0x16, 0x0A, 0x37, 0x2F, 0x00,
|
||||
#endif
|
||||
0x20, 0, // Display Inversion OFF
|
||||
0x36, 1, 0x0A, //Memory Access
|
||||
0x3A, 1, 0x55, //Interlace Pixel
|
||||
// 0x21, 0, //Invert display !!!
|
||||
|
||||
@@ -23,7 +23,8 @@ class MCUFRIEND_kbv : public Adafruit_GFX {
|
||||
void begin(uint16_t ID = 0x9341); // you only need the constructor
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color); // and these three
|
||||
void WriteCmdData(uint16_t cmd, uint16_t dat); // ?public methods !!!
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); }
|
||||
void pushCommand(uint16_t cmd, int8_t N, uint8_t * block);
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3); }
|
||||
uint16_t readID(void);
|
||||
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { fillRect(x, y, 1, h, color); }
|
||||
@@ -41,7 +42,7 @@ class MCUFRIEND_kbv : public Adafruit_GFX {
|
||||
void pushColors(uint8_t *block, int16_t n, bool first);
|
||||
void pushColors(const uint8_t *block, int16_t n, bool first);
|
||||
void vertScroll(int16_t top, int16_t scrollines, int16_t offset);
|
||||
|
||||
|
||||
private:
|
||||
uint16_t _lcd_ID, _lcd_rev, _lcd_madctl, _lcd_drivOut, _MC, _MP, _MW, _SC, _EC, _SP, _EP;
|
||||
uint16_t _lcd_xor, _lcd_capable;
|
||||
|
||||
Reference in New Issue
Block a user