LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
colorChannel Class Referenceabstract

Base class for multi-channel color output drivers (PWM, LED strip). More...

#include <colorchannel.h>

Inheritance diagram for colorChannel:

Public Member Functions

 colorChannel ()
 Default constructor.
void link (Item *_item)
 Attach to an item; retrieve and store the base address and the number of channel addresses.
int Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override
 Dispatch /set, /HSV and /cmd ON/OFF commands to PixelCtrl.
virtual int PixelCtrl (itemCmd cmd, char *subItem=NULL, bool show=true, bool authorized=false)=0
 Apply the color/brightness command to the output (implemented by the driver).
short getChannelAddr (short n=0)
 Get the pin address of the n-th channel (n=0 - base address).
Public Member Functions inherited from abstractOut
 abstractOut ()
virtual int isActive ()
virtual bool isAllowed (itemCmd cmd)
virtual itemCmd getDefaultOnVal ()
virtual int getChanType ()
virtual int Status () override
virtual void setStatus (uint8_t status) override
int Setup () override
Item * getItem ()
Public Member Functions inherited from abstractCh
 abstractCh ()
virtual ~abstractCh ()
virtual int Poll (short cause)
virtual int Stop ()

Protected Attributes

short iaddr
short numArgs
Protected Attributes inherited from abstractOut
Item * item
 Item currently linked to this driver.

Additional Inherited Members

Protected Member Functions inherited from abstractOut
int pubAction (bool state)
Protected Member Functions inherited from abstractCh
int publishTopic (const char *topic, long value, const char *subtopic=NULL)
int publishTopic (const char *topic, float value, const char *subtopic=NULL)
int publishTopic (const char *topic, const char *value, const char *subtopic=NULL, const char *suffix=NULL)

Detailed Description

Base class for multi-channel color output drivers (PWM, LED strip).

Holds the base pin address and the number of configured channel addresses and implements the common color control logic; the actual output is delegated to the derived PixelCtrl().

Color state is stored in HSV: hue 0..365, saturation 0..100, value 0..255, plus an optional color temperature (153..500 mireds) used by RGBWW channels to mix the two white channels.

Control (Ctrl) suffixes: /set (percent or color value), /HSV, /cmd ON/OFF (ON restores the stored value, OFF clears it).

Constructor & Destructor Documentation

◆ colorChannel()

colorChannel::colorChannel ( )
inline

Default constructor.

Member Function Documentation

◆ Ctrl()

int colorChannel::Ctrl ( itemCmd cmd,
char * subItem = NULL,
bool toExecute = true,
bool authorized = false )
overridevirtual

Dispatch /set, /HSV and /cmd ON/OFF commands to PixelCtrl.

Implements abstractOut.

◆ getChannelAddr()

short colorChannel::getChannelAddr ( short n = 0)

Get the pin address of the n-th channel (n=0 - base address).

◆ link()

void colorChannel::link ( Item * _item)
inlinevirtual

Attach to an item; retrieve and store the base address and the number of channel addresses.

Reimplemented from abstractOut.

Reimplemented in out_SPILed.

◆ PixelCtrl()

virtual int colorChannel::PixelCtrl ( itemCmd cmd,
char * subItem = NULL,
bool show = true,
bool authorized = false )
pure virtual

Apply the color/brightness command to the output (implemented by the driver).

Implemented in out_dmx, out_pwm, and out_SPILed.

Member Data Documentation

◆ iaddr

short colorChannel::iaddr
protected

◆ numArgs

short colorChannel::numArgs
protected

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