Widgets are not responding to my touch

Description

Hi guys,
I am trying to transplant LVGL to STM32H750Disco. I have made my LCD and touch pad working. It can display the button with the button example code listed below. But the button widget doesn’t respond to my click, it doesn’t change at all. I can only see the output “Clicked” and “Toggled” from the serial port, which shows my touch pad driver works fine. Is there anything I did wrong? Thanks.

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

STM32H750Disco

What LVGL version are you using?

V7.10

What do you want to achieve?

What have you tried so far?

Code to reproduce

static void event_handler(lv_obj_t * obj, lv_event_t event)
{
    if(event == LV_EVENT_CLICKED) {
        printf("Clicked\n");
    }
    else if(event == LV_EVENT_VALUE_CHANGED) {
        printf("Toggled\n");
    }
}

void lv_ex_btn_1(void)
{
    lv_obj_t * label;

    lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);
    lv_obj_set_event_cb(btn1, event_handler);
    lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40);

    label = lv_label_create(btn1, NULL);
    lv_label_set_text(label, "Button");

    lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL);
    lv_obj_set_event_cb(btn2, event_handler);
    lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
    lv_btn_set_checkable(btn2, true);
    lv_btn_toggle(btn2);
    lv_btn_set_fit2(btn2, LV_FIT_NONE, LV_FIT_TIGHT);

    label = lv_label_create(btn2, NULL);
    lv_label_set_text(label, "Toggled");
}

Screenshot and/or video

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

Sounds like an issue with your display driver. Can you post your flush_cb implementation?

Thank you for your reply. Here is my flush_cb

static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
	/* Calculate the offset in the framebuffer and the length of data to copy */
	uint32_t u32DstAddress = LCD_FB_OFFSET + (((area->x2 + 1) * area->y1) + area->x1) * 2;

	uint32_t u32DataLength = (area->x2 + 1 - area->x1) * (area->y2 + 1 - area->y1) / 2;

	HAL_DMA_Start(&M2M_DMA, (uint32_t)color_p, u32DstAddress, u32DataLength);

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

By the way my first screen shows properly.

Hi embeddedt,

You are right, the problem is with my flush_cb, I tried to use for loop to copy the data, it works! Thank you very much.