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

◆ addLeds() [2/16]

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 110 of file FastLED.cpp.

112 {
113 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
114 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
115
116 pLed->init();
117 pLed->setLeds(data + nOffset, nLeds);
119 fl::EngineEvents::onStripAdded(pLed, nLedsOrOffset - nOffset);
120 return *pLed;
121}
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:74
void setMaxRefreshRate(fl::u16 refresh, bool constrain=false)
Set the maximum refresh rate.
Definition FastLED.cpp:372
CLEDController & setLeds(CRGB *data, int nLeds)
Set the default array of LEDs to be used by this controller.
virtual fl::u16 getMaxRefreshRate() const
Gets the maximum possible refresh rate of the strip.
virtual void init()=0
Initialize the LED controller.
static void onStripAdded(CLEDController *strip, fl::u32 num_leds)

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

Referenced by _FL_MAP_CLOCKED_CHIPSET(), addLeds(), and addLeds().

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