Windows CE 觸控螢幕(TouchPanel)驅動簡析(1)-原理及驅動架構

來源:互聯網
上載者:User

    觸控螢幕驅動從硬體讀取使用者輸入,然後轉換成一個觸摸事件發送給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.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.