PartialMode support for ILI9163
Support of partial mode, where only part of screen is active. Can be use to reduce power consumption. Based on ILI9163 datasheet: https://www.rockbox.org/wiki/pub/Main/SonyNWZE370/ILI9163.pdf
This commit is contained in:
parent
f3190fde71
commit
174fccf2bd
|
|
@ -60,3 +60,7 @@
|
||||||
|
|
||||||
#define TFT_INVOFF 0x20
|
#define TFT_INVOFF 0x20
|
||||||
#define TFT_INVON 0x21
|
#define TFT_INVON 0x21
|
||||||
|
|
||||||
|
#define TFT_NORON 0x13 //normal mode
|
||||||
|
#define TFT_PTLON 0x12 //partial mode
|
||||||
|
#define TFT_PTLAR 0x30 //partial area
|
||||||
|
|
|
||||||
37
TFT_eSPI.cpp
37
TFT_eSPI.cpp
|
|
@ -3223,7 +3223,6 @@ uint8_t TFT_eSPI::color332(uint16_t c)
|
||||||
return ((c & 0xE000)>>8) | ((c & 0x0700)>>6) | ((c & 0x0018)>>3);
|
return ((c & 0xE000)>>8) | ((c & 0x0700)>>6) | ((c & 0x0018)>>3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Function name: invertDisplay
|
** Function name: invertDisplay
|
||||||
** Description: invert the display colours i = 1 invert, i = 0 normal
|
** Description: invert the display colours i = 1 invert, i = 0 normal
|
||||||
|
|
@ -3237,6 +3236,42 @@ void TFT_eSPI::invertDisplay(boolean i)
|
||||||
spi_end();
|
spi_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************************************
|
||||||
|
** Function name: setPartialMode
|
||||||
|
** Description: enables/disables "partial" mode, where only part of display is active
|
||||||
|
***************************************************************************************/
|
||||||
|
void TFT_eSPI::setPartialMode(bool mode)
|
||||||
|
{
|
||||||
|
#ifdef ILI9163_DRIVER
|
||||||
|
spi_begin();
|
||||||
|
writecommand(mode ? TFT_PTLON : TFT_NORON);
|
||||||
|
spi_end();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/***************************************************************************************
|
||||||
|
** Function name: setPartialWindow
|
||||||
|
** Description: sets active area for partial mode. Requires partial mode to be enabled.
|
||||||
|
** If endLine < startLine partial area will wrap at display edge
|
||||||
|
***************************************************************************************/
|
||||||
|
void TFT_eSPI::setPartialArea(int16_t startLine, int16_t endLine)
|
||||||
|
{
|
||||||
|
#ifdef ILI9163_DRIVER
|
||||||
|
if (rotation == 0 || rotation == 1)
|
||||||
|
{
|
||||||
|
startLine = _height_orig - startLine;
|
||||||
|
endLine = _height_orig - endLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_begin();
|
||||||
|
writecommand(TFT_PTLAR);
|
||||||
|
CS_L;
|
||||||
|
SPI.transfer16(startLine);
|
||||||
|
SPI.transfer16(endLine);
|
||||||
|
CS_H;
|
||||||
|
spi_end();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Function name: write
|
** Function name: write
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,9 @@ class TFT_eSPI : public Print {
|
||||||
|
|
||||||
setRotation(uint8_t r),
|
setRotation(uint8_t r),
|
||||||
invertDisplay(boolean i),
|
invertDisplay(boolean i),
|
||||||
|
|
||||||
|
setPartialMode(bool mode),
|
||||||
|
setPartialArea(int16_t startLine, int16_t endLine),
|
||||||
|
|
||||||
drawCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color),
|
drawCircle(int32_t x0, int32_t y0, int32_t r, uint32_t color),
|
||||||
drawCircleHelper(int32_t x0, int32_t y0, int32_t r, uint8_t cornername, uint32_t color),
|
drawCircleHelper(int32_t x0, int32_t y0, int32_t r, uint8_t cornername, uint32_t color),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue