FastLED 3.10.8
Loading...
Searching...
No Matches

◆ clearLedDataInternal()

void CLEDController::clearLedDataInternal ( int nLeds = -1)

Zero out the LED data managed by this controller.

Definition at line 76 of file cled_controller.cpp.hpp.

76 {
77 // On common code that runs on avr, every byte counts.
78 //
79 // mLeds spans one lane, not the whole buffer. A parallel controller is
80 // registered with the PER-LANE count -- addLeds<NUM_LANES, ...>(data,
81 // nLeds) forwards nLeds -- while the caller's array is NUM_LANES * nLeds.
82 // Clearing mLeds.size() therefore blanked only the first strip and left
83 // the rest lit, which is FastLED#1017.
84 //
85 // lanes() is 1 for every ordinary controller, so this is a no-op there. It
86 // reports the template lane count on parallel controllers, which is what
87 // the caller allocated, so this cannot run past the end of their array
88 // even when fewer lanes were actually claimed.
89 fl::u16 n = nLeds >= 0 ? static_cast<fl::u16>(nLeds)
90 : static_cast<fl::u16>(mLeds.size() * lanes());
91 if (mLeds.data()) {
92 fl::memset((void*)mLeds.data(), 0, sizeof(CRGB) * n);
93 }
94
95}
virtual int lanes() FL_NO_EXCEPT
How many Lanes does this controller manage?
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
fl::span< CRGB > mLeds
span of LED data used by this controller

References fl::FL_NO_EXCEPT, lanes(), fl::memset(), and mLeds.

Referenced by CFastLED::clearData(), and clearLeds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: