Description
I have successfully followed the tutorial on the stm32mp wiki to run the demo code for lv_port_pc_eclipse on STM32MP157F-DK2 using configuration 2. I am trying to upgrade the LVGL version to v9 and have done so successfully except for the configuration of the touchscreen. The touchscreen was working well when I used v8.1. I am new to LVGL and the only experience I have configuring the input devices myself is from using the lv_sdl_(window, mouse, mousewheel, keyboard)_create() functions in v9.
What MCU/Processor/Board and compiler are you using?
Board: STM32MP157F-DK2
IDE: STM32CubeIDE
Processor: STM32MP157FAC1
What do you want to achieve?
I would like to configure the touchscreen capability on this board using LVGL v9.
What have you tried so far?
I have attempted to configure a touchscreen input device by following the LVGL master documentation.
The code below is what the documentation provides:
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_...);
lv_indev_set_read_cb(indev, read_cb);
void read_cb(lv_indev_t * indev, lv_indev_data_t*data)
{
if(touchpad_pressed) {
data->point.x = touchpad_x;
data->point.y = touchpad_y;
data->state = LV_INDEV_STATE_PRESSED;
} else {
data->state = LV_INDEV_STATE_RELEASED;
}
}
The code below is what I am using:
lv_indev_t* touchpad = lv_indev_create();
lv_indev_set_type(touchpad, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(touchpad, touchpad_read_cb);
lv_indev_set_display(touchpad, disp); //disp=lv_sdl_window_create(SDL_HOR_RES, SDL_VER_RES)
lv_indev_enable(touchpad, true);
static void touchpad_read_cb(lv_indev_t * indev, lv_indev_data_t*data)
{
lv_indev_data_t* read_data = lv_indev_get_driver_data(indev);
if(lv_indev_get_state(indev) == LV_INDEV_STATE_PR) {
data->point = read_data->point;
data->state = LV_INDEV_STATE_PR;
} else {
data->state = LV_INDEV_STATE_REL;
}
}
I am unsure of how to proceed.