奇怪了,我调用 GPIO_DisableInt( PD, 3 ); 后竟然还可以进PD3的中断服务程序!
GPIO_EnableInt 和GPIO_DisableInt参考的都是BSP!
/**
* @brief Enable GPIO interrupt
*
* @param[in] PORT GPIO port struct pointer. It could be PA, PB, PC, PD, PF.
* @param[in] u32Pin The pin of specified GPIO port. It could be 0 ~ 15.
* @param[in] u32Attribs The interrupt attribute of specified GPIO pin. It could be \n
* GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.
*
* @return None
*
* @details This function is used to enable specified GPIO pin interrupt.
*/
static __INLINE void GPIO_EnableInt(GPIO_T *PORT, uint32_t u32Pin, uint32_t u32IntAttribs)
{
PORT->IMD = PORT->IMD & (~(1UL<<u32Pin)) | (((u32IntAttribs&0x80000000UL)>>31) << u32Pin);
PORT->IEN = PORT->IEN & (~(0x00010001UL<<u32Pin)) | ((u32IntAttribs & 0x7FFFFFFFUL) << u32Pin);
}
/**
* @brief Disable GPIO interrupt
*
* @param[in] PORT GPIO port struct pointer. It could be PA, PB, PC, PD, PF.
* @param[in] u32Pin The pin of specified GPIO port. It could be 0 ~ 15.
*
* @return None
*
* @details This function is used to disable specified GPIO pin interrupt.
*/
static __INLINE void GPIO_DisableInt(GPIO_T *PORT, uint32_t u32Pin)
{
PORT->IMD &= (~(1UL << u32Pin));
PORT->IEN &= (~((0x00010001UL) << u32Pin));
}
|