I was having a look at IntervalTimer::beginCycles() and noticed that, in theory, there might be a race condition with the channel search.
The scenario:
I was wondering why the free channel search isn't wrapped with __disable_irq()/__enable_irq()?
The scenario:
- Call begin(). Internally, beginCycles() finds an open channel, say channel 1, and is about to change channel->TCTRL.
- An interrupt happens and in the ISR, another begin() call is made to a different IntervalTimer instance.
- Before the ISR ends, it finds the first open channel, say channel 1, and then sets it up.
- The original code resumes and now tries to set up channel 1.
I was wondering why the free channel search isn't wrapped with __disable_irq()/__enable_irq()?