Allocate a free timer
| 163 | |
| 164 | // Allocate a free timer |
| 165 | static bool allocate_timer(u8& timer_idx) FL_NOEXCEPT { |
| 166 | // Critical section: prevent interrupt from modifying allocation state |
| 167 | __disable_irq(); |
| 168 | |
| 169 | bool found = false; |
| 170 | for (u8 i = MIN_TIMER_INDEX; i <= MAX_TIMER_INDEX; i++) { |
| 171 | if (!timer_allocated[i]) { |
| 172 | timer_allocated[i] = true; |
| 173 | timer_idx = i; |
| 174 | found = true; |
| 175 | break; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | __enable_irq(); |
| 180 | return found; |
| 181 | } |
| 182 | |
| 183 | // Free a timer |
| 184 | static void free_timer(u8 timer_idx) FL_NOEXCEPT { |
no outgoing calls
no test coverage detected