QRcode on legacy LVGL (v5.3)


I need to use QRcode lib in old LVGL (5.3).
Right now QR lib uses lv_canvas for handling all drawings. But in 5.3 was little different APIs for canvas and my image looks like this:

What do you want to achieve?

Use QRcode lib on LVGL 5.3

What have you tried so far?

I have ported all APIs that is using in QR code lib from LVGL 6.1.2

But my result image looks wrong (see image from above), I’m not sure if this is problem with colors only.

In this topic https://forum.lvgl.io/t/qrcode-display-with-littlevgl/71 was mentioned that need manually set fisrt bytes for color.

But I need some little more clarification if possible…

My LV_CANVAS_BUF_SIZE_INDEXED_1BIT macro expands to next:

(((((size / 8) + 1) * size)) + 4 * 2)

Size is 100, so it gives 1308 in final calculation:


Im trying to use QR as per in example:

void test_qr()
    lv_obj_t * scr  = lv_obj_create(NULL, NULL);

    const char * data = "Hello world";

    /*Create a 100x100 QR code*/
    lv_obj_t * qr = lv_qrcode_create(lv_scr_act(), 100, lv_color_hex3(0x33f), lv_color_hex3(0xeef));

    /*Set data*/
    lv_qrcode_update(qr, data, strlen(data));