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

Janux31
Posts: 1
Joined: Tue Sep 03, 2024 8:47 am

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

Postby Janux31 » 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:

Code: Select all

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

Who is online

Users browsing this forum: No registered users and 127 guests