Hello everyone,
I’ve recently been helped while setting up lvgl on a 240x128 monochrome display. In the end the issues I was encountering were tied to a basic misunderstanding of the library interface, so I would like to recap what I now know to be sure it is correct.
In my first approach, I was under the impression that the buffer specified in lv_disp_buf_init was a to have a direct correlation with the actual screen: if I wanted to draw a label in position 10,20 on the screen the buffer should have been populated with said label in that position setting pixel by pixel with the set_px_cb function; then the flush_cb would have notified my to flush that area of the buffer on the display. I ignored the lv_color_t *color_p parameter of the flushing callback.
As I now understand it, the buffer specified in the initialization need not to have any correlation with the screen; it is merely a memory range that the library can use for graphic computations. The set_px_cb callback asks me to set a pixel in a part of that buffer and the same part is passed to the flush_cb callback through the last parameter (the one I was previously ignored). My job is to flush that part of the initial buffer into the display as needed.
After the lv_disp_buf_init call I can forget about the initial buffer reference and work only with pointers the littlevgl callbacks passes me.
Is everything correct?