高级会员
- 积分
- 994
- 金钱
- 994
- 注册时间
- 2016-7-22
- 在线时间
- 318 小时
|
发表于 2016-12-29 15:13:34
|
显示全部楼层
GUI_X_Touch_Analog.c 里面的函数改了就ok了。直接复制如下函数
/*********************************************************************
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2012 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.16 - Graphical user interface for embedded applications **
All Intellectual Property rights in the Software belongs to SEGGER.
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with the following terms:
The software has been licensed to ARM LIMITED whose registered office
is situated at 110 Fulbourn Road, Cambridge CB1 9NJ, England solely
for the purposes of creating libraries for ARM7, ARM9, Cortex-M
series, and Cortex-R4 processor-based devices, sublicensed and
distributed as part of the MDK-ARM Professional under the terms and
conditions of the End User License supplied with the MDK-ARM
Professional.
Full source code is available at: www.segger.com
We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GUI_TOUCH_X.C
Purpose : Config / System dependent externals for GUI
---------------------------END-OF-HEADER------------------------------
*/
#include "GUI.h"
#include "touch.h"
#include "ILI93xx.h"
#include "usart.h"
void GUI_TOUCH_X_ActivateX(void)
{
// XPT2046_WriteCMD(0x90);
}
void GUI_TOUCH_X_ActivateY(void)
{
//XPT2046_WriteCMD(0xd0);
}
const u16 GT9147_TPX_TBL1[5] = {GT_TP1_REG,GT_TP2_REG,GT_TP3_REG,GT_TP4_REG,GT_TP5_REG};
//GT9147 é¨Ãè′¥ÃtÆá(2éóÃ2éÑˉ·½ê½)
void GT9147Touch_Scan(void)
{
u8 mode=0;
u8 buf[4];
u8 temp;
u8 i;
GT9147_RD_Reg(GT_GSTID_REG,&mode,1);//¶áè¡′¥ÃtμãμÄ×′ì¬
if((mode&0X80&&((mode&0XF)<6))||(mode&0x20))
{
temp=0;
GT9147_WR_Reg(GT_GSTID_REG,&temp,1);//Çå±êÖ¾
}
if((mode&0XF)&&((mode&0XF)<6))
{
temp=~(0xFF << (mode & 0x0F));
tp_dev.sta = temp|TP_PRES_DOWN|TP_CATH_PRES;
for(i=0;i<5;i++)
{
if(tp_dev.sta & (1<<i))
{
GT9147_RD_Reg(GT9147_TPX_TBL1,buf,4); //¶áè¡ XY ×ø±êÖμ
tp_dev.x=((u16)buf[1]<<8)+buf[0];
tp_dev.y=((u16)buf[3]<<8)+buf[2];
}
if(tp_dev.touchtype&0X01)//oáÆá
{
tp_dev.y=((u16)buf[1]<<8)+buf[0];
tp_dev.x=800-(((u16)buf[3]<<8)+buf[2]);
}else
{
tp_dev.x=((u16)buf[1]<<8)+buf[0];
tp_dev.y=((u16)buf[3]<<8)+buf[2];
}
}
mode=0;
GT9147_WR_Reg(GT_GSTID_REG,&mode,1);//Çå±êÖ¾
}
else if((mode&0X8F)==0X80)//ÎT′¥Ãtμã°′ÏÂ
{
if(tp_dev.sta&TP_PRES_DOWN) //֮ǰêDZ»°′ÏÂμÄ
{
tp_dev.sta&=~(1<<7); //±ê¼Ç°′¼üËé¿a
}else //֮ǰ¾íûóD±»°′ÏÂ
{
tp_dev.x[0]=0xffff;
tp_dev.y[0]=0xffff;
tp_dev.sta&=0XE0;//Çå3yμãóDD§±ê¼Ç
}
}
}
//»ñè¡μçèY′¥ÃtÆáμÄ X ÖáÖμ
int32_t Get_CapacTouchValueX(void)
{
int32_t lost_x;
GT9147Touch_Scan();
lost_x = tp_dev.x[0];
return lost_x;
}
//»ñè¡μçèY′¥ÃtÆáμÄ Y ÖáÖμ
int32_t Get_CapacTouchValueY(void)
{
int32_t lost_y;
GT9147Touch_Scan();
lost_y=tp_dev.y[0];
return lost_y;
}
int GUI_TOUCH_X_MeasureX(void)
{
int32_t xvalue;
if(lcddev.id == 0X5510) //μçèYÆáμÄ′¥ÃtÖμ»ñè¡
{
xvalue= Get_CapacTouchValueX();
return xvalue;
}else //μç×èÆá
{
return TP_Read_XOY(0XD0); //CMD_RDX=0XD0
}
}
int GUI_TOUCH_X_MeasureY(void)
{
int32_t yvalue;
if(lcddev.id == 0X5510) //μçèYÆáμÄ′¥ÃtÖμ»ñè¡
{
yvalue=Get_CapacTouchValueY();
return yvalue;
}else //μç×èÆá
{
return TP_Read_XOY(0X90); //CMD_RDX=0XD0
}
}
//int GUI_TOUCH_X_MeasureX(void)
//{
// int32_t xvalue;
// if((lcddev.id == 0X5510) || (lcddev.id == 0X1963)) //μçèYÆáμÄ′¥ÃtÖμ»ñè¡(ê1óÃNT5510oíSSD1963D¾Æ¬μÄ4.3′çoí7′çÆᶼêÇμçèYÆá)
// {
// tp_dev.scan(0);
// xvalue=tp_dev.x[0];
// return xvalue;
// }else //μç×èÆá
// {
// return TP_Read_XOY(0XD0); //CMD_RDX=0XD0
// }
//}
//int GUI_TOUCH_X_MeasureY(void)
//{
// int32_t yvalue;
// if((lcddev.id == 0X5510) || (lcddev.id == 0X1963))//μçèYÆáμÄ′¥ÃtÖμ»ñè¡(ê1óÃNT5510oíSSD1963D¾Æ¬μÄ4.3′çoí7′çÆᶼêÇμçèYÆá)
// {
// tp_dev.scan(0);
// yvalue = tp_dev.y[0];
// return yvalue;
// }else //μç×èÆá
// {
// return TP_Read_XOY(0X90); //CMD_RDX=0XD0
// }
//}
我也是看大神的工程对比看的 |
|