资源简介
触摸屏GT911、GT928、GT9147的驱动程序,stm32平台,使用的模拟IIC,共需要4个普通IO口:SCL、SDA、RST、INT。程序中带有1204*600和800*480的配置。
代码片段和文件信息
#include “sys.h“
#include “gt911.h“
#include “gt911iic.h“
#include “BSP.h“
#if(DISPLAY==0) //800*480
//GT9147配置参数表
//第一个字节为版本号(0X60)必须保证新的版本号大于等于GT9147内部
//flash原有版本号才会更新配置.
const u8 GT9147_CFG_TBL[]=
{
0x600x200x030xE00x010x050x3D0x000x010x0F
0x280x0F0x550x410x030x050x000x000x000x00
0x000x000x040x180x1A0x1E0x140x900x300xCC
0x250x270xB50x060x000x000x000x220x020x35
0x000x000x000x000x000x000x000x000x000x00
0x000x150x630x4A0xC50x020x070x000x000x04
0xB10x180x000x8B0x210x000x6E0x2E0x000x5A
0x3E0x000x4D0x550x000x4D0x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x010x040x050x060x070x080x09
0x0C0x0D0x0E0x0F0x100x110x140x150x160x17
0x180x190x1A0x1B0x1C0x1D0x000x000x000x00
0x000x000x000x020x040x060x070x080x0A0x0C
0x0D0x0E0x0F0x100x110x120x130x140x190x1B
0x1C0x1E0x1F0x200x210x220x230x240x250x26
0x270x280x290x2A0x000x000x000x000x000x00
0x000x000x000x00
};
#elif(DISPLAY==2) //1024*600
//GT9147配置参数表
//第一个字节为版本号(0X60)必须保证新的版本号大于等于GT9147内部
//flash原有版本号才会更新配置.
const u8 GT9147_CFG_TBL[]=
{
0x600x000x040x580x020x050x3D0x000x010x0F
0x280x0F0x550x410x030x050x000x000x000x00
0x000x000x040x180x1A0x1E0x140x900x300xCC
0x250x270xB50x060x000x000x000x220x020x35
0x000x000x000x000x000x000x000x000x000x00
0x000x150x630x4A0xC50x020x070x000x000x04
0xB10x180x000x8B0x210x000x6E0x2E0x000x5A
0x3E0x000x4D0x550x000x4D0x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x000x000x000x000x000x000x00
0x000x000x000x010x040x050x060x070x080x09
0x0C0x0D0x0E0x0F0x100x110x140x150x160x17
0x180x190x1A0x1B0x1C0x1D0x000x000x000x00
0x000x000x000x020x040x060x070x080x0A0x0C
0x0D0x0E0x0F0x100x110x120x130x140x190x1B
0x1C0x1E0x1F0x200x210x220x230x240x250x26
0x270x280x290x2A0x000x000x000x000x000x00
0x000x000x000x00
};
#endif
volatile Touch TouchRD[2];
//发送GT9147配置参数
//mode:0参数不保存到flash
// 1参数保存到flash
u8 GT9147_Send_Cfg(u8 mode)
{
u8 buf[2];
u8 i=0;
buf[0]=0;
buf[1]=mode; //是否写入到GT9147 FLASH? 即是否掉电保存
for(i=0;i buf[0]=(~buf[0])+1;
GT911_WR_Reg(GT_CFGS_REG(u8*)GT9147_CFG_TBLsizeof(GT9147_CFG_TBL));//发送寄存器配置
GT911_WR_Reg(GT_CHECK_REGbuf2);//写入校验和和配置更新标记
return 0;
}
//向GT911写入一次数据
//reg:起始寄存器地址
//buf:数据缓缓存区
//len:写数据长度
//返回值:0成功;1失败.
u8 GT911_WR_Reg(u16 regu8 *bufu8 len)
{
u8 i;
u8 ret=0;
GT911_IIC_Start();
GT911_IIC_Send_Byte(CT_CMD_WR); //发送写命令
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6678 2019-07-01 11:23 GT9xx\gt911.c
文件 1101 2019-07-01 10:56 GT9xx\gt911.h
文件 2704 2019-06-13 17:40 GT9xx\gt911iic.c
文件 1233 2019-06-13 17:40 GT9xx\gt911iic.h
目录 0 2019-07-01 11:29 GT9xx
----------- --------- ---------- ----- ----
11716 5
- 上一篇:基于声音信号的特征提取方法的研究
- 下一篇:newbbin.rar
评论
共有 条评论