diff --git a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp index b18eca48..6dc8535d 100644 --- a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp +++ b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.cpp @@ -117,36 +117,35 @@ static inline void pushColors(uint16_t * data, uint32_t len) io.endTransaction(); } -void fsmc_ili9341_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p) +void fsmc_ili9341_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) { - tft.setWindow(x1, y1, x2, y2); - size_t len = (x2 - x1 + 1) * (y2 - y1 + 1); /* Number of pixels */ + size_t len = lv_area_get_size(area); + // size_t len = (x2 - x1 + 1) * (y2 - y1 + 1); /* Number of pixels */ -#if 1 // use local version instead + tft.setWindow(area->x1, area->y1, area->x2, area->y2); pushColors((uint16_t *)color_p, len); -#else + /* Update TFT */ - while(len > 255) { - tft.pushColors((uint16_t *)color_p, 255); - len -= 255; - color_p += 255; - } - tft.pushColors((uint16_t *)color_p, len); // remainder -#endif + // while(len > 255) { + // tft.pushColors((uint16_t *)color_p, 255); + // len -= 255; + // color_p += 255; + // } + // tft.pushColors((uint16_t *)color_p, len); // remainder /* Tell lvgl that flushing is done */ - // lv_disp_flush_ready(); + lv_disp_flush_ready(disp); } -void fsmc_ili9341_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) -{ - tft.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, color.full); -} +// void fsmc_ili9341_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) +// { +// tft.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, color.full); +// } -void fsmc_ili9341_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p) -{ - fsmc_ili9341_flush(x1, y1, x2, y2, color_p); -} +// void fsmc_ili9341_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p) +// { +// fsmc_ili9341_flush(x1, y1, x2, y2, color_p); +// } /********************** * STATIC FUNCTIONS diff --git a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.h b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.h index 0f9689a7..2b78d1ce 100644 --- a/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.h +++ b/lib/lv_drv_fsmc_ili9341/fsmc_ili9341.h @@ -41,9 +41,10 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ void fsmc_ili9341_init(uint8_t rotation); -void fsmc_ili9341_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p); -void fsmc_ili9341_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color); -void fsmc_ili9341_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p); +void fsmc_ili9341_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p); +//void fsmc_ili9341_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p); +//void fsmc_ili9341_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color); +//void fsmc_ili9341_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p); /********************** * MACROS **********************/ diff --git a/lib/lv_drv_tft_espi/tft_espi_drv.cpp b/lib/lv_drv_tft_espi/tft_espi_drv.cpp index cb435cba..9f5ee24e 100644 --- a/lib/lv_drv_tft_espi/tft_espi_drv.cpp +++ b/lib/lv_drv_tft_espi/tft_espi_drv.cpp @@ -67,13 +67,14 @@ void tft_espi_init(uint8_t rotation) tftSetup(tft); } -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_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) { - size_t len = (x2 - x1 + 1) * (y2 - y1 + 1); /* Number of pixels */ + 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 */ - tft.setWindow(x1, y1, x2, y2); /* set the working window */ + tft.startWrite(); /* Start new TFT transaction */ + tft.setWindow(area->x1, area->y1, area->x2, area->y2); /* set the working window */ #ifdef USE_DMA_TO_TFT tft.pushPixelsDMA((uint16_t *)color_p, len); /* Write words at once */ #else @@ -82,18 +83,18 @@ void tft_espi_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_col tft.endWrite(); /* terminate TFT transaction */ /* Tell lvgl that flushing is done */ - // lv_disp_flush_ready(); + lv_disp_flush_ready(disp); } -void tft_espi_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) -{ - tft.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, color.full); -} +// void tft_espi_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) +// { +// tft.fillRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1, color.full); +// } -void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p) -{ - tft_espi_flush(x1, y1, x2, y2, color_p); -} +// void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p) +// { +// tft_espi_flush(x1, y1, x2, y2, color_p); +// } #if defined(TOUCH_CS) diff --git a/lib/lv_drv_tft_espi/tft_espi_drv.h b/lib/lv_drv_tft_espi/tft_espi_drv.h index 89ea03ef..f3b812c5 100644 --- a/lib/lv_drv_tft_espi/tft_espi_drv.h +++ b/lib/lv_drv_tft_espi/tft_espi_drv.h @@ -33,7 +33,6 @@ extern "C" { * DEFINES *********************/ - /********************** * TYPEDEFS **********************/ @@ -42,7 +41,8 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ void tft_espi_init(uint8_t rotation); -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_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); void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);