Update driver callbacks

This commit is contained in:
fvanroie 2020-05-28 14:52:12 +02:00
parent 7715f54bc8
commit 1e66d85f36
4 changed files with 40 additions and 39 deletions

View File

@ -117,36 +117,35 @@ static inline void pushColors(uint16_t * data, uint32_t len)
io.endTransaction(); 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 = lv_area_get_size(area);
size_t len = (x2 - x1 + 1) * (y2 - y1 + 1); /* Number of pixels */ // 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); pushColors((uint16_t *)color_p, len);
#else
/* Update TFT */ /* Update TFT */
while(len > 255) { // while(len > 255) {
tft.pushColors((uint16_t *)color_p, 255); // tft.pushColors((uint16_t *)color_p, 255);
len -= 255; // len -= 255;
color_p += 255; // color_p += 255;
} // }
tft.pushColors((uint16_t *)color_p, len); // remainder // tft.pushColors((uint16_t *)color_p, len); // remainder
#endif
/* Tell lvgl that flushing is done */ /* 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) // 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); // 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) // 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); // fsmc_ili9341_flush(x1, y1, x2, y2, color_p);
} // }
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS

View File

@ -41,9 +41,10 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
void fsmc_ili9341_init(uint8_t rotation); 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_flush(lv_disp_drv_t * disp, const lv_area_t * area, 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_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p);
void fsmc_ili9341_map(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 * MACROS
**********************/ **********************/

View File

@ -67,13 +67,14 @@ void tft_espi_init(uint8_t rotation)
tftSetup(tft); 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 */ /* Update TFT */
tft.startWrite(); /* Start new TFT transaction */ tft.startWrite(); /* Start new TFT transaction */
tft.setWindow(x1, y1, x2, y2); /* set the working window */ tft.setWindow(area->x1, area->y1, area->x2, area->y2); /* set the working window */
#ifdef USE_DMA_TO_TFT #ifdef USE_DMA_TO_TFT
tft.pushPixelsDMA((uint16_t *)color_p, len); /* Write words at once */ tft.pushPixelsDMA((uint16_t *)color_p, len); /* Write words at once */
#else #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 */ tft.endWrite(); /* terminate TFT transaction */
/* Tell lvgl that flushing is done */ /* 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) // 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); // 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) // 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); // tft_espi_flush(x1, y1, x2, y2, color_p);
} // }
#if defined(TOUCH_CS) #if defined(TOUCH_CS)

View File

@ -33,7 +33,6 @@ extern "C" {
* DEFINES * DEFINES
*********************/ *********************/
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
@ -42,7 +41,8 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
void tft_espi_init(uint8_t rotation); 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_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); void tft_espi_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);