Paneldrv.h
上传用户:zbk8730
上传日期:2017-08-10
资源大小:12168k
文件大小:10k
- #ifndef _PANELDRV_H_
- #define _PANELDRV_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define TOUCH_AREA_FEATURE
- // screen size
- #define SCREEN_CX 239
- #define SCREEN_CY 319
- // pen state
- #define _PEN_UP 0 // pen up
- #define _PEN_DOWN 1 // pen down
- #define _PEN_ICON 2 // pen down icon
- #ifndef L_PLATFORM
- #define TOUCHPEN_UP 0
- #define TOUCHPEN_DOWN 1
- #define TOUCHPEN_MOVE 2
- #else
- #define TOUCHPEN_UP 0x00
- #define TOUCHPEN_DOWN 0x04
- #define TOUCHPEN_MOVE 0x10
- #endif
- #ifdef _PROJECT_PM368_
- #if 0
- // 320*320 LCD
- #define ADJUST_X_CENTRE 0x175//0x165 //0x175
- #define ADJUST_Y_CENTRE 0x175//0x170 //0x175
- #define ADJUST_X_LEFTTOP 0x50//0x050 //0x80
- #define ADJUST_Y_LEFTTOP 0x50//0x240 //0x80
- #define ADJUST_X_RIGHTTOP 0x270//0x239 //0x270
- #define ADJUST_Y_RIGHTTOP 0x50//0x240 //0x80
- #define ADJUST_X_LEFTBOTTOM 0x50//0x050 //0x80
- #define ADJUST_Y_LEFTBOTTOM 0x270//0x270 //0x270
- #define ADJUST_X_RIGHTBOTTOM 0x270//0x239 //0x270
- #define ADJUST_Y_RIGHTBOTTOM 0x0270//0x270 //0x270
- #else
- // 320*240 LCD
- #define ADJUST_X_CENTRE 0x1e5//0x200
- #define ADJUST_Y_CENTRE 0x1f5//0x1f0
- #define ADJUST_X_LEFTTOP 0x60//0x90
- #define ADJUST_Y_LEFTTOP 0x50//0x60
- #define ADJUST_X_RIGHTTOP 0x390//0x390
- #define ADJUST_Y_RIGHTTOP 0x50//0x60
- #define ADJUST_X_LEFTBOTTOM 0x60//0x90
- #define ADJUST_Y_LEFTBOTTOM 0x390//0x390
- #define ADJUST_X_RIGHTBOTTOM 0x390//0x390
- #define ADJUST_Y_RIGHTBOTTOM 0x390//0x390
- /*
- #define ADJUST_X_CENTRE 0x1e0
- #define ADJUST_Y_CENTRE 0x1c0
- #define ADJUST_X_LEFTTOP 0x60
- #define ADJUST_Y_LEFTTOP 0x60
- #define ADJUST_X_RIGHTTOP 0x350
- #define ADJUST_Y_RIGHTTOP 0x60
- #define ADJUST_X_LEFTBOTTOM 0x60
- #define ADJUST_Y_LEFTBOTTOM 0x380
- #define ADJUST_X_RIGHTBOTTOM 0x350
- #define ADJUST_Y_RIGHTBOTTOM 0x380
- */
- #endif
- #else
- #ifdef _PROJECT_PM388_
- #define ADJUST_X_CENTRE 0x200
- #define ADJUST_Y_CENTRE 0x200
- #define ADJUST_X_LEFTTOP 0x50
- #define ADJUST_Y_LEFTTOP 0x40
- #define ADJUST_X_RIGHTTOP 0x380
- #define ADJUST_Y_RIGHTTOP 0x40
- #define ADJUST_X_LEFTBOTTOM 0x50
- #define ADJUST_Y_LEFTBOTTOM 0x390
- #define ADJUST_X_RIGHTBOTTOM 0x380
- #define ADJUST_Y_RIGHTBOTTOM 0x390
- #ifdef TOUCH_AREA_FEATURE
- #define ADJUST_AREAA_RX_M 119
- #define ADJUST_AREAA_RX_N 432
- #define ADJUST_AREAA_OFFSETX 22
- #define ADJUST_AREAA_RY_M 159
- #define ADJUST_AREAA_RY_N 448
- #define ADJUST_AREAA_OFFSETY 23
- #define ADJUST_AREAB_RX_M 5
- #define ADJUST_AREAB_RX_N 16
- #define ADJUST_AREAB_OFFSETX 41
- #define ADJUST_AREAB_RY_M 159
- #define ADJUST_AREAB_RY_N 448
- #define ADJUST_AREAB_OFFSETY 23
- #define ADJUST_AREAC_RX_M 119
- #define ADJUST_AREAC_RX_N 432
- #define ADJUST_AREAC_OFFSETX 22
- #define ADJUST_AREAC_RY_M 2
- #define ADJUST_AREAC_RY_N 5
- #define ADJUST_AREAC_OFFSETY 46
- #define ADJUST_AREAD_RX_M 5
- #define ADJUST_AREAD_RX_N 16
- #define ADJUST_AREAD_OFFSETX 41
- #define ADJUST_AREAD_RY_M 2
- #define ADJUST_AREAD_RY_N 5
- #define ADJUST_AREAD_OFFSETY 46
- #endif
- #else
- #define ADJUST_X_CENTRE 0x1e0
- #define ADJUST_Y_CENTRE 0x1c0
- #define ADJUST_X_LEFTTOP 0x60
- #define ADJUST_Y_LEFTTOP 0x60
- #define ADJUST_X_RIGHTTOP 0x350
- #define ADJUST_Y_RIGHTTOP 0x60
- #define ADJUST_X_LEFTBOTTOM 0x60
- #define ADJUST_Y_LEFTBOTTOM 0x330
- #define ADJUST_X_RIGHTBOTTOM 0x350
- #define ADJUST_Y_RIGHTBOTTOM 0x330
- #endif
- #endif
- #define ADJUST_OFFSET 80
- #define ADJUST_OFFSET2 200
- #define PANELBUFLEN 100
- typedef struct tagPEN_POINT
- {
- unsigned short x;
- unsigned short y;
- }PEN_POINT, *PPEN_POINT;
- typedef struct tagTouchPenState
- {
- unsigned short wTouchState; // 1: up, 0: down
- unsigned short wTouchX; //
- unsigned short wTouchY; //
- }TouchPenState, *pTouchPenState;
- typedef struct tagPenQueue
- {
- TouchPenState PenState[PANELBUFLEN]; // pen queue
- unsigned short wHead;
- unsigned short wTail;
- }PenQueue, *pPenQueue;
- typedef struct tagPANEL_STRUC
- {
- unsigned char PanelState; // TOUCHDOWN, TOUCHUP, TOUCHMOVE
- unsigned short PanelDotX;
- unsigned short PanelDotY;
- unsigned char PanelIconFlag; // indicates icon name.
- }PANEL_STRUC, *PPANEL_STRUC;
- typedef struct tagPANELQUEUE
- {
- PANEL_STRUC PanelBuf[PANELBUFLEN];
- unsigned char PanelFront;
- unsigned char PanelRear; /* Panel front and rear vaule */
- unsigned char PanelBufFull; /* Panel buffer empty flag */
- }PANELQUEUE, *PPANELQUEUE;
- #ifdef TOUCH_AREA_FEATURE
- typedef struct floatStruct
- {
- unsigned short m;
- unsigned short n;
- }TouchFloatData;
- typedef struct touchAreaStruct
- {
- TouchFloatData Rx;
- TouchFloatData Ry;
- unsigned short offset_x;
- unsigned short offset_y;
- }TouchAreaStruct;
- typedef enum
- {
- TOUCH_AREA_A = 0,
- TOUCH_AREA_B,
- TOUCH_AREA_C,
- TOUCH_AREA_D,
- TOUCH_AREA_CENTER,
- }TouchArea;
- #endif
- #ifndef L_PLATFORM
- typedef struct tagAdjustTouch
- #else
- typedef struct tagAdjustTouch
- #endif
- {
- #ifndef TOUCH_AREA_FEATURE
- unsigned short wCentreX;
- unsigned short wCentreY;
- unsigned short wLeftTopX;
- unsigned short wLeftTopY;
- unsigned short wRightTopX;
- unsigned short wRightTopY;
- unsigned short wLeftBottomX;
- unsigned short wLeftBottomY;
- unsigned short wRightBottomX;
- unsigned short wRightBottomY;
- #else
- unsigned short wCentreX;
- unsigned short wCentreY;
- unsigned short wAreaARx_m;
- unsigned short wAreaARx_n;
- unsigned short wAreaAOffsetx;
- unsigned short wAreaARy_m;
- unsigned short wAreaARy_n;
- unsigned short wAreaAOffsety;
- unsigned short wAreaBRx_m;
- unsigned short wAreaBRx_n;
- unsigned short wAreaBOffsetx;
- unsigned short wAreaBRy_m;
- unsigned short wAreaBRy_n;
- unsigned short wAreaBOffsety;
- unsigned short wAreaCRx_m;
- unsigned short wAreaCRx_n;
- unsigned short wAreaCOffsetx;
- unsigned short wAreaCRy_m;
- unsigned short wAreaCRy_n;
- unsigned short wAreaCOffsety;
- unsigned short wAreaDRx_m;
- unsigned short wAreaDRx_n;
- unsigned short wAreaDOffsetx;
- unsigned short wAreaDRy_m;
- unsigned short wAreaDRy_n;
- unsigned short wAreaDOffsety;
- #endif
- #ifndef L_PLATFORM
- }AdjustTouchPoints, *pAdjustTouchPoints;
- #else
- } __attribute__((packed))AdjustTouchPoints, __attribute__((packed)) *pAdjustTouchPoints ;
- #endif
- extern unsigned char gcPenState;
- extern unsigned char gbPenUpFlag;
- extern unsigned short gwPreTouchKey;
- extern unsigned short gwLaterX;
- extern unsigned short gwLaterY;
- extern unsigned short gwLastestX;
- extern unsigned short gwLastestY;
- extern unsigned short gwLastX;
- extern unsigned short gwLastY;
- extern unsigned short wPrePenMoveX;
- extern unsigned short wPrePenMoveY;
- extern unsigned short gwTouchXMinValue1;
- extern unsigned short gwTouchXMinValue2;
- extern unsigned short gwTouchXMaxValue1;
- extern unsigned short gwTouchXMaxValue2;
- extern unsigned short gwTouchYMinValue1;
- extern unsigned short gwTouchYMinValue2;
- extern unsigned short gwTouchYMaxValue1;
- extern unsigned short gwTouchYMaxValue2;
- extern unsigned short gwTouchXValue;
- extern unsigned short gwTouchYValue;
- extern unsigned short gwTouchXSite;
- extern unsigned short gwTouchYSite;
- extern unsigned char gbTouchAdjustFlag;
- extern unsigned short gwAdjustX;
- extern unsigned short gwAdjustY;
- void ResetTouchConvert(void);
- extern unsigned char _IsTouchPenDown(void);
- void InitTouchPen(void);
- void RestoreTouchPen(void);
- void SetPenState(unsigned char cState);
- unsigned char GetPenState(void);
- void SetDefaultPenState(void);
- TouchPenState GetPenInfo(unsigned short wCurPoint);
- unsigned char GetPenUpFlag(void);
- void SetPenUpFlag(unsigned char bFlag);
- unsigned char ComparePenState(PEN_POINT pt);
- void EmptyPenQueue(void);
- PEN_POINT CurrentPenPos(void);
- unsigned char TouchPanelProc(unsigned short wTouchX, unsigned short wTouchY);
- unsigned char TouchPenProc(void);
- unsigned char TouchPutOn(TouchPenState *pTouchValue);
- void NoUpRestoreTouch(void);
- void RestoreTouch(void);
- unsigned char GetCurPenPos(unsigned short *x, unsigned short *y);
- unsigned short ModulusMinusValue(unsigned short wValue1, unsigned short wValue2);
- unsigned short MaxValue(unsigned short wValue1, unsigned short wValue2);
- unsigned short MinValue(unsigned short wValue1, unsigned short wValue2);
- // adjust touch panel
- unsigned char GetPenAdjustState(void);
- void PenAdjustBegin(void);
- void PenAdjustEnd(void);
- void GetAdjustmentAD(unsigned short *wTouchX, unsigned short *wTouchY);
- unsigned char CmpRange(unsigned short sx, unsigned short sy, unsigned short tx, unsigned short ty);
- unsigned char CalculateTouchCentre(unsigned short wLcdX, unsigned short wLcdY, unsigned short wTouchX, unsigned short wTouchY);
- unsigned char CalculateTouchLeftTop(unsigned short wLcdX, unsigned short wLcdY, unsigned short wTouchX, unsigned short wTouchY);
- unsigned char CalculateTouchRightTop(unsigned short wLcdX, unsigned short wLcdY, unsigned short wTouchX, unsigned short wTouchY);
- unsigned char CalculateTouchLeftBottom(unsigned short wLcdX, unsigned short wLcdY, unsigned short wTouchX, unsigned short wTouchY);
- unsigned char CalculateTouchRightBottom(unsigned short wLcdX, unsigned short wLcdY, unsigned short wTouchX, unsigned short wTouchY);
- void BorderAverage(void);
- void GetPenAdjustment(AdjustTouchPoints *AD);
- void SetPenAdjustment(AdjustTouchPoints *AD);
- extern unsigned char PutPanelInf(PANEL_STRUC *panelvar);
- extern unsigned char GetPanelInf(PANEL_STRUC *panelvar);
- #ifdef __cplusplus
- }
- #endif
- #endif