FastLED 3.9.15
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 106 of file adapter.cpp.hpp.

106 {
108 size_t numLeds = controller.size();
109
110 // Validate bounds
111 if (start >= numLeds) {
112 start = numLeds > 0 ? numLeds - 1 : 0;
113 }
114 if (end > numLeds) {
115 end = numLeds;
116 }
117 if (end <= start) {
118 end = start + 1;
119 if (end > numLeds) {
120 end = numLeds;
121 start = end > 0 ? end - 1 : 0;
122 }
123 }
124
125 mSegmentStart = start;
127 mHasSegment = true;
128}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
CLEDController * 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

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

Referenced by ~FastLEDAdapter().

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