GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; //中断
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd =GPIO_PuPd_NOPULL;
GPIO_Init(GPIOG, &GPIO_InitStructure);
//安装一个中断函数,暂时先放到这个文件里面
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
这是初始化代码。下面是清子中断。 // Read ITs, clear pending ones
abApi_Write[0] = CMD_GET_INT_STATUS; // Use interrupt status command
abApi_Write[1] = 0; // Clear PH_CLR_PEND
abApi_Write[2] = 0; // Clear MODEM_CLR_PEND
abApi_Write[3] = 0; // Clear CHIP_CLR_PEND
// bApi_SendCommand(4,abApi_Write); // Send command to the radio IC
SI4438_Write(abApi_Write[0] ,3,&abApi_Write[1] );
bApi_GetResponse(8,abApi_Write);
不能进入中断,很费解。 |