Calibration of the Digitizer Driver is required to convert between digitiser ADC values and screen coordinates.

Calibration is done through a user-side calibration application.

The platform specific layer performs the following calculation to convert between ADC values and co-ordinates:

Where the R matrix determines the scaling and rotation, and the T vector determines the translation.

This conversion is implemented by the platform specific layer's implementation of DDigitiser::DigitiserToScreen() and DDigitiser::ScreenToDigitiser(). Default implementations are provided by the template port. Note, however, that in these implementations, the calculation is slightly more complex because screen coordinate values are left shifted 16 bits. This allows the operations to use integer divisions without loosing precision.

All that you need to do is to provide an initial set of values for R and T. An example of how to set them up is included in the template port.

The principle is that the application draws cross hairs on the screen, and then invites the user to touch these points. The digitiser ADC value is used to calculate the digitiser to screen pixel value transformation.

Any calibration code will interface with the User-Side Hardware Abstraction component using four UserHal functions.

On a cold restart, the calibration application goes through the following steps:

On a warm restart, the calibration application just restores calibration data using UserHal::RestoreXYInputCalibration().