Search found 1 match

by Janux31
Tue Sep 03, 2024 9:00 am
Forum: ESP32 Arduino
Topic: Is it safe to update a timer in an interrupt routine (ISR) ?
Replies: 0
Views: 1659

Is it safe to update a timer in an interrupt routine (ISR) ?

Hello,

I would like to reset the value of a timer counter in an ISR. Is this safe? Do I need to take any precautions (semaphore, portENTER_CRITICAL_ISR)?

Example:

Code: Select all

void ARDUINO_ISR_ATTR myISR() {
    timerWrite(timer, newValue);
    timerRestart(timer);
}
Thanks.