Windows CE touch screen (touchpanel) driver analysis (1)-principle and driving Architecture

Source: Internet
Author: User

The Touch Screen driver reads user input from hardware and then converts it into a touch event and sends it to GWES. at the same time, convert the coordinates of the calculated coordinates to the calibrated coordinates. calibration coordinates compensate for hardware exceptions, such as touch Skew and non-linear order.
When the touch screen driver works properly, the touch point must be provided when the user uses the touch action. When the touch ends, the driver must submit at least one event to notify the system that the touch pen has been removed.
Developers can use the following steps to sample and calibrate the touch screen:
(1) Call touchpanelenable To Start Screen sampling
(2) Call touchpanelgetdevicecaps to obtain the number of sampling points
(3) perform the following steps for each admission point:
A. Call touchpanelgetdevicecaps to obtain a calibration coordinate.
B. Draw a cross line in the return Coordinate
C. Call touchpanelreadcalibrationpoint to obtain the on-site data.
Call touchpanelsetcalibration to calculate the calibration coefficient.
After the driver completes the preceding steps, any sampling data is passed to the callback function defined by touchpanelenable. the driver can transmit calibrated coordinates or un-calibrated coordinates to the callback function. if the driver has an effective calibration algorithm, the calibrated coordinates can be returned. if the algorithm is complex, the UN-calibrated coordinates can be returned to avoid calculation in the high-priority driver thread. Instead, the calculation is performed by the lower-priority driver callback function.
We actually call touchcalibrate in the application to complete touch screen calibration.

The source file references the two libraries tch_cal.lib and tchmdd. Lib.
Sourcelibs =/
$ (_ Commonoakroot)/lib/$ (_ cpuindpath)/tch_cal.lib/
$ (_ Commonoakroot)/lib/$ (_ cpuindpath)/tchmdd. lib/
Tch_cal.lib (/winceroot/public/common/oak/Drivers/touch/tch_cal) implements touch screen calibration algorithms. The following table describes erroranalysis, touchpanelsetcalibration, and touchpanelcalibrateapoint.
Tchmdd. Lib (/winceroot/public/common/oak/Drivers/touch/tchmain. c) implements other touch screen driver functions.
These two libraries are actually the MDD layer driver of the touch screen.
Programming Element
Description
Erroranalysis
This function provides information on the accuracy of the touch screen calibration.
 
Touchcalibrate
This function starts the touch screen calibration sequence.
 
Touchpanelcalibrateapoint
This function converts noncalibrated points to calibrated points.
 
Touchpaneldisable
This function disables the touch screen.
 
Touchpanelenable
This function enables and re-enables the touch screen.
 
Touchpanelgetdevicecaps
This function returns information about the capabilities of the touch screen.
 
Touchpanelinitializecursor
This function provides an opportunity for touch drivers to move the cursor at initialization time.
 
Touchpanelpowerhandler
This function Handles power-state change configurations.
 
Touchpanelreadcalibrationabort
This function aborts the currently active call to the touchpanelcalibrateapoint function.
 
Touchpanelreadcalibrationpoint
This function initiates the process of getting a calibration point.
 
Touchpanelsetcalibration
This function initializes calibration information in a global parameter vcalcparam, which you can use to convert noncalibrated points to calibrated points by the touchpanelcalibrateapoint function.
 
Touchpanelsetmode
This function sets mode information for a touch screen device.
 

The PDD-layer driver we need to implement is the corresponding ddsi function, which is called by the corresponding MDD-layer function.
Programming Element
Description
 
Ddsitouchpanelattach
This function executes when the MDD's dll entry point when es a dll_process_attach message.
 
Ddsitouchpaneldetach
This function executes when the MDD's dll entry point when es a dll_process_detach message.
 
Ddsitouchpaneldisable
This function disables the touch screen device.
 
Ddsitouchpanelenable
This function applies power to the touch screen device and initializes it for operation.
 
Ddsitouchpanelgetdevicecaps
This function queries capabilities of the touch screen device.
 
Ddsitouchpanelgetpoint
This function returns the most recently acquired point and its associated tip state information.
 
Ddsitouchpanelpowerhandler
This function indicates to the driver that the system is entering or leaving the suspend state.
 
Ddsitouchpanelsetmode
This function sets information about the touch screen device.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.