U
代码如下:
__attribute__((section("ram_code"))) void pmu_gpio_isr_ram(void)
{
uint32_t gpio_value = ool_read32(PMU_REG_GPIOA_V);
// PB5
if (gpio_value & GPIO_PB5)
{
co_printf("%s gpio_value: %x\r\n", __func__, gpio_value);
}
else
{
button_toggle_detected(gpio_value);
}
// co_printf(" %s gpio_value: %x\r\n", __func__, gpio_value);
ool_write32(PMU_REG_PORTA_LAST, gpio_value);
}
void user_key_init(void)
{
// 设置上拉 PD7 按键
pmu_set_pin_pull(KEY_GPIO_PORT, (1 << KEY_GPIO_BIT), true);
// PB5 外部中断引脚
pmu_set_pin_pull(GPIO_PORT_B, (1 << GPIO_BIT_5), true);
// PD7 PB5
pmu_port_wakeup_func_set(KEY_GPIO | GPIO_PB5);
button_init(KEY_GPIO);
}
问题如下:现在有PB5和PD7都设置中断唤醒,在中断处理函数pmu_gpio_isr_ram中如何区分是PD7引脚的中断,还是PB5的中断呢?