Lvgl initialization and flush function

Description

What MCU/Processor/Board and compiler are you using?

  • ATmel sam9m10

What do you want to achieve?

  • I initialized lvgl and created a flush function but it does not work
    (lv_task_handler () in main function, lv_tick_inc (5) on timer… but LCD does not work now)
    I tried to output “call” to check the function of flush function but it didn’t work
    I wonder what’s wrong with the initialization…
    Please help me

What have you tried so far?

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*You code here*/

void lv_init_m(void)
{
/*Initialize disp_buf with the buffer(s) /
lv_disp_buf_init(&disp_buf, buf_1, buf_2, BOARD_LCD_WIDTH
BOARD_LCD_HEIGHT);
lv_disp_drv_init(&disp_drv); /Basic initialization/

// disp_drv.hor_res = LV_HOR_RES_MAX;
// disp_drv.ver_res = LV_VER_RES_MAX;
disp_drv.buffer = &disp_buf; /Set an initialized buffer/
disp_drv.flush_cb = my_flush_cb; /Set a flush callback to draw to the display/
lv_disp_t * disp;
disp = lv_disp_drv_register(&disp_drv); /Register the driver and save the created display objects/
}

void my_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/The most simple case (but also the slowest) to put all pixels to the screen one-by-one/
int32_t x, y;
unsigned char pBuffer_myflush[BOARD_LCD_WIDTH * BOARD_LCD_HEIGHT];

for(y = area->y1; y <= area->y2; y++) {
    for(x = area->x1; x <= area->x2; x++){
        LCDD_DrawPixel(pBuffer_myflush,x, y, (unsigned int)color_p);
        color_p++;
    }
}
dbgu_printf("call");

LCDD_DisplayBuffer(pBuffer_myflush);

/* IMPORTANT!!!
 * Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);

}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

you are printing the pointer to the pixeldata, it need to be derefenced like in the original sample:

            DrawPixel(x, y, *((uint32_t *)color_p));

And when the 2nd buffer is not used, you should pass null for it. Or is it initialized with null?

lv_disp_buf_init(&disp_buf, buf_1, null, BOARD_LCD_WIDTH * BOARD_LCD_HEIGHT);