Re: 100microsecond timer in esp32
Posted: Fri Aug 07, 2020 10:00 pm
Just wondering why you re-enable the alarm. IIRC When you set TIMERG0.hw_timer[0].config.autoreload it should remain enabled even after the alarm is triggered.static void timer_isr(void* arg)
{
TIMERG0.int_clr_timers.t0 = 1;
TIMERG0.hw_timer[0].config.alarm_en = 1;
// your code, runs in the interrupt
}
To quote the docs https://docs.espressif.com/projects/esp ... interrupts
I don't deny that it works, tho. I just tried it and it has fixed an issue i've been having. Just wondering if it's a mistake in the docs or if I'm just not interpreting them correctly.When auto_reload is enabled, the timer’s counter will automatically be reloaded to start counting again from a previously configured value. This value should be set in advance with timer_set_counter_value().