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

◆ setSegment()

void fl::FastLEDAdapter::setSegment ( size_t start,
size_t end )
overridevirtual

Set a segment range for subsequent operations.

Parameters
startStarting LED index (inclusive)
endEnding LED index (exclusive)

After calling this, getLEDs() and getNumLEDs() will operate on the specified segment only.

Implements fl::IFastLED.

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

115 {
117 size_t numLeds = controller.size();
118
119 // Validate bounds
120 if (start >= numLeds) {
121 start = numLeds > 0 ? numLeds - 1 : 0;
122 }
123 if (end > numLeds) {
124 end = numLeds;
125 }
126 if (end <= start) {
127 end = start + 1;
128 if (end > numLeds) {
129 end = numLeds;
130 start = end > 0 ? end - 1 : 0;
131 }
132 }
133
134 mSegmentStart = start;
136 mHasSegment = true;
137}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
CLEDController * controller
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
size_t mSegmentEnd
Definition adapter.h:72
size_t mSegmentStart
Definition adapter.h:71
fl::CLEDController CLEDController

References controller, fl::adl_barrier::end(), FastLED, fl::FL_NO_EXCEPT, mControllerIndex, mHasSegment, mSegmentEnd, and mSegmentStart.

Referenced by ~FastLEDAdapter().

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