3733|5

72

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

我要写WinCE下人触摸屏校准 可是没有tchddi.h文件 [复制链接]

是基于ARM上的WINCE写的
想调用Windows API去写  不想用WinCE自带的校准程序

基本步骤查得:


  1. The following steps detail the basic algorithm for using the touch screen:

  2. Call TouchPanelEnable to start the screen sampling.
  3. Call TouchPanelGetDeviceCaps to request the number of sampling points.
  4. For every calibration point, perform the following steps:
  5. Call TouchPanelGetDeviceCaps to get a calibration coordinate.
  6. Draw a crosshair at the returned coordinate.
  7. Call TouchPanelReadCalibrationPoint to get calibration data.
  8. Call TouchPanelSetCalibration to calculate the calibration coefficients.
  9. After executing this sequence, any finger or stylus samples generated for the screen are passed to the callback function specified in TouchPanelEnable. The driver may pass either calibrated or uncalibrated points to the callback. If the driver has an efficient calibration algorithm, it can return calibrated points. However, if the calibration is computationally intensive, the driver may choose to return uncalibrated points, rather than perform extensive calculations in the high-priority driver thread. The lower priority thread processing points from the callback can then perform the calibration.

  10. You can calibrate your touch screen without the ENTER key. The GWES keyboard code opens HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPKEYBD and looks for a DWORD value called Status. This is a bit mask combining the KBDI_KEYBOARD_XXX values from %_WINCEROOT%PublicCommonSDKINCKeybd.h. If it is not found, GWES assumes KBDI_KEYBOARD_PRESENT | KBDI_KEYBOARD_ENTER_ESC | KBDI_KEYBOARD_ALPHA_NUM. This registry access only occurs once, when the keyboard driver is loaded. This value is the basis for what you get when you call GetKeyboardStatus. GWES will add or subtract the KBDI_KEYBOARD_ENABLED bit based on EnableHardwareKeyboard calls. The KBDI_KEYBOARD_ENABLED bit is set when the keyboard driver is loaded. The UseEnterEsc behavior can be controlled by a registry key.

  11. The following table shows the touch screen driver functions.
复制代码


有没有具体的示例给我看一下???
tchddi.h文件找到了
此帖出自WindowsCE论坛

最新回复

……是自己建个tchddi.h空文件把2楼的一堆粘上就能用了么……  详情 回复 发表于 2009-3-4 11:16
点赞 关注
 

回复
举报

72

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
具体步骤如下

The following steps detail the basic algorithm for using the touch screen:

Call TouchPanelEnable to start the screen sampling.
Call TouchPanelGetDeviceCaps to request the number of sampling points.
For every calibration point, perform the following steps:
Call TouchPanelGetDeviceCaps to get a calibration coordinate.
Draw a crosshair at the returned coordinate.
Call TouchPanelReadCalibrationPoint to get calibration data.
Call TouchPanelSetCalibration to calculate the calibration coefficients.
After executing this sequence, any finger or stylus samples generated for the screen are passed to the callback function specified in TouchPanelEnable. The driver may pass either calibrated or uncalibrated points to the callback. If the driver has an efficient calibration algorithm, it can return calibrated points. However, if the calibration is computationally intensive, the driver may choose to return uncalibrated points, rather than perform extensive calculations in the high-priority driver thread. The lower priority thread processing points from the callback can then perform the calibration.

You can calibrate your touch screen without the ENTER key. The GWES keyboard code opens HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPKEYBD and looks for a DWORD value called Status. This is a bit mask combining the KBDI_KEYBOARD_XXX values from %_WINCEROOT%PublicCommonSDKINCKeybd.h. If it is not found, GWES assumes KBDI_KEYBOARD_PRESENT | KBDI_KEYBOARD_ENTER_ESC | KBDI_KEYBOARD_ALPHA_NUM. This registry access only occurs once, when the keyboard driver is loaded. This value is the basis for what you get when you call GetKeyboardStatus. GWES will add or subtract the KBDI_KEYBOARD_ENABLED bit based on EnableHardwareKeyboard calls. The KBDI_KEYBOARD_ENABLED bit is set when the keyboard driver is loaded. The UseEnterEsc behavior can be controlled by a registry key.

The following table shows the touch screen driver functions.
此帖出自WindowsCE论坛
 
 
 

回复

64

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name:

tchddi.h

Abstract:

    This module contains all the definitions for the DDI (Device Driver
    Interface) for the touch panel device.

Notes:


--*/
/*++

@doc EX_TOUCH_DDI EXTERNAL DRIVERS DDI TOUCH_PANEL

    This module contains all the definitions for the DDI (Device Driver
    Interface) for the touch panel device.

--*/

