Hi,
I have been trying to build a simple touch screen project with esp-idf 5.2 and 2432s028 board.
I have intended to use ESP32-Cheap-Yellow-Display/Examples/ESP-IDF/LVGL9 at 58d41526081b5bb28a6fb76e1a9c87eb1f801fb0 · witnessmenow/ESP32-Cheap-Yellow-Display · GitHub project as starting point however the touch panel does not fire a touch event.
- I tested the touch pad with LCD_Touch example and it is working
- hardware.h seems to be correct for pin mapping
- tp object is not NULL,
- compiler does not give an error
- changing some configuration from the menuconfig for XPT2046 but no luck
Does anybody have a chance to test with similar configuration ?
void ui_event_Screen(lv_event_t *e)
{
LV_LOG_USER("Event");
static uint8_t cnt=1;
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t *btn = (lv_obj_t *)lv_event_get_user_data(e);
if (event_code == LV_EVENT_CLICKED)
{
LV_LOG_USER("Click Event");
cnt++;
if (cnt > 9) cnt=1;
/*Get the first child of the button which is the label and change its text*/
lv_obj_t * label = lv_obj_get_child(btn, 0);
lv_label_set_text_fmt(label, "Button: %d", cnt);
}
}
static esp_err_t app_lvgl_main(void)
{
lv_obj_t *scr = lv_scr_act();
lvgl_port_lock(0);
//--other display objects---//
// Touch action managements
lv_obj_t *btn_counter = lv_button_create(scr);
lv_obj_set_size(btn_counter, 100, 40);
lv_obj_align(btn_counter, LV_ALIGN_BOTTOM_MID, 0, -10);
lv_obj_add_event_cb(btn_counter, ui_event_Screen, LV_EVENT_ALL, NULL);
lv_obj_t * label = lv_label_create(btn_counter);
lv_label_set_text(label, "Button");
lv_obj_center(label);
lvgl_port_unlock();
}