FastLED 3.10.6
Loading...
Searching...
No Matches

◆ Channel() [1/4]

fl::Channel::Channel ( const ChipsetVariant & chipset,
fl::span< CRGB > leds,
EOrder rgbOrder,
const ChannelOptions & options )
private

Private constructor (use create() factory method)

Parameters
chipsetChipset configuration (clockless or SPI)
ledsLED data array
rgbOrderRGB channel ordering
optionsChannel options (correction, temperature, dither, rgbw, affinity)

Definition at line 342 of file channel.cpp.hpp.

344 : CPixelLEDController<RGB>(RegistrationMode::DeferRegister) // Defer registration until FastLED.add()
345 , mChipset(chipset)
347 , mRgbOrder(rgbOrder)
348 , mDriver() // Empty weak_ptr - late binding on first showPixels()
349 , mBus(options.mBus) // Bus selection (#2459)
350 , mBusWhich(options.mBusWhich)
351 , mId(nextId())
352 , mName(makeName(mId)) {
353 // NOTE: Do NOT call fl::pinMode() here. The pin may already be
354 // configured for SPI output by a persistent driver (ChannelEngineSpi).
355 // Calling pinMode(InputPulldown) would disconnect the SPI MOSI from the
356 // GPIO matrix, causing subsequent transmissions to produce no output.
357 // The driver will configure the pin when it first uses it.
358
359 // Set the LED data array
360 setLeds(leds);
361
362 // Initialize the inherited per-channel controller settings so mWhiteCfg
363 // and future ChannelOptions fields survive to showPixels(). The setter
364 // calls below are idempotent overlays on the same data.
366
367 // Set color correction/temperature/dither/rgbw from ChannelOptions
368 if (!options.hasColorProfile()) { setCorrection(options.mCorrection); setTemperature(options.mTemperature); }
369 setDither(options.mDitherMode);
370 applyWhiteCfg(*this, options);
371
372 // Create ChannelData during construction with chipset variant
374}
@ DeferRegister
Defer registration until addToList() is called.
CLEDController & setTemperature(CRGB temperature) FL_NO_EXCEPT
Set the color temperature, aka white point, for this controller.
CLEDController & setLeds(CRGB *data, int nLeds) FL_NO_EXCEPT
Set the default array of LEDs to be used by this controller.
ChannelOptions mSettings
Optional channel settings (correction, temperature, dither, rgbw, affinity)
CLEDController & setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NO_EXCEPT
Set the dithering mode for this controller to use.
CLEDController & setCorrection(CRGB correction) FL_NO_EXCEPT
The color corrction to use for this controller, expressed as a CRGB object.
EOrder mRgbOrder
Definition channel.h:393
static fl::string makeName(i32 id, const fl::optional< fl::string > &configName=fl::optional< fl::string >())
fl::u8 mBusWhich
Definition channel.h:417
fl::span< CRGB > leds()
Get the LED array as a span (non-const)
ChipsetVariant mChipset
Definition channel.h:391
PixelEncoder mPixelEncoder
Definition channel.h:392
ChannelDataPtr mChannelData
Definition channel.h:435
static PixelEncoder selectPixelEncoder(const ChipsetVariant &) FL_NO_EXCEPT
The chipset is fixed when a Channel is constructed, so bind its pixel encoder once instead of switchi...
static i32 nextId()
fl::weak_ptr< IChannelDriver > mDriver
Definition channel.h:411
const i32 mId
Definition channel.h:433
fl::string mName
Definition channel.h:434
static ChannelDataPtr create(const ChipsetVariant &chipset, fl::vector_psram< u8 > &&encodedData=fl::vector_psram< u8 >(), ChannelPixelFormat pixelFormat=ChannelPixelFormat::RGB) FL_NO_EXCEPT
Create channel transmission data (modern variant-based API)
Definition data.cpp.hpp:12
void applyWhiteCfg(CLEDController &ctrl, const ChannelOptions &options) FL_NO_EXCEPT
Apply the white-channel selection from ChannelOptions to a CLEDController.

References CPixelLEDController< RGB >::CPixelLEDController(), fl::ChannelData::create(), fl::CLEDController::DeferRegister, fl::FL_NO_EXCEPT, leds(), makeName(), mBus, mBusWhich, mChannelData, mChipset, mDriver, mId, mName, mPixelEncoder, mRgbOrder, fl::CLEDController::mSettings, nextId(), selectPixelEncoder(), fl::CLEDController::setCorrection(), fl::CLEDController::setDither(), fl::CLEDController::setLeds(), and fl::CLEDController::setTemperature().

Referenced by Channel(), Channel(), encodeAPA102(), encodeHD108(), encodeLPD6803(), encodeLPD8806(), encodeMY9221(), encodeP9813(), encodeSK9822(), encodeSM16716(), encodeTM1812RGBWW(), encodeTM1908(), encodeUCS7604(), encodeWS2801(), encodeWS2803(), encodeWS2812(), isEnabled(), operator=(), operator=(), setGamma(), setScreenMap(), setScreenMap(), setScreenMap(), and setScreenMap().

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