ESP32 timer and hw_timer_t timer structure
Posted: Tue Jul 04, 2023 1:06 pm
A classical way to setup a timer is for eample
If this code is in a small init function, do we need to declare My_timer as a global variable or can it be local.
I have a running code where it is local but I am not confortable with that.
I can't find the answer in the doc.
Code: Select all
hw_timer_t *My_timer = NULL;
My_timer = timerBegin(0, 80, true);
timerAttachInterrupt(My_timer, &onTimer, true);
timerAlarmWrite(My_timer, 1000000, true);
timerAlarmEnable(My_timer);
I have a running code where it is local but I am not confortable with that.
I can't find the answer in the doc.