FastLED 3.10.8
Loading...
Searching...
No Matches
fl::Channel Class Reference

Detailed Description

LED channel for parallel output, pretty much a CPixelLEDController but with timing and pin information.

Provides access to LED channel functionality for driving LED strips. RGB_ORDER is set to RGB - reordering is handled internally by the Channel.

Inherits IChannel so ChannelEvents callbacks (and other consumers that only need to identify a channel) can take a non-template reference even after Channel<Bus, Chipset> becomes templated in Phase 3b. See #2428.

Definition at line 60 of file channel.h.

#include <channel.h>

+ Inheritance diagram for fl::Channel:
+ Collaboration diagram for fl::Channel:

Public Member Functions

virtual ~Channel () FL_NO_EXCEPT
 Destructor.
 
void addToDrawList () FL_NO_EXCEPT
 Add this channel to the global controller draw list.
 
void applyConfig (const ChannelConfig &config) FL_NO_EXCEPT
 Apply reconfigurable settings from a ChannelConfig.
 
const Channel * asChannel () const FL_NO_EXCEPT override
 
const CLEDController * asController () const FL_NO_EXCEPT
 
CLEDController * asController () FL_NO_EXCEPT
 Get pointer to base CLEDController for linked list traversal.
 
ColorProfileStatus colorProfileStatus () const FL_NO_EXCEPT
 
