Is it safe to update a timer in an interrupt routine (ISR) ?
Posted: Tue Sep 03, 2024 9:00 am
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:
Thanks.
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);
}