u8 GT9147_Init(void)
{
u8 temp[5];
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE); //使能PF端口時鐘
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11; // PF11端口配置,PEN引腳
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽輸出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOF, &GPIO_InitStructure);//PF11推挽輸出
GPIO_SetBits(GPIOF,GPIO_Pin_1);//上拉
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; // PB2端口配置
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉輸入
GPIO_Init(GPIOF, &GPIO_InitStructure);//PF10上拉輸入
GPIO_SetBits(GPIOF,GPIO_Pin_10);//上拉
CT_IIC_Init(); //初始化電容屏的I2C總線
GT_RST=0; //復位
delay_ms(10);
GT_RST=1; //釋放復位
delay_ms(10);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; // PB2端口配置
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; //下拉輸入 問題1
GPIO_Init(GPIOF, &GPIO_InitStructure);//PF10下拉輸入
GPIO_ResetBits(GPIOF,GPIO_Pin_10);//下拉
delay_ms(100);
GT9147_RD_Reg(GT_PID_REG,temp,4); //讀取產品ID
temp[4]=0;
printf("CTP ID:%s\r\n",temp); //打印ID
if(strcmp((char*)temp,"9147")==0) //ID==9147
{
temp[0]=0X02;
GT9147_WR_Reg(GT_CTRL_REG,temp,1);//軟復位GT9147
GT9147_RD_Reg(GT_CFGS_REG,temp,1);//讀取GT_CFGS_REG寄存器
if(temp[0]<0X60)//默認版本比較低,需要更新flash配置 問題2
{
printf("Default Ver:%d\r\n",temp[0]);
GT9147_Send_Cfg(1);//更新并保存配置
}
delay_ms(10);
temp[0]=0X00;
GT9147_WR_Reg(GT_CTRL_REG,temp,1); //結束復位
return 0;
}
return 1;
}
問題1 INT先上拉再下拉輸入,這在干嘛
問題2 更新配置的條件是什么,這行看不懂
|