#ifndef __TCHDDI_H__
#define __TCHDDI_H__

#ifdef __cplusplus
extern "C" {
#endif

//
// Definitions
//




/*      @TYPE   TOUCH_PANEL_SAMPLE_FLAGS |

These flags specify information about a given touch sample sent to the input system.

See Also:


*/
typedef UINT32 TOUCH_PANEL_SAMPLE_FLAGS, *P_TOUCH_PANEL_SAMPLE_FLAGS;

/*                @ENUM        enumTouchPanelSampleFlags | The specific values of the touch sample flags.

                @XREF
                               

                @COMM

The TouchSampleValidFlag is set to indicate a valid reading.  The driver
is allowed to report back an invalid reading to the input system (which
will be ignored) but these should be kept to an absolute minimum.

The TouchSampleDownFlag shows the state of finger or stylus.  When the
finger or stylus is pressed to the touch screen, the driver will be
reporting back readings with both the valid and down flags set.  When the
stylus or finger is removed from the touch screen, the driver is REQUIRED
to send back at least one reading with the valid flag set but the down
flag cleared to indicate that the stylus/finger is up.

The TouchSampleIsCalibratedFlag is set by the driver to notify the input
system that it is not necessary to further calibrate the XY coordinates of
the sample.

The TouchSamplePreviousDownFlag shows the state from the previous valid
sample.  It is not necessary for the driver to report this to the input
system but it is useful in the driver itself.

*/
enum enumTouchPanelSampleFlags
{
        TouchSampleValidFlag                        = 0x01,                //@EMEM        The sample is valid.
        TouchSampleDownFlag                                = 0x02,                //@EMEM        The finger/stylus is down.
        TouchSampleIsCalibratedFlag                = 0x04,                //@EMEM        The XY data has already been calibrated.
        TouchSamplePreviousDownFlag                = 0x08,                //@EMEM        The state of the previous valid sample.
    TouchSampleIgnore                                = 0x10,     //@EMEM Ignore this sample.

        TouchSampleMouse                                = 0x40000000        //        reserved

};

#define TouchSampleDown(Flags)          (Flags&TouchSampleDownFlag)
#define TouchSamplePreviousDown(Flags)  (Flags&TouchSamplePreviousDownFlag)
#define TouchSampleIsMouse(Flags)                (Flags&TouchSampleMouse)

//
// TouchPanelGetDeviceCaps query capability definitions
//

// @const ULONG | TPDC_SAMPLERATE_ID |
// Sampling rate device capability.
//
#define TPDC_SAMPLE_RATE_ID                                0
struct TPDC_SAMPLE_RATE
        {
        INT                SamplesPerSecondLow;
        INT                SamplesPerSecondHigh;
        INT                CurrentSampleRateSetting;        //        0 => Low, 1 => High
        };

//
// @type DDI_TOUCH_PANEL_CALIBRATION_FLAGS |
// Calibration flags
//
// @comm
// The definition is:
// typedef UINT32 DDI_TOUCH_PANEL_CALIBRATION_FLAGS;

    typedef UINT32 DDI_TOUCH_PANEL_CALIBRATION_FLAGS;

//
// @const ULONG | TPDC_CALIBRATION_POINT_COUNT_ID |
// Calibration points device capability
//
#define TPDC_CALIBRATION_POINT_COUNT_ID        1
struct TPDC_CALIBRATION_POINT_COUNT
{
        DDI_TOUCH_PANEL_CALIBRATION_FLAGS        flags;
        INT                                                                        cCalibrationPoints;
};

//
// @const ULONG | TPDC_CALIBRATION_POINT_ID |
// Calibration mapping data device capability
//
#define TPDC_CALIBRATION_POINT_ID                        2
struct TPDC_CALIBRATION_POINT
{
        INT                PointNumber;
        INT                cDisplayWidth;
        INT                cDisplayHeight;
        INT                CalibrationX;
        INT                CalibrationY;
};

//
// TouchPanelSetMode set capability defintions
//
// @const ULONG | TPSM_SAMPLERATE_HIGH_ID |
// Device mode for the high sampling rate for points.
//
// @const ULONG | TPSM_SAMPLERATE_LOW_ID |
// Device mode for the low sampling rate for points.
//
//

#define TPSM_SAMPLERATE_HIGH_ID                        0x00
#define TPSM_SAMPLERATE_LOW_ID                        0x01
#define TPSM_PRIORITY_HIGH_ID                        0x02
#define TPSM_PRIORITY_NORMAL_ID                        0x04


// Function Definitions


BOOL
TouchPanelGetDeviceCaps(
        INT                iIndex,
    LPVOID  lpOutput
    );

typedef BOOL (*PFN_TOUCH_PANEL_GET_DEVICE_CAPS)(
        INT                iIndex,
    LPVOID  lpOutput
    );
                       


BOOL
TouchPanelSetMode(
    INT                iIndex,
    LPVOID        lpInput
    );

typedef BOOL (*PFN_TOUCH_PANEL_SET_MODE)(
    INT                iIndex,
    LPVOID        lpInput
    );
                       


//
// Function Prototype definition for the point callback function
//
// @type PFN_TOUCH_PANEL_CALLBACK |
// The function signature for the calibration and point callback functions.
// A pointer to this function is passed to .  The
// touch driver subsequently calls this function whenever a new touch
// sample is generated.
// @comm
// The signature function is:
// typedef VOID (*PFN_TOUCH_PANEL_CALLBACK)(
//  DDI_TOUCH_PANEL_SAMPLE_FLAGS,
//    INT,
//    INT
//    );
//

typedef BOOL (*PFN_TOUCH_PANEL_CALLBACK)(
    TOUCH_PANEL_SAMPLE_FLAGS        Flags,
    INT        X,
    INT        Y
    );

typedef VOID (*PFN_DISP_DRIVER_MOVE_CURSOR)(
    INT32        X,
    INT32        Y
    );

BOOL
TouchPanelInitializeCursor(
        PFN_DISP_DRIVER_MOVE_CURSOR
        );
typedef BOOL  (*PFN_TOUCH_PANEL_INITIALIZE_CURSOR)(
                                PFN_DISP_DRIVER_MOVE_CURSOR
                                );


BOOL
TouchPanelEnable(
        PFN_TOUCH_PANEL_CALLBACK
    );
typedef BOOL  (*PFN_TOUCH_PANEL_ENABLE)(PFN_TOUCH_PANEL_CALLBACK);

VOID
TouchPanelDisable(
    VOID
    );
typedef VOID (*PFN_TOUCH_PANEL_DISABLE)(VOID);


BOOL
TouchPanelReadCalibrationPoint(
        INT        *pUncalibratedX,
        INT        *pUncalibratedY
    );
typedef BOOL (*PFN_TOUCH_PANEL_READ_CALIBRATION_POINT)(
                                                INT        *pUncalibratedX,
                                                INT        *pUncalibratedY
                                                );

VOID
TouchPanelReadCalibrationAbort(
        VOID
        );
typedef VOID (*PFN_TOUCH_PANEL_READ_CALIBRATION_ABORT)(
                                        VOID
                                        );


BOOL
TouchPanelSetCalibration(
        INT32        cCalibrationPoints,                //The number of calibration points
        INT32        *pScreenXBuffer,                //List of screen X coords displayed
        INT32        *pScreenYBuffer,                //List of screen Y coords displayed
        INT32        *pUncalXBuffer,                        //List of X coords collected
        INT32        *pUncalYBuffer                        //List of Y coords collected
        );
typedef BOOL (*PFN_TOUCH_PANEL_SET_CALIBRATION)(
                                        INT32        cCalibrationPoints,
                                        INT32        *pScreenXBuffer,
                                        INT32        *pScreenYBuffer,
                                        INT32        *pUncalXBuffer,
                                        INT32        *pUncalYBuffer
                    );


void
TouchPanelCalibrateAPoint(
    INT32   UncalX,
    INT32   UncalY,
    INT32   *pCalX,
    INT32   *pCalY
    );
typedef void  (*PFN_TOUCH_PANEL_CALIBRATE_A_POINT)(
                                        INT32        UncalX,
                                        INT32        UncalY,
                                        INT32        *pCalX,
                                        INT32        *pCalY
                                        );


void
TouchPanelPowerHandler(
        BOOL        bOff
        );
typedef void (*PFN_TOUCH_PANEL_POWER_HANDLER)(
                                BOOL        bOff
                                );


#ifdef __cplusplus
}
#endif

       
#endif
此帖出自WindowsCE论坛
 
 
 

回复

72

帖子

0

TA的资源

一粒金砂(初级)

4
 
这些个头文件里已经找到了 好像在PB里有

但是我编译好像还有问题啊 一些函数找不到
此帖出自WindowsCE论坛
 
 
 

回复

66

帖子

0

TA的资源

一粒金砂(初级)

5
 
呵呵~ 我这边有的
此帖出自WindowsCE论坛
 
 
 

回复

81

帖子

0

TA的资源

一粒金砂(初级)

6
 
……是自己建个tchddi.h空文件把2楼的一堆粘上就能用了么……
此帖出自WindowsCE论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表