Description
when i porting LVGL to my project,i test with example code,but Flush_cb() can’t be called.
What MCU/Processor/Board and compiler are you using?
THM3682FAQD
What LVGL version are you using?
V7.10.0
What do you want to achieve?
i just want to test LVGL and display “hello word” on LCD screen.
What have you tried so far?
i tried sample code on lvgl website
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
void task()
{
lv_init();
hal_init();
lv_demo();
while()
{
lv_task_handler();
lv_tick_inc(10);
sleep(100);
}
}
static void hal_init()
{
//disp_init();
lv_disp_buf_t draw_buf_dsc_1; /*A buffer for 10 rows*/
lv_color_t draw_buf_1[1024];
lv_disp_buf_init(&draw_buf_dsc_1, draw_buf_1, NULL, 1024); /*Initialize the display buffer*/
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 = LV_HOR_RES_MAX;
disp_drv.ver_res = LV_VER_RES_MAX;
/*Used to copy the buffer's content to the display*/
disp_drv.flush_cb = Flush_cb;
/*Set a display buffer*/
disp_drv.buffer = &draw_buf_dsc_1;
#if LV_USE_GPU
/Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)/
/*Blend two color array using opacity*/
disp_drv.gpu_blend_cb = gpu_blend;
/*Fill a memory array with a color*/
disp_drv.gpu_fill_cb = gpu_fill;
#endif
/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);
}
volatile u8 *FrameBuffer = (u8 *)0x2003C000;
static void Flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
u32 y;
u32 x;
for(y = area->y1; y <= area->y2 && y <disp_drv->ver_res; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
//pDisp[y *disp_drv->hor_res + x] = (u32)lv_color_to32(*color_p);
FrameBuffer[y *disp_drv->hor_res + x] = (u32)lv_color_to32(*color_p);
color_p++;
}
}
lark_lcd_write(LCD_NORMAL,area->x1, area->y1, x, y, FrameBuffer);//my lcd driver function
lv_disp_flush_ready(disp_drv);
}
static void lv_demo()
{
lv_obj_t * scr = lv_disp_get_scr_act(NULL);
lv_obj_t * label1 = lv_label_create(scr, NULL);
lv_label_set_text(label1, “Hello\nworld”);
lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.