gpio外部中断exti_isr
-
初始化
__SYSTEM_GPIO_CLK_ENABLE();
// EXTI interrupt
GPIO_Handle.Pin = GPIO_PIN_0|GPIO_PIN_1;
GPIO_Handle.Mode = GPIO_MODE_EXTI_IT_FALLING;
GPIO_Handle.Pull = GPIO_PULLUP;gpio_init(GPIO_B, &GPIO_Handle); exti_interrupt_enable(EXTI_LINE8_PB0); exti_interrupt_enable(EXTI_LINE9_PB1); NVIC_EnableIRQ(GPIO_IRQn);
识别中断
void exti_isr(void)
{
if (exti_get_LineStatus(EXTI_LINE8_PB0))
{
exti_clear_LineStatus(EXTI_LINE8_PB0);
// cpu_to_pmu_ctrl();
// sleep_state = 0;
// system_sleep_enable();
co_printf("this is exti line 8 \r\n");
}if (exti_get_LineStatus(EXTI_LINE9_PB1)) { exti_clear_LineStatus(EXTI_LINE9_PB1);
// cpu_to_pmu_ctrl();
// sleep_state = 0;
// system_sleep_enable();
co_printf("this is exti line 9 \r\n");
}
}
-
这是遇到啥问题,是不是初始化下降沿触发,但上升沿信号也会触发中断
-
外部中断exti使用是有例程的,参考\examples\none_evm\peripheral_demo\gpio