void Exti_Init(void)
{
TUYA_GPIO_IRQ_T EXTI_InitStructure;
TUYA_GPIO_IRQ_T OCP_InitStructure;
Code: Select all
EXTI_InitStructure.mode = TUYA_GPIO_IRQ_FALL;
EXTI_InitStructure.cb = Exti_ISR;
tal_gpio_irq_init(TUYA_GPIO_NUM_3, &EXTI_InitStructure);
tal_mysource_debug("TUYA_GPIO_NUM_3 Exti_Init \n");
OCP_InitStructure.mode = TUYA_GPIO_IRQ_FALL;
OCP_InitStructure.cb = Exti_IRQHandler;
tal_gpio_irq_init(TUYA_GPIO_NUM_14, &OCP_InitStructure);
tal_mysource_debug("TUYA_GPIO_NUM_14 Exti_Init \n");
}
// 管脚中断函数
void Exti_ISR(void)
{
// set key flag
hal_timer_set(AP_TIMER_ID_6, 1000);
tal_gpio_irq_disable(TUYA_GPIO_NUM_3); // close the gpio interrupt
tal_mysource_debug("tuya ble key ok!\n");
}
void Exti_IRQHandler(void)
{
Code: Select all
tal_gpio_irq_disable(TUYA_GPIO_NUM_14);
hal_pwm_stop();
OutputRetry_Timeout = OutputRetry_Timeset;
tal_mysource_debug("timer6 with OCP_protect !\n");
}
按下KEY(GPIO 3)按键按下出现[0000000055 TUYA D][my_source.c:186] timer6 with OCP_protect !