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

◆ addLeds() [1/15]

CLEDController & CFastLED::addLeds ( CLEDController * pLed,
struct CRGB * data,
int nLedsOrOffset,
int nLedsIfOffset = 0 )
static

Add a CLEDController instance to the world.

Exposed to the public to allow people to implement their own CLEDController objects or instances. There are two ways to call this method (as well as the other addLeds() variations). The first is with 3 arguments, in which case the arguments are the controller, a pointer to led data, and the number of leds used by this controller. The second is with 4 arguments, in which case the first two arguments are the same, the third argument is an offset into the CRGB data where this controller's CRGB data begins, and the fourth argument is the number of leds for this controller object.

Parameters
pLedthe led controller being added
database pointer to an array of CRGB data structures
nLedsOrOffsetnumber of leds (3 argument version) or offset into the data array
nLedsIfOffsetnumber of leds (4 argument version)
Returns
a reference to the added controller

Definition at line 92 of file FastLED.cpp.

94 {
95 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
96 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
97
98 pLed->init();
99 pLed->setLeds(data + nOffset, nLeds);
101 fl::EngineEvents::onStripAdded(pLed, nLedsOrOffset - nOffset);
102 return *pLed;
103}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
void setMaxRefreshRate(uint16_t refresh, bool constrain=false)
Set the maximum refresh rate.
Definition FastLED.cpp:339
virtual uint16_t getMaxRefreshRate() const
Gets the maximum possible refresh rate of the strip.
CLEDController & setLeds(CRGB *data, int nLeds)
Set the default array of LEDs to be used by this controller.
virtual void init()=0
Initialize the LED controller.
static void onStripAdded(CLEDController *strip, uint32_t num_leds)

References FastLED, CLEDController::getMaxRefreshRate(), CLEDController::init(), fl::EngineEvents::onStripAdded(), and CLEDController::setLeds().

Referenced by addLeds().

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