FastLED 3.9.15
Loading...
Searching...
No Matches

◆ clear()

void fl::FastLEDAdapter::clear ( bool writeToStrip = false)
overridevirtual

Clear all LEDs (set to black)

Parameters
writeToStripIf true, immediately write to strip (call show())

Implements fl::IFastLED.

Definition at line 51 of file adapter.cpp.hpp.

51 {
54 if (!leds) {
55 return;
56 }
57
58 if (mHasSegment) {
59 // Clear only the segment
60 for (size_t i = mSegmentStart; i < mSegmentEnd; i++) {
61 leds[i] = CRGB::Black;
62 }
63 } else {
64 // Clear all LEDs
65 size_t numLeds = controller.size();
66 for (size_t i = 0; i < numLeds; i++) {
67 leds[i] = CRGB::Black;
68 }
69 }
70
71 if (writeToStrip) {
72 FastLED.show();
73 }
74}
fl::CRGB leds[NUM_LEDS]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
CLEDController * controller
void show(fl::u8 scale)
Update all our controllers with the current led colors, using the passed in brightness.
CRGB * leds() FL_NOEXCEPT
Pointer to the CRGB array for this controller.
virtual int size() const FL_NOEXCEPT
How many LEDs does this controller manage?
size_t mSegmentEnd
Definition adapter.h:72
size_t mSegmentStart
Definition adapter.h:71
fl::CLEDController CLEDController
fl::CRGB CRGB
Definition video.h:15
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510

References fl::CRGB::Black, controller, FastLED, leds, mControllerIndex, mHasSegment, mSegmentEnd, and mSegmentStart.

Referenced by ~FastLEDAdapter().

+ Here is the caller graph for this function: