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

Function ensureIsrActive

src/fl/system/pin.cpp.hpp:175–192  ·  view source on GitHub ↗

Ensure ISR timer is running (lazy init)

Source from the content-addressed store, hash-verified

173
174// Ensure ISR timer is running (lazy init)
175int ensureIsrActive() {
176 PwmStateData& st = state();
177 if (st.isr_active) return 0;
178
179 fl::isr::config cfg;
180 cfg.handler = pwm_isr_handler;
181 cfg.frequency_hz = ISR_FREQUENCY_HZ;
182 cfg.priority = fl::isr::ISR_PRIORITY_MEDIUM;
183 cfg.flags = fl::isr::ISR_FLAG_IRAM_SAFE;
184
185 int result = fl::isr::attach_timer_handler(cfg, &st.isr_handle);
186 if (result != 0) {
187 FL_WARN("PWM: ISR attach failed: " << fl::isr::get_error_string(result));
188 return result;
189 }
190 st.isr_active = true;
191 return 0;
192}
193
194// Shutdown ISR if no ISR-backend channels remain
195void maybeShutdownIsr() {

Callers 1

setPwmFrequencyFunction · 0.85

Calls 2

attach_timer_handlerFunction · 0.50
get_error_stringFunction · 0.50

Tested by

no test coverage detected