The touch screen driver reads input from the touch screen hardware and converts it to touch events that are fed into the input system. The driver is also responsible for converting uncalibrated coordinates to calibrated coordinates that take into account any hardware anomalies, such as skew or nonlinearity. This calibration is generally done when the driver is first loaded, after a cold startup of a Windows CE–based platform. The sample code appears under \Platform\ODO\Drivers\Touchp.
The driver must submit points while the stylus is touching the touch screen. When the stylus is removed from the touch screen, the driver must submit at least one final event indicating that the stylus tip was removed. The calibrated coordinates must be reported to the nearest one-fourth pixel.
The following pseudocode example shows the calibration algorithm.
TouchPanelEnable(...); // Start the panel sampling.
TouchPanelGetDeviceCaps(...); // Request number of calibration points.
for (i=0; i<# points; i++)
{
TouchPanelGetDeviceCaps(...); // Get a calibration coordinate.
//Draw crosshair at returned coordinate.
TouchPanelReadCalibrationPoint(...); // Get calibration data.
}
TouchPanelSetCalibration(...); // Calculate calibration coefficients.
After calibration, the touch screen driver sends any pen samples generated for the touch screen to the callback function specified in the TouchPanelEnable function. The driver must pass calibrated points to the callback function.
The following table shows the DDI functions for the touch screen driver.
The following table shows the DDSI functions for the touch screen driver.
DdsiTouchPanelDisable |
DdsiTouchPanelEnable |
DdsiTouchPanelGetDeviceCaps |
DdsiTouchPanelGetPoint |
DdsiTouchPanelPowerHandler |
TouchDriverCalibrationPointGet |
DdsiTouchPanelSetMode |