Skip to content

Touch Calibration Import

Calvin Hass edited this page Feb 3, 2019 · 1 revision

Overview > Configuring GUIslice > Touch >

Importing calibration settings from other libraries

It is strongly recommended that the GUIslice calibration sketch (/examples/arduino/diag_ard_touch_calib) is run on your display to generate the necessary calibration settings for resistive touch displays. However, it is also possible to import settings output from other library calibration sketches:

mcufriend_kbv calibration

The mcufriend_kbv library includes a calibration sketch: TouchScreen_Calibr_native. To load this utility, ensure the Arduino IDE serial monitor is connected, select File → Examples → MCUFRIEND_kbv → TouchScreen_Calibr_native and then Upload.

There are two parts of the output: the detected pin configuration and the calibration settings.

image

...

image

Pin settings

Take note of the XP, XM, YM, YP pin values.

  • In this example, they are 6, A2, A1 and 7 respectively.
  • Place these values into the corresponding ADATOUCH_PIN_*settings in your GUIslice config file:
  • image

Calibration settings

In the output, take note of the TS_LEFT, TS_RT, TS_TOP, TS_BOT values.

  • Place these values into These can be assigned to the GUIslice config settings shown below:
  • #define ADATOUCH_X_MIN {TS_LEFT value}
  • #define ADATOUCH_Y_MIN {TS_TOP value}
  • #define ADATOUCH_X_MAX {TS_RT value}
  • #define ADATOUCH_Y_MAX {TS_BOT value}
  • Using the example above, we would record the following into your GUIslice config file. Pay special attention to the order of these settings as they differ from the order shown in the MCUFRIEND output.
  • image

Adafruit-GFX calibration

Displays such as the Adafruit 2.8" resistive TFT require calibration. Adafruit has described this calibration on their Touchscreen paint demo documentation page.

The Adafruit calibration settings can be assigned to the GUIslice config settings shown below:

  • #define ADATOUCH_X_MIN {TS_MINX value}
  • #define ADATOUCH_Y_MIN {TS_MINY value}
  • #define ADATOUCH_X_MAX {TS_MAXX value}
  • #define ADATOUCH_Y_MAX {TS_MAXY value}
Clone this wiki locally