Calibrate a touchscreen with tpcal.h

Finally I doesn’t change my driver with a function but I adapt #define in lv_drv_conf.h file to have a good calibration.

This is my screen resolution

/* Horizontal and vertical resolution of the library.*/
#define LV_HOR_RES          (800)
#define LV_VER_RES          (480)

This is my adaptation

#  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                    /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
#    define EVDEV_HOR_MAX   4000
#    define EVDEV_VER_MIN   0
#    define EVDEV_VER_MAX   4000
#  endif  /*EVDEV_SCALE*/
#endif  /*USE_EVDEV*/
1 Like