Description
I want to use gpu_fill_cb, but I could not understand how to use it.
What MCU/Processor/Board and compiler are you using?
STM32F746G-DISCO
STM32CubeIDE
What LVGL version are you using?
7.7.2
What do you want to achieve?
I want to fill my frame buffer with using gpu_fill_cb.
What have you tried so far?
I can fill my buffer with using tft_flush. I set buf_1 address as LTDC frame buffer (FBStartAdress) address. It is working with flush_cb function, but dest_buf in gpu_fill_cb function can’t fill my frame buffer.
Code to reproduce
static __IO uint16_t * buf_1 = (__IO uint16_t*) ((uint32_t)0xC0000000);
//LTDC FBStartAdress = 0xC0000000;
void tft_init(void)
{
static lv_disp_buf_t disp_buf;
lv_disp_buf_init(&disp_buf, buf_1, NULL, 480 * 272); /*Initialize the display buffer*/
/*-----------------------------------
* Register the display in LittlevGL
*----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/
disp_drv.hor_res = 480;
disp_drv.ver_res = 272;
/*Used to copy the buffer's content to the display*/
disp_drv.gpu_fill_cb = gpu_fill_cb;
/*Set a display buffer*/
disp_drv.buffer = &disp_buf;
/*Finally register the driver*/
disp = lv_disp_drv_register(&disp_drv);
}
void gpu_fill_cb(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color)
{
/*It's an example code which should be done by your GPU*/
uint32_t x, y;
dest_buf += dest_width * fill_area->y1; /*Go to the first line*/
for(y = fill_area->y1; y < fill_area->y2; y++) {
for(x = fill_area->x1; x < fill_area->x2; x++) {
dest_buf[x] = color;
}
dest_buf+=dest_width; /*Go to the next line*/
}
}