MCPcopy Create free account
hub / github.com/FastLED/FastLED / allocate_timer

Function allocate_timer

src/platforms/arm/samd/isr_samd.hpp:165–181  ·  view source on GitHub ↗

Allocate a free timer

Source from the content-addressed store, hash-verified

163
164// Allocate a free timer
165static 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
184static void free_timer(u8 timer_idx) FL_NOEXCEPT {

Callers 1

attach_timer_handlerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected