How to initialize "disp_drv.flush_cb"

Though I have ported lvgl to a monochrome display (referring (https://forum.lvgl.io/t/porting-lvgl-to-a-monochrome-display/294)) and i works normally , I am still confused about **disp_drv.flush_cb = my_disp_flush; **,flush_cb need a parameter of type *lv_color_t **, and I think it refers to the really pixel values(RGB components) ,
I don’t know how the lvgl library uses the paramter and is it necessary a conversion if the pixel using some other color format. I am confused!

Normally you get RGB values in the color pointer and you need to convert them to the required format.

However with monochrome displays there 2 features that can help a lot:

  • set_px_cb: LVGL will call it to write pixels in the display buffer. This way you can handle any special color formats. In this case, you can cast the color pointer to e.g. to uint8_t *.
  • round_cb you can round the size of every redrawn area. E.g. if you can refresh only 8 pixels at once, you can round the x or y coordinates.

See more here: https://docs.lvgl.io/latest/en/html/porting/display.html#display-driver