Page 1 of 1

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

Posted: Tue Sep 03, 2024 9:00 am
by Janux31
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.