Hardware Button - clicked / long press

Description

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

Framebuffer linux

What LVGL version are you using?

8.3.9

How to implement using LV_INDEV_TYPE_BUTTON, to be able to have events such as:

LV_EVENT_CLICKED
LV_EVENT_LONG_PRESSED
LV_EVENT_LONG_PRESSED_REPEAT

The routine that gpio returns:

0 - BTN Released
1 - BTN Clicked
2 - BTN Long-Press

Hi,

I don’t understand, what is your question?

I would like that after pressing button by long_press_timeout

send the LV_EVENT_LONG_PRESSED event

I can’t have the LV_EVENT_LONG_PRESSED event

only from LV_EVENT_CLICKED / LV_EVENT_PRESSED

using this example:

static void event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * label = lv_event_get_user_data(e);

switch(code) {
    case LV_EVENT_PRESSED:
        lv_label_set_text(label, "The last button event:\nLV_EVENT_PRESSED");
        break;
    case LV_EVENT_CLICKED:
        lv_label_set_text(label, "The last button event:\nLV_EVENT_CLICKED");
        break;
    case LV_EVENT_LONG_PRESSED:
        lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED");
        break;
    case LV_EVENT_LONG_PRESSED_REPEAT:
        lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT");
        break;
    default:
        break;
}

}