100microsecond timer in esp32

matthew798
Posts: 16
Joined: Mon Jun 01, 2020 2:31 am

Re: 100microsecond timer in esp32

Postby matthew798 » Fri Aug 07, 2020 10:00 pm

ESP_igrr wrote:
Tue Apr 25, 2017 11:07 am
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
}
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.

To quote the docs https://docs.espressif.com/projects/esp ... interrupts
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().
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.

Who is online

Users browsing this forum: Bing [Bot] and 124 guests