Add invert_display runtime option

This commit is contained in:
fvanroie 2021-01-13 00:12:05 +01:00
parent ea8ac442ab
commit 9bbc4741af
2 changed files with 19 additions and 4 deletions

View File

@ -38,7 +38,7 @@ void m5stack_init()
}
#endif
void drv_display_init(uint8_t rotation)
void drv_display_init(lv_disp_drv_t * disp_drv, uint8_t rotation, bool invert_display)
{
#if defined(M5STACK)
m5stack_init(); // Set LCD power first
@ -46,9 +46,23 @@ void drv_display_init(uint8_t rotation)
/* TFT init */
#if defined(USE_FSMC)
fsmc_ili9341_init(rotation);
fsmc_ili9341_init(rotation, invert_display);
disp_drv->flush_cb = fsmc_ili9341_flush; // Normal callback when flushing
// xpt2046_init(rotation);
#else
tft_espi_init(rotation);
tft_espi_init(rotation, invert_display);
disp_drv->flush_cb = tft_espi_flush; // Normal callback when flushing
#endif
}
/* Callback used for screenshots only: */
/* indirect callback to flush screenshot data to the screen */
void drv_display_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
#if defined(USE_FSMC)
fsmc_ili9341_flush(disp, area, color_p);
#else
tft_espi_flush(disp, area, color_p);
#endif
}

View File

@ -11,6 +11,7 @@
#include "tft_espi_drv.h"
#endif
void drv_display_init(uint8_t rotation);
void drv_display_init(lv_disp_drv_t * disp_drv, uint8_t rotation, bool invert_display);
void drv_display_flush_cb(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
#endif