FastLED 3.10.6
Loading...
Searching...
No Matches

◆ clearLedDataInternal()

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

Zero out the LED data managed by this controller.

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

59 {
60 // On common code that runs on avr, every byte counts.
61 //
62 // mLeds spans one lane, not the whole buffer. A parallel controller is
63 // registered with the PER-LANE count -- addLeds<NUM_LANES, ...>(data,
64 // nLeds) forwards nLeds -- while the caller's array is NUM_LANES * nLeds.
65 // Clearing mLeds.size() therefore blanked only the first strip and left
66 // the rest lit, which is FastLED#1017.
67 //
68 // lanes() is 1 for every ordinary controller, so this is a no-op there. It
69 // reports the template lane count on parallel controllers, which is what
70 // the caller allocated, so this cannot run past the end of their array
71 // even when fewer lanes were actually claimed.
72 fl::u16 n = nLeds >= 0 ? static_cast<fl::u16>(nLeds)
73 : static_cast<fl::u16>(mLeds.size() * lanes());
74 if (mLeds.data()) {
75 fl::memset((void*)mLeds.data(), 0, sizeof(CRGB) * n);
76 }
77
78}
virtual int lanes() FL_NO_EXCEPT
How many Lanes does this controller manage?
virtual 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 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: