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

◆ Channel() [2/5]

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 219 of file channel.cpp.hpp.

221 : CPixelLEDController<RGB>(RegistrationMode::DeferRegister) // Defer registration until FastLED.add()
222 , mChipset(chipset)
223 , mRgbOrder(rgbOrder)
224 , mDriver() // Empty weak_ptr - late binding on first showPixels()
225 , mBus(options.mBus) // Bus selection (#2459)
226 , mId(nextId())
227 , mName(makeName(mId)) {
228 // NOTE: Do NOT call fl::pinMode() here. The pin may already be
229 // configured for SPI output by a persistent driver (ChannelEngineSpi).
230 // Calling pinMode(InputPulldown) would disconnect the SPI MOSI from the
231 // GPIO matrix, causing subsequent transmissions to produce no output.
232 // The driver will configure the pin when it first uses it.
233
234 // Set the LED data array
235 setLeds(leds);
236
237 // Sync mSettings from ChannelOptions so the mWhiteCfg variant (and any
238 // other future fields) survives to showPixels(). The setter calls below
239 // are then idempotent overlays on top of the same data.
240 mSettings = options;
241
242 // Set color correction/temperature/dither/rgbw from ChannelOptions
243 setCorrection(options.mCorrection);
244 setTemperature(options.mTemperature);
245 setDither(options.mDitherMode);
246 applyWhiteCfg(*this, options);
247
248 // Create ChannelData during construction with chipset variant
250}
CLEDController & setCorrection(CRGB correction) FL_NOEXCEPT
The color corrction to use for this controller, expressed as a CRGB object.
@ DeferRegister
Defer registration until addToList() is called.
CLEDController & setLeds(CRGB *data, int nLeds) FL_NOEXCEPT
Set the default array of LEDs to be used by this controller.
CLEDController & setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NOEXCEPT
Set the dithering mode for this controller to use.
CLEDController & setTemperature(CRGB temperature) FL_NOEXCEPT
Set the color temperature, aka white point, for this controller.
EOrder mRgbOrder
Definition channel.h:255
static fl::string makeName(i32 id, const fl::optional< fl::string > &configName=fl::optional< fl::string >())
fl::span< CRGB > leds()
Get the LED array as a span (non-const)
ChipsetVariant mChipset
Definition channel.h:254
ChannelDataPtr mChannelData
Definition channel.h:279
static i32 nextId()
fl::weak_ptr< IChannelDriver > mDriver
Definition channel.h:256
const i32 mId
Definition channel.h:276
fl::string mName
Definition channel.h:277
ChannelOptions mSettings
Definition channel.h:278
static ChannelDataPtr create(const ChipsetVariant &chipset, fl::vector_psram< u8 > &&encodedData=fl::vector_psram< u8 >()) FL_NOEXCEPT
Create channel transmission data (modern variant-based API)
Definition data.cpp.hpp:12
void applyWhiteCfg(CLEDController &ctrl, const ChannelOptions &options) FL_NOEXCEPT
Apply the white-channel selection from ChannelOptions to a CLEDController.

References CPixelLEDController< RGB >::CPixelLEDController(), fl::ChannelData::create(), fl::CLEDController::DeferRegister, leds(), makeName(), mBus, mChannelData, mChipset, fl::ChannelOptions::mCorrection, fl::ChannelOptions::mDitherMode, mDriver, mId, mName, mRgbOrder, mSettings, fl::ChannelOptions::mTemperature, nextId(), fl::RGB, fl::CLEDController::setCorrection(), fl::CLEDController::setDither(), fl::CLEDController::setLeds(), and fl::CLEDController::setTemperature().

+ Here is the call graph for this function: