M0518设置IO中断的库函数是不是有问题?
/**
* @brief Enable GPIO interrupt
*
* @param[in] port GPIO port. It could be PA, PB, PC, PD, PE or PF.
* @param[in] u32Pin The pin of specified GPIO port.
* It could be 0 ~ 15 for PA and PB GPIO port.
* It could be 0 ~ 3, 6 ~ 11, BIT14 and BIT15 for PC GPIO port.
* It could be 6, 7, 14 and BIT15 for PD GPIO port.
* It could be 5 for PE GPIO port.
* It could be 0, 1 and 4 ~ 8 for PF GPIO port.
* @param[in] u32IntAttribs 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.
*/
void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
{
port->IMD |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
port->IEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
}
设置PC的9/10/11脚上升沿中断:
GPIO_EnableInt(PC, BIT11 | BIT10 | BIT9, GPIO_INT_RISING); |