u8 ditherPhase () const FL_NO_EXCEPT
 Where this channel is in its dither cycle: the number of frames its driver has accepted, mod 256 (#4347).
 
const EmitterProfile * emitterProfile () const FL_NO_EXCEPT
 
const ChipsetVariant & getChipset () const FL_NO_EXCEPT
 Get the chipset configuration variant.
 
int getClockPin () const FL_NO_EXCEPT
 Get the clock pin for this channel (SPI only, -1 for clockless)
 
CRGB getCorrection () FL_NO_EXCEPT
 Get the color correction.
 
u8 getDither () FL_NO_EXCEPT
 Get the dither mode.
 
fl::string getEngineName () const FL_NO_EXCEPT
 Get the name of the currently bound driver (if any)
 
fl::optional< float > getGamma () const FL_NO_EXCEPT
 Get gamma correction value.
 
int getPin () const FL_NO_EXCEPT
 Get the pin number for this channel (data pin)
 
EOrder getRgbOrder () const FL_NO_EXCEPT
 Get the RGB channel ordering.
 
Rgbw getRgbw () const FL_NO_EXCEPT
 Get the RGBW conversion mode.
 
const fl::ScreenMap & getScreenMap () const FL_NO_EXCEPT
 Get the current screen map.
 
CRGB getTemperature () FL_NO_EXCEPT
 Get the color temperature.
 
const ChipsetTimingConfig & getTiming () const FL_NO_EXCEPT
 Get the timing configuration for this channel (clockless only)
 
bool hasColorProfile () const FL_NO_EXCEPT
 
bool hasColorProfileFallback () const FL_NO_EXCEPT
 
bool hasScreenMap () const FL_NO_EXCEPT
 Check if screen map is configured.
 
i32 id () const FL_NO_EXCEPT override
 Get the channel ID.
 
bool isClockless () const FL_NO_EXCEPT
 Check if this is a clockless chipset.
 
bool isColorManaged () const FL_NO_EXCEPT
 True when the streaming transform is actually installed in the output path, which is not the same question as hasColorProfile(): a binding can be accepted and still fail to build a usable pipeline, and that channel stays on the legacy path.
 
bool isEnabled () const FL_NO_EXCEPT
 
bool isInDrawList () const FL_NO_EXCEPT
 Check if this channel is in the controller draw list.
 
bool isSpi () const FL_NO_EXCEPT
 Check if this is an SPI chipset.
 
fl::span< const CRGB > leds () const FL_NO_EXCEPT
 Get the LED array as a span (const)
 
fl::span< CRGB > leds () FL_NO_EXCEPT
 Get the LED array as a span (non-const)
 
const fl::string & name () const FL_NO_EXCEPT override
 Get the channel name.
 
bool profileBindingAccepted () const FL_NO_EXCEPT
 
void removeFromDrawList () FL_NO_EXCEPT
 Remove this channel from the global controller draw list.
 
Channel & setGamma (float gamma) FL_NO_EXCEPT
 Set gamma correction value.
 
Channel & setScreenMap (const fl::ScreenMap &map) FL_NO_EXCEPT
 Set screen map for JS canvas visualization.
 
Channel & setScreenMap (const fl::XMap &map) FL_NO_EXCEPT
 Set screen map for 1D strip remapping from XMap.
 
Channel & setScreenMap (const fl::XYMap &map, float diameter=-1.f) FL_NO_EXCEPT
 Set screen map for JS canvas visualization from XYMap.
 
Channel & setScreenMap (fl::u16 width, fl::u16 height, float diameter=-1.f) FL_NO_EXCEPT
 Set screen map for JS canvas visualization from dimensions.
 
void showLeds (u8 brightness=255) FL_NO_EXCEPT OVERRIDE_IF_NOT_AVR
 Show the LEDs with optional brightness scaling.
 
int size () const FL_NO_EXCEPT OVERRIDE_IF_NOT_AVR
 Get the number of LEDs in this channel.
 
const SourceProfile & sourceProfile () const FL_NO_EXCEPT
 
Chromaticity targetWhite () const FL_NO_EXCEPT
 
- Public Member Functions inherited from CPixelLEDController< RGB >
 CPixelLEDController () FL_NO_EXCEPT
 
int lanes () FL_NO_EXCEPT override
 Get the number of lanes of the Controller.
 
virtual void showPixels (PixelController< RGB_ORDER, 1, 0xFFFFFFFF > &pixels) FL_NO_EXCEPT=0
 Send the LED data to the strip.
 
- Public Member Functions inherited from fl::CLEDController
 CLEDController () FL_NO_EXCEPT
 Create an led controller object, add it to the chain of controllers.
 
VIRTUAL_IF_NOT_AVR ~CLEDController () FL_NO_EXCEPT
 
void addToList () FL_NO_EXCEPT
 Add this controller to the linked list.
 
VIRTUAL_IF_NOT_AVR void * beginShowLeds (int size) FL_NO_EXCEPT
 
void clearLedDataInternal (int nLeds=-1) FL_NO_EXCEPT
 Zero out the LED data managed by this controller.
 
VIRTUAL_IF_NOT_AVR void clearLeds (int nLeds=-1) FL_NO_EXCEPT
 Clear out/zero out the given number of LEDs.
 
CLEDController & clearWhiteChannel () FL_NO_EXCEPT
 Reset this channel to plain 3-channel RGB (clears any RGBW/RGBWW configuration).
 
VIRTUAL_IF_NOT_AVR void endShowLeds (void *data) FL_NO_EXCEPT
 
CRGB getAdjustment (fl::u8 scale) FL_NO_EXCEPT
 Get the combined brightness/color adjustment for this controller.
 
ColorAdjustment getAdjustmentData (fl::u8 brightness) FL_NO_EXCEPT
 
CRGB getCorrection () FL_NO_EXCEPT
 Get the correction value used by this controller.
 
fl::u8 getDither () const FL_NO_EXCEPT
 Get the dithering option currently set for this controller.
 
bool getEnabled () FL_NO_EXCEPT
 
virtual fl::u16 getMaxRefreshRate () const FL_NO_EXCEPT
 Gets the maximum possible refresh rate of the strip.
 
Rgbw getRgbw () const FL_NO_EXCEPT
 
Rgbww getRgbww () const FL_NO_EXCEPT
 
CRGB getTemperature () FL_NO_EXCEPT
 Get the color temperature, aka white point, for this controller.
 
bool isInList () const FL_NO_EXCEPT
 Check if this controller is in the linked list.
 
const CRGB * leds () const FL_NO_EXCEPT
 Const pointer to the CRGB array for this controller.
 
CRGB * leds () FL_NO_EXCEPT
 Pointer to the CRGB array for this controller.
 
fl::span< CRGB > ledsSpan () FL_NO_EXCEPT
 Span of LEDs managed by this controller.
 
const CLEDController * next () const FL_NO_EXCEPT
 Get the next controller in the linked list after this one (const version).
 
CLEDController * next () FL_NO_EXCEPT
 Get the next controller in the linked list after this one.
 
CRGB & operator[] (int x) FL_NO_EXCEPT
 Reference to the n'th LED managed by the controller.
 
void removeFromDrawList () FL_NO_EXCEPT
 Remove this controller from the draw list.
 
const Rgbw * rgbwConfig () const FL_NO_EXCEPT
 
CLEDController & setCorrection (CRGB correction) FL_NO_EXCEPT
 The color corrction to use for this controller, expressed as a CRGB object.
 
CLEDController & setCorrection (LEDColorCorrection correction) FL_NO_EXCEPT
 The color corrction to use for this controller, expressed as a CRGB object.
 
CLEDController & setDither (fl::u8 ditherMode=BINARY_DITHER) FL_NO_EXCEPT
 Set the dithering mode for this controller to use.
 
void setEnabled (bool enabled) FL_NO_EXCEPT
 
CLEDController & setLeds (CRGB *data, int nLeds) FL_NO_EXCEPT
 Set the default array of LEDs to be used by this controller.
 
CLEDController & setLeds (fl::span< CRGB > leds) FL_NO_EXCEPT
 Set the default array of LEDs to be used by this controller (span version)
 
CLEDController & setRgbw (const Rgbw &arg=RgbwDefault::value()) FL_NO_EXCEPT
 
CLEDController & setRgbww (const Rgbww &arg=RgbwwDefault::value()) FL_NO_EXCEPT
 Configure this channel for 5-channel RGBWW (RGB + warm-W + cool-W) output.
 
CLEDController & setScreenMap (const fl::ScreenMap &map) FL_NO_EXCEPT
 
CLEDController & setScreenMap (const fl::XYMap &map, float diameter=-1.f) FL_NO_EXCEPT
 
CLEDController & setScreenMap (fl::u16 width, fl::u16 height, float diameter=-1.f) FL_NO_EXCEPT
 
CLEDController & setSpiBus (Esp32SpiBus bus) FL_NO_EXCEPT
 Select an ESP-IDF SPI host for this clocked controller before init().
 
CLEDController & setTemperature (ColorTemperature temperature) FL_NO_EXCEPT
 Set the color temperature, aka white point, for this controller.
 
CLEDController & setTemperature (CRGB temperature) FL_NO_EXCEPT
 Set the color temperature, aka white point, for this controller.
 
void showColorInternal (const CRGB &data, fl::u8 brightness) FL_NO_EXCEPT
 
void showColorInternal (const CRGB &data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT
 
void showInternal (const CRGB *data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT
 
VIRTUAL_IF_NOT_AVR void showLeds (fl::u8 brightness) FL_NO_EXCEPT
 
void showLedsInternal (fl::u8 brightness) FL_NO_EXCEPT
 Write the data to the LEDs managed by this controller.
 
VIRTUAL_IF_NOT_AVR int size () const FL_NO_EXCEPT
 How many LEDs does this controller manage?
 
- Public Member Functions inherited from fl::IChannel
virtual ~IChannel () FL_NO_EXCEPT=default
 

Static Public Member Functions

static ChannelPtr create (const ChannelConfig &config) FL_NO_EXCEPT
 Create a new channel with optional mBus driver pinning.
 
template<const EmitterProfile & Profile>
static ChannelPtr create (const ChannelConfig &config) FL_NO_EXCEPT
 
template<ProfileId Id>
static ChannelPtr create (const ChannelConfig &config) FL_NO_EXCEPT
 
- Static Public Member Functions inherited from fl::CLEDController
static CLEDController * head () FL_NO_EXCEPT
 Get the first LED controller in the linked list of controllers.
 
static void removeFromList (CLEDController *controller) FL_NO_EXCEPT
 Remove a controller from the linked list.
 
template<typename Visitor>
static void visitControllers (Visitor &&visitor) FL_NO_EXCEPT
 Visit all controllers in the linked list with a visitor The visitor must be a callable that accepts (const CLEDController*, fl::span<const CRGB>)
 

Protected Types

using PixelEncoder
 
- Protected Types inherited from fl::CLEDController
enum class  RegistrationMode { AutoRegister , DeferRegister }
 Registration mode for constructor. More...
 
enum class  SettingsChange : u8 { Correction , Temperature , Dither , White }
 

Protected Member Functions

void init () FL_NO_EXCEPT override
 Initialize the LED controller.
 
void showPixels (PixelController< RGB, 1, 0xFFFFFFFF > &pixels) FL_NO_EXCEPT override
 
- Protected Member Functions inherited from CPixelLEDController< RGB >
 CPixelLEDController (RegistrationMode mode) FL_NO_EXCEPT
 Protected constructor with registration mode.
 
virtual void show (const CRGB *data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT override
 Write the passed in RGB data out to the LEDs managed by this controller.
 
virtual void showColor (const CRGB &data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT override
 Set all the LEDs on the controller to a given color.
 
- Protected Member Functions inherited from fl::CLEDController
 CLEDController (RegistrationMode mode) FL_NO_EXCEPT
 Protected constructor with registration mode.
 
void applyRgbw (const Rgbw &arg) FL_NO_EXCEPT
 
bool rejectFixedWhiteChannelChange (const char *operation) const FL_NO_EXCEPT
 
void setFixedRgbw (const Rgbw &arg) FL_NO_EXCEPT
 Configure a chipset-owned RGBW policy that public white-channel setters cannot replace.
 
void settingsChanged (SettingsChange change) FL_NO_EXCEPT
 
- Protected Member Functions inherited from fl::IChannel
 IChannel () FL_NO_EXCEPT=default
 
 IChannel (const IChannel &) FL_NO_EXCEPT=delete
 
 IChannel (IChannel &&) FL_NO_EXCEPT=delete
 
IChannel & operator= (const IChannel &) FL_NO_EXCEPT=delete
 
IChannel & operator= (IChannel &&) FL_NO_EXCEPT=delete
 

Private Member Functions

 Channel (Channel &&) FL_NO_EXCEPT=delete
 
 Channel (const Channel &) FL_NO_EXCEPT=delete
 
 Channel (const ChipsetVariant &chipset, fl::span< CRGB > leds, EOrder rgbOrder, const ChannelOptions &options) FL_NO_EXCEPT
 Private constructor (use create() factory method)
 
 Channel (int pin, const ChipsetTimingConfig &timing, fl::span< CRGB > leds, EOrder rgbOrder, const ChannelOptions &options) FL_NO_EXCEPT
 Backwards-compatible constructor (deprecated)
 
FL_NO_INLINE void encodeFrame (PixelController< RGB, 1, 0xFFFFFFFF > &pixels) FL_NO_EXCEPT
 Encode pixels into mChannelData and fire onChannelDataEncoded (#4566).
 
void onSettingsChanged (SettingsChange change) FL_NO_EXCEPT override
 
Channel & operator= (Channel &&) FL_NO_EXCEPT=delete
 
Channel & operator= (const Channel &) FL_NO_EXCEPT=delete
 
FL_NO_INLINE fl::shared_ptr< IChannelDriver > resolveDynamicDriver () FL_NO_EXCEPT
 Cold slow-path helper for showPixels().
 
virtual const EmitterProfile * staticEmitterProfile () const FL_NO_EXCEPT
 
FL_NO_INLINE void submitFrame (const fl::shared_ptr< IChannelDriver > &driver) FL_NO_EXCEPT
 Submit the encoded frame to driver: disabled-driver drop + one-shot diagnostic, enqueue, dither advance, and onChannelEnqueued (#4566).
 
void syncLegacySettings () FL_NO_EXCEPT
 
FL_NO_INLINE bool waitForInUseBuffer () FL_NO_EXCEPT
 Cold helper for showPixels() when mChannelData is still in use by the driver: warns and waits for READY (#4566).
 

Static Private Member Functions

static FL_NO_INLINE void encodeAPA102 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeHD108 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeLPD6803 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeLPD8806 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeMY9221 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeP9813 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeSK9822 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeSM16716 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeTM1812RGBWW (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeTM1908 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeUCS7604 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeWS2801 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeWS2803 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static FL_NO_INLINE void encodeWS2812 (Channel &, PixelIterator &, bool, fl::vector_psram< u8 > &) FL_NO_EXCEPT
 
static fl::string makeName (i32 id, const fl::optional< fl::string > &configName=fl::optional< fl::string >()) FL_NO_EXCEPT
 
static i32 nextId () FL_NO_EXCEPT
 
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 switching over every supported chipset on every frame.
 

Private Attributes

Bus mBus = Bus::AUTO
 
bool mBusWarned = false
 
fl::u8 mBusWhich = 0
 
ChannelDataPtr mChannelData
 
ChipsetVariant mChipset
 
bool mDisabledDriverWarned = false
 
u8 mDitherPhase = 0
 This channel's temporal-dither phase.
 
fl::weak_ptr< IChannelDriver > mDriver
 
const i32 mId
 
fl::string mName
 
PixelEncoder mPixelEncoder = nullptr
 
EOrder mRgbOrder
 
fl::ScreenMap mScreenMap
 
ChannelOptions mSettings
 
bool mStaticProfileCleared = false
 

Friends

template<typename T, typename... Args>
fl::shared_ptr< T > fl::adl_barrier::make_shared (Args &&... args) FL_NO_EXCEPT
 Friend declaration for make_shared to access private constructor.
 
template<const EmitterProfile & Profile>
class StaticProfileChannel
 

Additional Inherited Members

- Static Public Attributes inherited from CPixelLEDController< RGB >
static const int LANES_VALUE
 The number of lanes for this controller.
 
static const fl::u32 MASK_VALUE
 The mask for the lanes for this controller.
 
static const EOrder RGB_ORDER_VALUE
 The RGB ordering for this controller.
 
- Protected Attributes inherited from fl::CLEDController
bool mEnabled: 1
 
bool mFixedWhiteChannel: 1
 chipset wire format owns the white policy
 
fl::span< CRGB > mLeds
 span of LED data used by this controller
 
LegacySettings mLegacySettings
 
CLEDController * mPNext = nullptr
 pointer to the next LED controller in the linked list
 
- Static Protected Attributes inherited from fl::CLEDController
static CLEDController * mPHead = nullptr
 pointer to the first LED controller in the linked list
 

The documentation for this class was generated from the following files: