- int main()
- {
- SetSysClock( CLK_SOURCE_PLL_60MHz );
- /* 配置串口调试 */
- DebugInit();
- PRINT( "Start @ChipID=%02X\n", R8_CHIP_ID );
-
- GPIOB_ModeCfg(GPIO_Pin_15|GPIO_Pin_14|GPIO_Pin_13|GPIO_Pin_22,GPIO_ModeIN_PU);
- GPIOB_ITModeCfg(GPIO_Pin_15|GPIO_Pin_14|GPIO_Pin_13|GPIO_Pin_22,GPIO_ITMode_FallEdge);
- PFIC_EnableIRQ(GPIO_B_IRQn);
- while( 1 )
- ;
- }
- __attribute__((interrupt("WCH-Interrupt-fast")))
- __attribute__((section(".highcode")))
- void GPIOB_IRQHandler( void ) //GPIOB中断服务程序
- {
- uint32_t GPIOB_irqFlag = GPIOB_ReadITFlagPort();
- PRINT("GPIOB_irqFlag = 0x%08X\r\n",GPIOB_irqFlag);
- if(GPIOB_irqFlag&GPIO_Pin_15)
- {
- PRINT("Run at EXTI GPIO_Pin_15 \r\n");
- GPIOB_ClearITFlagBit(GPIO_Pin_15); /* Clear Flag */
- }
- if(GPIOB_irqFlag&GPIO_Pin_14)
- {
- PRINT("Run at EXTI GPIO_Pin_14 \r\n");
- GPIOB_ClearITFlagBit(GPIO_Pin_14); /* Clear Flag */
- }
- if(GPIOB_irqFlag&GPIO_Pin_13)
- {
- PRINT("Run at EXTI GPIO_Pin_13 \r\n");
- GPIOB_ClearITFlagBit(GPIO_Pin_13); /* Clear Flag */
- }
- if(GPIOB_irqFlag&(GPIO_Pin_22))
- {
- PRINT("Run at EXTI GPIO_Pin_22 \r\n");
- GPIOB_ClearITFlagBit(GPIO_Pin_22); /* Clear Flag */
- }
- }
去除警告
- #define GPIOB_ClearITFlagBit( pin ) (R16_PB_INT_IF = (uint16_t)((pin)|(((pin)&(GPIO_Pin_22|GPIO_Pin_23))>>14))) /* 清除GPIOB端口引脚中断标志状态 */
|