如下为主函数
int main(void)
{
delay_init(); //???±??????????
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //?è??NVIC????·?×é2:2??????????????2???ì????????
uart_init(115200); //?®??????????115200
LED_Init(); //LED??????????
TFTLCD_Init(); //LCD??????
KEY_Init(); //°??ü??????
FSMC_SRAM_Init(); //??????SRAM
TIM3_Int_Init(999,71); //1KHZ ?¨?±?÷1ms
TIM6_Int_Init(999,719); //10ms????
my_mem_init(SRAMIN); //????????????????
my_mem_init(SRAMEX); //????????????????
TP_Init(); //????????????
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC,ENABLE);//????CRC?±????·??òSTemWin????????
GUI_Init();
while(1)
{
// Mytouch_MainTask();
}
}
但是在执行过程时,到了TP_Init(); 该触摸屏初始的时候,就一直卡在屏幕调准那
u8 TP_Init(void)
{
if(lcddev.id==0X5510) //4.3????????????
{
if(GT9147_Init()==0) //??GT9147
{
tp_dev.scan=GT9147_Scan; //?¨?è???????òGT9147???????¨?è
}else
{
OTT2001A_Init();
tp_dev.scan=OTT2001A_Scan; //?¨?è???????òOTT2001A???????¨?è
}
tp_dev.touchtype|=0X80; //??????
tp_dev.touchtype|=lcddev.dir&0X01;//?á???????ú??
return 0;
}else if(lcddev.id==0X1963) //7????????????
{
FT5206_Init();
tp_dev.scan=FT5206_Scan; //?¨?è???????òGT9147???????¨?è
tp_dev.touchtype|=0X80; //??????
tp_dev.touchtype|=lcddev.dir&0X01;//?á???????ú??
return 0;
}else
{
//×???,?±???????®?ó,??GPIO????×÷?????§
//?ù??????®?°,±????????±??.?????????????????????
RCC->APB2ENR|=1<<3; //PB?±??????
RCC->APB2ENR|=1<<7; //PF?±??????
GPIOB->CRL&=0XFFFFF00F; //PB1/2?è??
GPIOB->CRL|=0X00000830; //PB1???ì????,PB2???????
GPIOB->ODR|=3<<1; //PB1/2???
GPIOF->CRH&=0XFFFF000F; //PF9/10/11?è??
GPIOF->CRH|=0X00003830; //PF10???????,PF9/11???ì????
GPIOF->ODR|=7<<9; //PF9,10,11 ???????
TP_Read_XY(&tp_dev.x[0],&tp_dev.y[0]);//????????????????
AT24CXX_Init(); //??????24CXX
if(TP_Get_Adjdata())return 0;//?????×?
else //????×??
{
LCD_Clear(WHITE); //????
TP_Adjust(); //??????×?
}
TP_Get_Adjdata();
}
return 1;
}
一直校准都失败,返回值为0
|