Technical dry goods: touch screen driver under WinCE 7.0

A commonly used four-wire Resistive Touch Screen in embedded systems determines the position of the contacts by detecting the voltages of the x-axis and the y-axis. The general Touch Screen system structure is: touch screen -> touch screen controller -> processor.

Wince7 touch screen drivers are divided into PDD layer (located in the bsp directory) and MDD layer (located in the public directory). The PDD layer and the MDD layer are connected by a DDSI interface function, and the MDD layer and the upper layer are connected by a DDI function. The MDD layer generally does not need to be modified, we only need to modify the code of the PDD layer.

For example, the touchscreenpdd.cpp file in the touch screen driver in my bsp directory mainly has the following functions:

TchPdd_Init()

TchPdd_Ioctl()

PDDTouchIST()

PDDIniTIalizeHardware()

PDDTouchPanelEnable()

PDDTouchPanelGetPoint()

PDDCalibraTIonThread()

PDDStartCalibraTIonThread()

PDDDeInitailzeHardware()

PDDTouchPanelDisable()

The function at the beginning of TchPdd is the DDSI function, and the function at the beginning of PDD is the function of the PDD layer. The MDD layer will first call the TchPdd_Init() function, which will pass the DDSI function as a function pointer to the MDD layer and call the PDD layer function to perform the necessary initialization, such as calling PDDIniTIalizeHardware() to initialize the SPI, GPIO (I The touch screen controller uses the SPI interface), calls PDDTouchPanelEnable() to create a "touchscreen event", creates an IST thread, and so on.

There is a while loop in the IST thread function PDDTouchIST(), as shown in the following figure:

Technical dry goods: touch screen driver under wince7

There is a WaitForSingleObject(,) function in the loop. The function has two parameters, the first parameter is the handle of the "touch screen event", and the second parameter is used to set the time to wait for the timeout. The IST thread execution to this function will wait for a "touchscreen event" to occur or time out. When one of these two conditions occurs, the thread will execute below and call the PDDTouchPanelGetPoint() function to read the contact coordinates. The timeout period is set to wait indefinitely before the "touchscreen event" occurs. Only when the "touch screen event" occurs (contact is pressed) will start reading the coordinates, and judge whether it is still pressed, if it is still pressed, then the timeout will be set to a certain finite value, so when WaitForSingleObject waits After the time exceeds this value, the coordinates will be read. This mechanism ensures that we can read the trajectory of the contact movement.

Of course, if you want to use the "touch screen event", you must have a touch screen interrupt (when the contact is pressed, this interrupt occurs), and this interrupt is associated with the "touch screen event", so that the "touch screen" will be triggered after the interruption occurs. event".

There is also a method: without using interrupts, the polling method is used to directly read the coordinates, and the legality of the coordinate values ​​is read to determine whether there is a contact press. In this way, the first parameter of WaitForSingleObject will not work, and the second parameter must be set to a finite value, which determines the frequency of polling.

Our interactive touch foil is a new, transparent  touch film ,with high accuracy ,easy to install on the glass,Acrylic ,or PC.It widely uesd to shipping mail,Education ,Exhibition,Hotel ,Airport etc.Our company is a top level company which grasp the technology for capacitive touch foil.Capacitive Touch Foil is also called "touch film", nano touch foil, which is a grid matrix layer composed of two thin films with a layer of X and Y axis interlaced nanowires.It can through the glass or other objects to touch just like gesture.These smart touch foil by customers love and satisfaction.

pictures show:

Multi Touch Foil

Capacitive Touch Foil

Projection Touch Screen Foil

Nano Touch Film

Touch Foil with Controller

USB Capacitive Touch Film


Interactive Touch Foil

Multi Touch Foil,Capacitive Touch Foil,Projection Touch Screen Foil,Nano Touch Film,Touch Foil with Controller,USB Capacitive Touch Film

ShenZhen GreenTouch Technology Co.,Ltd , https://www.bbstouch.com