LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
out_SPILed Class Reference

Addressable LED strip driver, SPI-like data protocol (CH_SPILED = 11). More...

#include <out_spiled.h>

Inheritance diagram for out_SPILed:

Public Member Functions

void link (Item *_item)
 Attach to an item and read the strip configuration.
int Setup () override
 Allocate and initialize the LED strip (FastLED / Adafruit_NeoPixel).
int Stop () override
 Turn off the strip and free the LED buffer.
int getChanType () override
 Channel type derived from the LED strip type (RGB or RGBW).
int PixelCtrl (itemCmd cmd, char *subItem=NULL, bool show=true, bool authorized=false) override
 Set the LED range (or the whole strip) to ON/OFF or an RGB color and show the result.
Public Member Functions inherited from colorChannel
 colorChannel ()
 Default constructor.
int Ctrl (itemCmd cmd, char *subItem=NULL, bool toExecute=true, bool authorized=false) override
 Dispatch /set, /HSV and /cmd ON/OFF commands to PixelCtrl.
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 Status () override
virtual void setStatus (uint8_t status) override
Item * getItem ()
Public Member Functions inherited from abstractCh
 abstractCh ()
virtual ~abstractCh ()
virtual int Poll (short cause)

Public Attributes

int numLeds
 Number of LEDs on the strip.
int8_t pin
 Data pin of the strip.
int ledsType
 LED data order / speed flags.

Protected Member Functions

void getConfig ()
 Read data pin, LED count and LED type from the item arguments.
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)

Additional Inherited Members

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

Detailed Description

Addressable LED strip driver, SPI-like data protocol (CH_SPILED = 11).

Drives a NeoPixel-compatible LED strip (FastLED or Adafruit_NeoPixel backend) from a single data pin.

JSON config (item argument array):

[11, [data_pin, numLeds, ledsType]]
int numLeds
Number of LEDs on the strip.
Definition out_spiled.h:54
int ledsType
LED data order / speed flags.
Definition out_spiled.h:58
  • data_pin - the strip data line (default 3);
  • numLeds - number of LEDs on the strip (default 43);
  • ledsType - LED data order / speed (e.g. NeoPixel flags), default BRG 800 kHz.

The channel type is derived from ledsType: RGBW if the strip has a white channel, RGB otherwise. A subItem "from-to" (or a single LED number) limits the command to an LED range, otherwise the whole strip is affected.

Member Function Documentation

◆ getChanType()

int out_SPILed::getChanType ( )
overridevirtual

Channel type derived from the LED strip type (RGB or RGBW).

Reimplemented from abstractOut.

◆ getConfig()

void out_SPILed::getConfig ( )
protected

Read data pin, LED count and LED type from the item arguments.

◆ link()

void out_SPILed::link ( Item * _item)
inlinevirtual

Attach to an item and read the strip configuration.

Reimplemented from colorChannel.

◆ PixelCtrl()

int out_SPILed::PixelCtrl ( itemCmd cmd,
char * subItem = NULL,
bool show = true,
bool authorized = false )
overridevirtual

Set the LED range (or the whole strip) to ON/OFF or an RGB color and show the result.

Implements colorChannel.

◆ Setup()

int out_SPILed::Setup ( )
overridevirtual

Allocate and initialize the LED strip (FastLED / Adafruit_NeoPixel).

Reimplemented from abstractOut.

◆ Stop()

int out_SPILed::Stop ( )
overridevirtual

Turn off the strip and free the LED buffer.

Reimplemented from abstractCh.

Member Data Documentation

◆ ledsType

int out_SPILed::ledsType

LED data order / speed flags.

◆ numLeds

int out_SPILed::numLeds

Number of LEDs on the strip.

◆ pin

int8_t out_SPILed::pin

Data pin of the strip.


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