I have a Raspberry Pi with a 7 inch HDMI touch screen. I can rotate the screen by adding the following into the /boot/config.txt:
display_hdmi_rotate=2
However I am struggling to get the touch co-ordinates to rotate properly as well.
What MCU/Processor/Board and compiler are you using?
Pi Zero 2W
What LVGL version are you using?
8.3.9
What do you want to achieve?
I would like to rotate the touch co-ordinates to match the screen, IE rotated by 180 degrees.
What have you tried so far?
I have tried changing the following:
# define EVDEV_CALIBRATE 1 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
# if EVDEV_CALIBRATE
# define EVDEV_HOR_MIN 0 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/
# define EVDEV_HOR_MAX 2000 /*"evtest" Linux tool can help to get the correct calibraion values>*/
# define EVDEV_VER_MIN 20
# define EVDEV_VER_MAX 2000
# endif /*EVDEV_CALIBRATE*/
#endif /*USE_EVDEV*/
to:
# define EVDEV_CALIBRATE 1 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
# if EVDEV_CALIBRATE
# define EVDEV_HOR_MIN 2000 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/
# define EVDEV_HOR_MAX 0 /*"evtest" Linux tool can help to get the correct calibraion values>*/
# define EVDEV_VER_MIN 2000
# define EVDEV_VER_MAX 0
# endif /*EVDEV_CALIBRATE*/
#endif /*USE_EVDEV*/
But it looks like when I do press anything it always assumes that the touch co-ordinates are at the top left (0,0).
I’ve looked to see if there is a way to do this outside of LVGL but it seems like the only options would be to alter the xorg config, as I am not using xorg this isn’t really an option.
I have some other machines using different lv_drivers to the one I just cloned, once I copied one of those over with the corrected inverse defines it worked as expected.