#includebsp.h#includeGUI.h#defineGT911_READ_XY_REG0x814E/*坐标寄存器*/#defineGT911_CLEARBUF_REG0x814E/*清除坐标寄存器*/#defineGT911_CONFIG_REG0x8047/*配置参数寄存器*/#defineGT911_COMMAND_REG0x8040/*实时命令*/#defineGT911_PRODUCT_ID_REG0x8140/*productid*/#defineGT911_VENDOR_ID_REG0x814A/*当前模组选项信息*/#defineGT911_CONFIG_VERSION_REG0x8047/*配置文件版本号*/#defineGT911_CONFIG_CHECKSUM_REG0x80FF/*配置文件校验码*/#defineGT911_FIRMWARE_VERSION_REG0x8144/*固件版本号*//*定义GT911复位与中断引脚连接的GPIO端口*/#defineGPIO_PORT_GT911_RSTGPIOF/*GPIO端口*/#defineGPIO_PORT_GT911_INTGPIOF/*GPIO端口*/#defineRCC_GT911_RST_INT_PORTRCC_AHB1Periph_GPIOF/*GPIO端口时钟*/#defineGT911_RST_PINGPIO_Pin_9/*连接到RST时钟线的GPIO*/#defineGT911_INT_PINGPIO_Pin_8/*连接到INT数据线的GPIO*/#defineEXTI_GT911_INT_PORTEXTI_PortSourceGPIOF/*GT911INTEXTIPORT*/#defineEXTI_GT911_INT_PINEXTI_PinSource8/*GT911INTEXTIPIN*/#defineEXTI_GT911_INT_LINEEXTI_Line8/*GT911INTEXTILINE*//*定义写RST和INT的宏*/#defineGT911_RST_1()GPIO_PORT_GT911_RST-BSRRL=GT911_RST_PIN/*RST=1*/#defineGT911_RST_0()GPIO_PORT_GT911_RST-BSRRH=GT911_RST_PIN/*RST=0*/#defineGT911_INT_1()GPIO_PORT_GT911_INT-BSRRL=GT911_INT_PIN/*INT=1*/#defineGT911_INT_0()GPIO_PORT_GT911_INT-BSRRH=GT911_INT_PIN/*INT=0*//*GT911的从设备地址有两组可选,两组地址分别为:0xBA/0xBB和0x28/0x29*/#defineGT911_I2C_ADDR0xBAtypedefstruct{uint8_tEnable;uint8_ti2c_addr;uint8_tTouchpointFlag;uint8_tTouchkey1trackid;uint16_tX1;uint16_tY1;uint16_tS1;uint8_tTouchkey2trackid;uint16_tX2;uint16_tY2;uint16_tS2;uint8_tTouchkey3trackid;uint16_tX3;uint16_tY3;uint16_tS3;uint8_tTouchkey4trackid;uint16_tX4;uint16_tY4;uint16_tS4;uint8_tTouchkey5trackid;uint16_tX5;uint16_tY5;uint16_tS5;}GT911_T;/*emWin要用到的触摸参数,在函GT911_InitHard初始为给图层0发送触摸数据*/GUI_PID_STATEState={0};/*GT911单个触点配置参数,一次性写入*/uint8_ts_GT911_CfgParams[]={0x00,//0x8047版本号0xE0,0x01,//0x8048/8049X坐标输出最大值4800x56,0x03,//0x804a/804bY坐标输出最大值8540x01,//0x804c输出触点个数上限0x35,//0x804d软件降噪,下降沿触发0x00,//0x804ereserved0x02,//0x804f手指按下去抖动次数0x08,//0x8050原始坐标窗口滤波值0x28,//0x8051大面积触点个数0x0A,//0x8052噪声消除值0x5A,//0x8053屏上触摸点从无到有的阈值0x46,//0x8054屏上触摸点从有到无的阈值0x03,//0x8055进低功耗时间s0x05,//0x8056坐标上报率0x00,//0x8057X坐标输出门上限0x00,//0x8058Y坐标输出门上限0x00,0X00,//0x8059-0x805areserved0x00,//0x805breserved0x00,//0x805creserved0x00,//0x805d划线过程中小filter设置0x18,//0x805e拉伸区间1系数0x1A,//0x805f拉伸区间2系数0x1E,//0x8060拉伸区间3系数0x14,//0x8061各拉伸区间基数0x8C,//0x8062、、0x28,//0x8063、、0x0C,//0x8064、、0x71,//0x8065驱动组A的驱动频率倍频系数0x73,//0x8066驱动组B的驱动频率倍频系数0xB2,//0x8067驱动组A、B的基频0x04,//0x80680x00,//0x8069相邻两次驱动信号输出时间间隔0x00,//0x806a0x00,//0x806b、、0x02,//0x806c、、0x03,//0x806d原始值放大系数0x1D,//0x806e、、0x00,//0x806freserved0x01,//0x8070、、0x00,0x00,//reserved0x00,//0x8073、、0x00,0x00,0x00,0x00,0x00,0x00,//0x8071-0x8079reserved0x50,//0x807a跳频范围的起点频率0xA0,//0x807b跳频范围的终点频率0x94,//0x807c多次噪声检测后确定噪声量,1-63有效0xD5,//0x807d噪声检测超时时间0x02,//0x807e、、0x07,//0x807f判别有干扰的门限0x00,0x00,//0x8081reserved0x04,//0x8082跳频检测区间频段1中心点基频(适用于驱动A、B)0xA4,//0x80830x55,//0x8084跳频检测区间频段1中心点倍频系数0x00,//0x8085跳频检测区间频段2中心点基频(驱动A、B在此基础上换算)0x91,//0x80860x62,//0x8087跳频检测区间频段2中心点倍频系数0x00,//0x8088跳频检测区间频段3中心点基频(适用于驱动A、B)0x80,//0x80890x71,//0x808a跳频检测区间频段3中心点倍频系数0x00,//0x808b跳频检测区间频段4中心点基频(适用于驱动A、B)0x71,//0x808c0x82,//0x808d跳频检测区间频段4中心点倍频系数0x00,//0x808e跳频检测区间频段5中心点基频(适用于驱动A、B)0x65,//0x808f0x95,//0x8090跳频检测区间频段5中心点倍频系数0x00,0x65,//reserved0x00,//0x8093key1位置0:无按键0x00,//0x8094key2位置0:无按键0x00,//0x8095key3位置0:无按键0x00,//0x8096key4位置0:无按键0x00,//0x8097reserved0x00,//0x8098reserved0x00,//0x8099reserved0x00,//0x809areserved0x00,//0x809breserved0x00,//0x809creserved0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//0x809d-0x80b2reserved0x00,//0x80b3合框距离0x00,//0x80b40x00,0x00,//0x80b6reserved0x06,//0x80b70x08,//0x80b80x0A,//0x80b90x0C,//0x80ba0x0E,//0x80bb0x10,//0x80bc0x12,//0x80bd0x14,//0x80be0x16,//0x80bf0x18,//0x80c00x1A,//0x80c10x1C,//0x80c20xFF,//0x80c30xFF,//0x80c40x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//0x80c5-0x80d4reserved0x00,//0x80d50x02,//0x80d60x04,//0x80d70x06,//0x80d80x08,//0x80d90x0A,//0x80da0x0C,//0x80db0x0F,//0x80dc0x10,//0x80dd0x12,//0x80de0x13,//0x80df0x14,//0x80e00x16,//0x80e10x18,//0x80e20x1C,//0x80e30x1D,//0x80e40x1E,//0x80e50x1F,//0x80e60x20,//0x80e70x21,//0x80e80xFF,//0x80e90xFF,//0x80ea0xFF,//0x80eb0xFF,//0x80ec0xFF,//0x80ed0xFF,//0x80ee0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//0x80ef-0x80fereserved0x0B,//0x80ff配置信息校验0x01//0x8100配置以更新标记};uint8_ts_GT911_ClearStatue[]={0x00};staticvoidGT911_WriteReg(uint16_t_usRegAddr,uint8_t*_pRegBuf,uint8_t_ucLen);staticvoidGT911_ReadReg(uint16_t_usRegAddr,uint8_t*_pRegBuf,uint8_t_ucLen);GT911_Tg_GT911;/***********************************************************************************************************函数名:GT911_INT_GPIO_Input_Init*功能说明:初始化RST引脚为推挽输出,INT引脚为开漏输出*形参:无*返回值:无**********************************************************************************************************/voidGT911_RST_INT_GPIO_Init(void){GPIO_InitTypeDefGPIO_InitStructure;RCC_AHB1PeriphClockCmd(RCC_GT911_RST_INT_PORT,ENABLE);/*打开GPIO时钟*/GPIO_I