What MCU/Processor/Board and compiler are you using?
Variscite IMX8MM on a custom carrier board. I am using GCC to compile
What LVGL version are you using?
9.3
What do you want to achieve?
I want my touch screen input device to work with lvgl 9.3
What have you tried so far?
I have LVGL 8.3 working great with my input device using the following code:
/*Linux frame buffer device init*/
fbdev_init();
/*A small buffer for LittlevGL to draw the screen's content*/
static lv_color_t buf[DISP_BUF_SIZE];
/*Initialize a descriptor for the buffer*/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);
/*Initialize and register a display driver*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
disp_drv.hor_res = 720;
disp_drv.ver_res = 1280;
disp_drv.full_refresh = 0;
lv_disp_drv_register(&disp_drv);
// lv_color_t color = lv_color_make(255, 255, 255);
// lv_disp_set_bg_color(disp_drv, color);
/* Linux input device init */
evdev_init();
/* Set up touchpad input device interface */
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = evdev_read;
lv_indev_drv_register(&indev_drv);
Code to reproduce
I have switched my code base to LVGL 9.3 and I am trying to use the following code provided by the documentation to use the same input device.
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
I started poking around in lv_evdev.c and found the _evdev_process_pointer function.
This function assigns the x and y values to an lv_point_t after running it through the _evdev_calibrate function. That function seems to be mangling the input. Changing the following lines gives me a working input device:
Started looking through pull requests for “calibration” and found this:
Which led me to the lv_evdev_set_calibration function so that I can override the ABS_X and ABS_Y values of the touch panel that I am using. This makes it so I don’t have to modify the LVGL source.