I am unsure on what to use instead (what is appreciated) - because not using these spinlocks will, sort of, block the timer interrupt.timer_spinlock_take' is deprecated
timer_spinlock_give' is deprecated
The ISR, as is, works perfectly - what is the right way to handle timer interrupts according to the "new" ESP-IDF framework?
My timer ISR:
Code: Select all
void IRAM_ATTR timer_group0_isr(void *para)
{
// Enter critical section
timer_spinlock_take(TIMER_GROUP_0);
/* Retrieve the interrupt status */
uint32_t timer_intr = timer_group_get_intr_status_in_isr(TIMER_GROUP_0);
/* If Timer 0 interrupt -> stop the timer, clear the interrupt and turn heating off */
if (timer_intr & TIMER_INTR_T0) {
timer_pause(TIMER_GROUP_0, TIMER_0);
timer_group_clr_intr_status_in_isr(TIMER_GROUP_0, TIMER_0);
// Heating off
gpio_set_level(HEATING, HEAT_OFF);
}
// Re-enable timer interrupt
timer_group_enable_alarm_in_isr(TIMER_GROUP_0, TIMER_0);
// Exit critical section
timer_spinlock_give(TIMER_GROUP_0);
}