mirror of
https://github.com/YuzuZensai/MCUFRIEND_kbv.git
synced 2026-01-31 14:57:48 +00:00
call setAddrWindow() as func, writecmddata() as static
This commit is contained in:
@@ -89,7 +89,7 @@ void MCUFRIEND_kbv::reset(void)
|
||||
WriteCmdData(0xB0, 0x0000); //R61520 needs this to read ID
|
||||
}
|
||||
|
||||
void MCUFRIEND_kbv::WriteCmdData(uint16_t cmd, uint16_t dat)
|
||||
static void writecmddata(uint16_t cmd, uint16_t dat)
|
||||
{
|
||||
CS_ACTIVE;
|
||||
WriteCmd(cmd);
|
||||
@@ -97,13 +97,14 @@ void MCUFRIEND_kbv::WriteCmdData(uint16_t cmd, uint16_t dat)
|
||||
CS_IDLE;
|
||||
}
|
||||
|
||||
void MCUFRIEND_kbv::WriteCmdData(uint16_t cmd, uint16_t dat) { writecmddata(cmd, dat); }
|
||||
|
||||
static void WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t * block)
|
||||
{
|
||||
CS_ACTIVE;
|
||||
WriteCmd(cmd);
|
||||
while (N-- > 0) {
|
||||
uint8_t u8 = *block++;
|
||||
// CD_DATA;
|
||||
write8(u8);
|
||||
if (N && is8347) {
|
||||
cmd++;
|
||||
@@ -148,7 +149,6 @@ uint16_t MCUFRIEND_kbv::readReg(uint16_t reg, int8_t index)
|
||||
CS_ACTIVE;
|
||||
WriteCmd(reg);
|
||||
setReadDir();
|
||||
// CD_DATA;
|
||||
delay(1); //1us should be adequate
|
||||
// READ_16(ret);
|
||||
do { ret = read16bits(); }while (--index >= 0); //need to test with SSD1963
|
||||
@@ -277,7 +277,6 @@ int16_t MCUFRIEND_kbv::readGRAM(int16_t x, int16_t y, uint16_t * block, int16_t
|
||||
CS_ACTIVE;
|
||||
WriteCmd(_MR);
|
||||
setReadDir();
|
||||
// CD_DATA;
|
||||
if (_lcd_capable & READ_NODUMMY) {
|
||||
;
|
||||
} else if ((_lcd_capable & MIPI_DCS_REV1) || _lcd_ID == 0x1289) {
|
||||
@@ -481,30 +480,15 @@ void MCUFRIEND_kbv::setRotation(uint8_t r)
|
||||
|
||||
void MCUFRIEND_kbv::drawPixel(int16_t x, int16_t y, uint16_t color)
|
||||
{
|
||||
#if 1
|
||||
fillRect(x, y, 1, 1, color);
|
||||
#else
|
||||
// MCUFRIEND just plots at edge if you try to write outside of the box:
|
||||
if (x < 0 || y < 0 || x >= width() || y >= height())
|
||||
return;
|
||||
#if defined(OFFSET_9327)
|
||||
if (_lcd_ID == 0x9327) {
|
||||
if (rotation == 2) y += OFFSET_9327;
|
||||
if (rotation == 3) x += OFFSET_9327;
|
||||
}
|
||||
#endif
|
||||
if (_lcd_capable & MIPI_DCS_REV1) {
|
||||
WriteCmdParam4(_MC, x >> 8, x, x >> 8, x);
|
||||
WriteCmdParam4(_MP, y >> 8, y, y >> 8, y);
|
||||
} else {
|
||||
WriteCmdData(_MC, x);
|
||||
WriteCmdData(_MP, y);
|
||||
}
|
||||
#if defined(SUPPORT_9488_555)
|
||||
if (is555) color = color565_to_555(color);
|
||||
#endif
|
||||
setAddrWindow(x, y, x, y);
|
||||
// CS_ACTIVE; WriteCmd(_MW); write16(color); CS_IDLE; //-0.01s +98B
|
||||
WriteCmdData(_MW, color);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MCUFRIEND_kbv::setAddrWindow(int16_t x, int16_t y, int16_t x1, int16_t y1)
|
||||
@@ -523,21 +507,30 @@ void MCUFRIEND_kbv::setAddrWindow(int16_t x, int16_t y, int16_t x1, int16_t y1)
|
||||
}
|
||||
#endif
|
||||
if (_lcd_capable & MIPI_DCS_REV1) {
|
||||
#if 1
|
||||
CS_ACTIVE; //-0.26s, +272B
|
||||
WriteCmd(_MC); write8(x>>8); write8(x); write8(x1>>8); write8(x1);
|
||||
WriteCmd(_MP); write8(y>>8); write8(y); write8(y1>>8); write8(y1);
|
||||
CS_IDLE;
|
||||
#else
|
||||
WriteCmdParam4(_MC, x >> 8, x, x1 >> 8, x1);
|
||||
WriteCmdParam4(_MP, y >> 8, y, y1 >> 8, y1);
|
||||
#endif
|
||||
} else {
|
||||
WriteCmdData(_MC, x);
|
||||
WriteCmdData(_MP, y);
|
||||
if (_lcd_capable & XSA_XEA_16BIT) {
|
||||
if (rotation & 1)
|
||||
y1 = y = (y1 << 8) | y;
|
||||
else
|
||||
x1 = x = (x1 << 8) | x;
|
||||
if (!(x == x1 && y == y1)) { //only need MC,MP for drawPixel
|
||||
if (_lcd_capable & XSA_XEA_16BIT) {
|
||||
if (rotation & 1)
|
||||
y1 = y = (y1 << 8) | y;
|
||||
else
|
||||
x1 = x = (x1 << 8) | x;
|
||||
}
|
||||
WriteCmdData(_SC, x);
|
||||
WriteCmdData(_SP, y);
|
||||
WriteCmdData(_EC, x1);
|
||||
WriteCmdData(_EP, y1);
|
||||
}
|
||||
WriteCmdData(_SC, x);
|
||||
WriteCmdData(_SP, y);
|
||||
WriteCmdData(_EC, x1);
|
||||
WriteCmdData(_EP, y1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +569,6 @@ void MCUFRIEND_kbv::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_
|
||||
w = end;
|
||||
}
|
||||
uint8_t hi = color >> 8, lo = color & 0xFF;
|
||||
// CD_DATA;
|
||||
while (h-- > 0) {
|
||||
end = w;
|
||||
#if USING_16BIT_BUS
|
||||
@@ -822,10 +814,7 @@ static void init_table16(const void *table, int16_t size)
|
||||
if (cmd == TFTLCD_DELAY)
|
||||
delay(d);
|
||||
else {
|
||||
CS_ACTIVE;
|
||||
WriteCmd(cmd);
|
||||
WriteData(d);
|
||||
CS_IDLE;
|
||||
writecmddata(cmd, d); //static function
|
||||
}
|
||||
size -= 2 * sizeof(int16_t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user