HAL库的EXTI整的真简单,直接合并到GPIO配置里面了。
1、初始化实现地区是方便了不少
/**
* @brief Configures EXTI lines 15 to 10 (connected to PC.13 pin) in interrupt mode
* @param None
* @retval None
*/
static void EXTI15_10_IRQHandler_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIOC clock */
__HAL_RCC_GPIOC_CLK_ENABLE();
/* Configure PC.13 pin as input floating */
GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_13;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Enable and set EXTI lines 15 to 10 Interrupt to the lowest priority */
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
} |