Windows CE 触摸屏(TouchPanel)驱动简析(1)-原理及驱动架构

    触摸屏驱动从硬件读取用户输入,然后转换成一个触摸事件发送给GWES.同时将为计算的坐标转换为校准坐标.校准坐标对硬件异常,如触摸倾斜,非线性顺序做了补偿运算.
触摸屏驱动正常工作时,当用户用触摸行为时需要提供该触摸点.当触摸结束时驱动必须提交至少一个事件以通知系统触摸笔已移除.
开发人员可以使用以下步骤来进行对触摸屏进行采样和校准:
                  (1) 调用TouchPanelEnable开始屏幕采样
                  (2) 调用TouchPanelGetDeviceCaps来获取采样点数目
                 (3) 对于每个校准点,进行以下步骤
                 a. 调用TouchPanelGetDeviceCaps来获得一个校准坐标
                 b. 在返回坐标画一个交叉线
                 c. 调用TouchPanelReadCalibrationPoint来获得校准点数据
 调用TouchPanelSetCalibration来计算校准系数.
              当驱动执行完以上顺序后,任何采样数据被传递给TouchPanelEnable定义的回调函数.驱动可以传递校准好的坐标也可以传递未校准的坐标给回调函数.如果驱动有有效的校准算法,可以返回校准好的坐标.如果算法复杂,可以返回未校准坐标以避免在高优先级的驱动线程中进行计算,而是交由较低优先级的驱动回调函数来进行计算.
我们实际上是在应用程序中调用TouchCalibrate来完成触摸屏校准的.

source文件里引用了两个库tch_cal.lib和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)实现了触摸屏的校准算法.下表中的ErrorAnalysis,TouchPanelSetCalibration,TouchPanelCalibrateAPoint在此库中实现
tchmdd.lib(/WINCEROOT/PUBLIC/COMMON/OAK/DRIVERS/TOUCH/TCHMAIN/tchmain.c),实现了其他的touch screen driver functions.
这两个库实际上就是触摸屏的MDD层驱动.
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 notifications.
 
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.
 


而我们需要实现的PDD层驱动则是对应的以下DDSI函数,被对应的MDD层函数调用.
Programming element
                  Description
 
DdsiTouchPanelAttach
                   This function executes when the MDD's DLL entry point receives a DLL_PROCESS_ATTACH message.
 
DdsiTouchPanelDetach
                   This function executes when the MDD's DLL entry point receives 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值