I use the iot_button library in ESP32 to obtain key events for this library (click, double-click, long press, triple click, etc.);
But due to the limitations of the iot_button library, I am unable to retrieve events such as BUTTON_SINGLE_CLICK, BUTTON_DOUBLE_CLICK, BUTTON_MULTIPLE_CLICK, etc. in read_cb.
Therefore, I want to send events to Indev in the callback function of the iot_button, My Indev configuration is as follows:
lv_indev_t *keyboard = lv_indev_create();
lv_indev_set_type(keyboard, LV_INDEV_TYPE_KEYPAD);
// lv_indev_set_read_cb(keyboard, keyboard_read_cb);
lv_indev_set_mode(keyboard, LV_INDEV_MODE_EVENT);
The code for sending the event is as follows:
lv_result_t result = lv_indev_send_event(keyboard, LV_EVENT_KEY, LV_KEY_NEXT);
ESP_LOGI("LV", "lv_indev_send_event_result: %d", result);
I obtained in the log:
LV: lv_indev_send_event_result: 1
But it didn’t work.
I also tried lv_indev_send_event(keyboard, LV_EVENT_CLICKED, NULL);
, It also doesn’t work.