mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-26 20:56:37 +00:00
Add invert_display runtime option
This commit is contained in:
parent
755b3ea825
commit
ea8ac442ab
@ -32,6 +32,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void tftShowConfig(TFT_eSPI & tft);
|
||||
static void tftShowLogo(TFT_eSPI & tft);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -50,30 +51,27 @@ static TFT_eSPI tft;
|
||||
* Initialize the R61581 display controller
|
||||
* @return HW_RES_OK or any error from hw_res_t enum
|
||||
*/
|
||||
void tft_espi_init(uint8_t rotation)
|
||||
void tft_espi_init(uint8_t rotation, bool invert_display)
|
||||
{
|
||||
/* TFT init */
|
||||
tft.begin();
|
||||
tft.setSwapBytes(true); /* set endianess */
|
||||
tft.setRotation(rotation);
|
||||
tft.fillScreen(TFT_DARKCYAN);
|
||||
int x = (tft.width() - logoWidth) / 2;
|
||||
int y = (tft.height() - logoHeight) / 2;
|
||||
tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE);
|
||||
|
||||
#ifdef USE_DMA_TO_TFT
|
||||
// DMA - should work with STM32F2xx/F4xx/F7xx processors
|
||||
// NOTE: >>>>>> DMA IS FOR SPI DISPLAYS ONLY <<<<<<
|
||||
tft.initDMA(); // Initialise the DMA engine (tested with STM32F446 and STM32F767)
|
||||
#endif
|
||||
|
||||
/* TFT init */
|
||||
tft.begin();
|
||||
tft.setSwapBytes(true); /* set endianess */
|
||||
tft.setRotation(rotation);
|
||||
tft.invertDisplay(invert_display);
|
||||
|
||||
tftShowLogo(tft);
|
||||
tftShowConfig(tft);
|
||||
}
|
||||
|
||||
void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
size_t len = lv_area_get_size(area);
|
||||
// size_t len = (x2 - x1 + 1) * (y2 - y1 + 1); /* Number of pixels */
|
||||
|
||||
/* Update TFT */
|
||||
tft.startWrite(); /* Start new TFT transaction */
|
||||
@ -243,4 +241,11 @@ static void tftShowConfig(TFT_eSPI & tft)
|
||||
}
|
||||
}
|
||||
|
||||
static void tftShowLogo(TFT_eSPI & tft)
|
||||
{
|
||||
tft.fillScreen(TFT_DARKCYAN);
|
||||
int x = (tft.width() - logoWidth) / 2;
|
||||
int y = (tft.height() - logoHeight) / 2;
|
||||
tft.drawXBitmap(x, y, bootscreen, logoWidth, logoHeight, TFT_WHITE);
|
||||
}
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@ extern "C" {
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void tft_espi_init(uint8_t rotation);
|
||||
void tft_espi_init(uint8_t rotation, bool invert_display=false);
|
||||
void tft_espi_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
|
||||
// void tft_espi_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
||||
void tft_espi_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
||||
|
Loading…
x
Reference in New Issue
Block a user