LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
out_spiled.h
Go to the documentation of this file.
1
2#pragma once
3#include "options.h"
4#include "colorchannel.h"
5#ifndef SPILED_DISABLE
6#include <abstractout.h>
7#include <item.h>
8
9#ifdef ADAFRUIT_LED
10#include <Adafruit_NeoPixel.h>
11#else
12#include "FastLED.h"
13#endif
14
35class out_SPILed : public colorChannel {
36public:
37
38 //out_SPILed(Item * _item):colorChannel(_item){getConfig();};
39 //out_SPILed(){};
41 void link(Item * _item){colorChannel::link(_item);if (_item) getConfig();};
43 int Setup() override;
45 int Stop() override;
47 int getChanType() override;
48 //int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
49 //int Ctrl(itemCmd cmd, char* subItem=NULL) override;
51 int PixelCtrl(itemCmd cmd, char* subItem=NULL, bool show=true, bool authorized = false ) override;
52 //int PixelCtrl(itemCmd cmd, int from =0 , int to = 1024, bool show = 1) override;
56 int8_t pin;
59protected:
61 void getConfig();
62};
63#endif
A single LightHub item (virtual channel).
Definition item.h:232
void link(Item *_item)
Attach to an item; retrieve and store the base address and the number of channel addresses.
Definition colorchannel.h:29
colorChannel()
Default constructor.
Definition colorchannel.h:27
Command + value container passed between items, drivers and MQTT.
Definition itemCmd.h:306
Addressable LED strip driver, SPI-like data protocol (CH_SPILED = 11).
Definition out_spiled.h:35
int8_t pin
Data pin of the strip.
Definition out_spiled.h:56
int numLeds
Number of LEDs on the strip.
Definition out_spiled.h:54
int Stop() override
Turn off the strip and free the LED buffer.
Definition out_spiled.cpp:69
void getConfig()
Read data pin, LED count and LED type from the item arguments.
Definition out_spiled.cpp:28
int ledsType
LED data order / speed flags.
Definition out_spiled.h:58
int getChanType() override
Channel type derived from the LED strip type (RGB or RGBW).
Definition out_spiled.cpp:87
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.
Definition out_spiled.cpp:96
void link(Item *_item)
Attach to an item and read the strip configuration.
Definition out_spiled.h:41
int Setup() override
Allocate and initialize the LED strip (FastLED / Adafruit_NeoPixel).
Definition out_spiled.cpp:43
Item (virtual channel) system of LightHub.