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

Method clear

src/fl/control/wled/adapter.cpp.hpp:51–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void FastLEDAdapter::clear(bool writeToStrip) {
52 CLEDController& controller = FastLED[mControllerIndex];
53 CRGB* leds = controller.leds();
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}
75
76void FastLEDAdapter::setBrightness(u8 brightness) {
77 FastLED.setBrightness(brightness);

Callers

nothing calls this directly

Calls 3

ledsMethod · 0.45
sizeMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected