2020-11-30 23:33:47 +00:00
|
|
|
#ifndef BusManager_h
|
|
|
|
#define BusManager_h
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class for addressing various light types
|
|
|
|
*/
|
|
|
|
|
2021-01-15 14:43:11 +00:00
|
|
|
#include "const.h"
|
2021-09-21 20:18:55 +00:00
|
|
|
|
2021-02-27 17:46:35 +00:00
|
|
|
#define GET_BIT(var,bit) (((var)>>(bit))&0x01)
|
|
|
|
#define SET_BIT(var,bit) ((var)|=(uint16_t)(0x0001<<(bit)))
|
|
|
|
#define UNSET_BIT(var,bit) ((var)&=(~(uint16_t)(0x0001<<(bit))))
|
2021-02-26 15:05:05 +00:00
|
|
|
|
2021-01-30 19:51:36 +00:00
|
|
|
//temporary struct for passing bus configuration to bus
|
|
|
|
struct BusConfig {
|
2022-03-09 12:39:51 +00:00
|
|
|
uint8_t type;
|
2021-04-01 10:53:01 +00:00
|
|
|
uint16_t count;
|
|
|
|
uint16_t start;
|
|
|
|
uint8_t colorOrder;
|
|
|
|
bool reversed;
|
|
|
|
uint8_t skipAmount;
|
2021-10-07 20:57:07 +00:00
|
|
|
bool refreshReq;
|
2022-03-09 12:39:51 +00:00
|
|
|
uint8_t autoWhite;
|
2021-01-30 19:51:36 +00:00
|
|
|
uint8_t pins[5] = {LEDPIN, 255, 255, 255, 255};
|
2022-03-09 12:39:51 +00:00
|
|
|
BusConfig(uint8_t busType, uint8_t* ppins, uint16_t pstart, uint16_t len = 1, uint8_t pcolorOrder = COL_ORDER_GRB, bool rev = false, uint8_t skip = 0, byte aw=RGBW_MODE_MANUAL_ONLY) {
|
2021-10-07 20:57:07 +00:00
|
|
|
refreshReq = (bool) GET_BIT(busType,7);
|
|
|
|
type = busType & 0x7F; // bit 7 may be/is hacked to include refresh info (1=refresh in off state, 0=no refresh)
|
2022-03-09 12:39:51 +00:00
|
|
|
count = len; start = pstart; colorOrder = pcolorOrder; reversed = rev; skipAmount = skip; autoWhite = aw;
|
2021-01-30 19:51:36 +00:00
|
|
|
uint8_t nPins = 1;
|
2021-10-06 12:30:41 +00:00
|
|
|
if (type >= TYPE_NET_DDP_RGB && type < 96) nPins = 4; //virtual network bus. 4 "pins" store IP address
|
2021-09-21 20:18:55 +00:00
|
|
|
else if (type > 47) nPins = 2;
|
2021-05-21 22:13:49 +00:00
|
|
|
else if (type > 40 && type < 46) nPins = NUM_PWM_PINS(type);
|
2021-01-30 19:51:36 +00:00
|
|
|
for (uint8_t i = 0; i < nPins; i++) pins[i] = ppins[i];
|
|
|
|
}
|
2021-07-09 14:25:23 +00:00
|
|
|
|
|
|
|
//validates start and length and extends total if needed
|
|
|
|
bool adjustBounds(uint16_t& total) {
|
|
|
|
if (!count) count = 1;
|
|
|
|
if (count > MAX_LEDS_PER_BUS) count = MAX_LEDS_PER_BUS;
|
|
|
|
if (start >= MAX_LEDS) return false;
|
|
|
|
//limit length of strip if it would exceed total permissible LEDs
|
|
|
|
if (start + count > MAX_LEDS) count = MAX_LEDS - start;
|
|
|
|
//extend total count accordingly
|
|
|
|
if (start + count > total) total = start + count;
|
|
|
|
return true;
|
|
|
|
}
|
2021-01-30 19:51:36 +00:00
|
|
|
};
|
|
|
|
|
2021-12-31 20:35:27 +00:00
|
|
|
// Defines an LED Strip and its color ordering.
|
|
|
|
struct ColorOrderMapEntry {
|
|
|
|
uint16_t start;
|
|
|
|
uint16_t len;
|
|
|
|
uint8_t colorOrder;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ColorOrderMap {
|
2023-02-05 22:48:43 +00:00
|
|
|
void add(uint16_t start, uint16_t len, uint8_t colorOrder);
|
2021-12-31 20:35:27 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t count() const {
|
|
|
|
return _count;
|
|
|
|
}
|
2021-12-31 20:35:27 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void reset() {
|
|
|
|
_count = 0;
|
|
|
|
memset(_mappings, 0, sizeof(_mappings));
|
2021-12-31 20:35:27 +00:00
|
|
|
}
|
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
const ColorOrderMapEntry* get(uint8_t n) const {
|
|
|
|
if (n > _count) {
|
|
|
|
return nullptr;
|
2021-12-31 20:35:27 +00:00
|
|
|
}
|
2023-02-05 22:48:43 +00:00
|
|
|
return &(_mappings[n]);
|
2021-12-31 20:35:27 +00:00
|
|
|
}
|
2023-02-05 22:48:43 +00:00
|
|
|
|
|
|
|
uint8_t getPixelColorOrder(uint16_t pix, uint8_t defaultColorOrder) const;
|
2021-12-31 20:35:27 +00:00
|
|
|
|
|
|
|
private:
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t _count;
|
|
|
|
ColorOrderMapEntry _mappings[WLED_MAX_COLOR_ORDER_MAPPINGS];
|
2021-12-31 20:35:27 +00:00
|
|
|
};
|
|
|
|
|
2021-11-24 10:02:25 +00:00
|
|
|
//parent class of BusDigital, BusPwm, and BusNetwork
|
2020-11-30 23:33:47 +00:00
|
|
|
class Bus {
|
|
|
|
public:
|
2022-08-21 18:50:24 +00:00
|
|
|
Bus(uint8_t type, uint16_t start, uint8_t aw)
|
|
|
|
: _bri(255)
|
|
|
|
, _len(1)
|
|
|
|
, _valid(false)
|
|
|
|
, _needsRefresh(false)
|
|
|
|
{
|
2021-10-16 13:13:30 +00:00
|
|
|
_type = type;
|
|
|
|
_start = start;
|
2022-03-09 12:39:51 +00:00
|
|
|
_autoWhiteMode = Bus::isRgbw(_type) ? aw : RGBW_MODE_MANUAL_ONLY;
|
2021-10-16 13:13:30 +00:00
|
|
|
};
|
2021-04-07 19:04:54 +00:00
|
|
|
|
2021-10-16 13:13:30 +00:00
|
|
|
virtual ~Bus() {} //throw the bus under the bus
|
|
|
|
|
2022-08-21 18:50:24 +00:00
|
|
|
virtual void show() = 0;
|
2021-10-16 13:13:30 +00:00
|
|
|
virtual bool canShow() { return true; }
|
2021-11-30 15:28:26 +00:00
|
|
|
virtual void setStatusPixel(uint32_t c) {}
|
2022-08-21 18:50:24 +00:00
|
|
|
virtual void setPixelColor(uint16_t pix, uint32_t c) = 0;
|
2021-11-30 15:28:26 +00:00
|
|
|
virtual uint32_t getPixelColor(uint16_t pix) { return 0; }
|
2022-08-21 18:50:24 +00:00
|
|
|
virtual void setBrightness(uint8_t b) { _bri = b; };
|
|
|
|
virtual void cleanup() = 0;
|
2021-10-16 13:13:30 +00:00
|
|
|
virtual uint8_t getPins(uint8_t* pinArray) { return 0; }
|
2021-12-11 22:17:47 +00:00
|
|
|
virtual uint16_t getLength() { return _len; }
|
2021-10-16 13:13:30 +00:00
|
|
|
virtual void setColorOrder() {}
|
|
|
|
virtual uint8_t getColorOrder() { return COL_ORDER_RGB; }
|
|
|
|
virtual uint8_t skippedLeds() { return 0; }
|
2021-10-23 13:41:35 +00:00
|
|
|
inline uint16_t getStart() { return _start; }
|
|
|
|
inline void setStart(uint16_t start) { _start = start; }
|
|
|
|
inline uint8_t getType() { return _type; }
|
|
|
|
inline bool isOk() { return _valid; }
|
|
|
|
inline bool isOffRefreshRequired() { return _needsRefresh; }
|
|
|
|
bool containsPixel(uint16_t pix) { return pix >= _start && pix < _start+_len; }
|
2021-10-16 13:13:30 +00:00
|
|
|
|
2021-10-24 19:07:05 +00:00
|
|
|
virtual bool isRgbw() { return Bus::isRgbw(_type); }
|
2021-10-16 13:13:30 +00:00
|
|
|
static bool isRgbw(uint8_t type) {
|
|
|
|
if (type == TYPE_SK6812_RGBW || type == TYPE_TM1814) return true;
|
|
|
|
if (type > TYPE_ONOFF && type <= TYPE_ANALOG_5CH && type != TYPE_ANALOG_3CH) return true;
|
2022-09-02 01:12:03 +00:00
|
|
|
if (type == TYPE_NET_DDP_RGBW) return true;
|
2021-10-16 13:13:30 +00:00
|
|
|
return false;
|
|
|
|
}
|
2022-03-11 11:20:48 +00:00
|
|
|
virtual bool hasRGB() {
|
|
|
|
if (_type == TYPE_WS2812_1CH || _type == TYPE_WS2812_WWA || _type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ONOFF) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual bool hasWhite() {
|
|
|
|
if (_type == TYPE_SK6812_RGBW || _type == TYPE_TM1814 || _type == TYPE_WS2812_1CH || _type == TYPE_WS2812_WWA ||
|
2022-09-02 01:12:03 +00:00
|
|
|
_type == TYPE_ANALOG_1CH || _type == TYPE_ANALOG_2CH || _type == TYPE_ANALOG_4CH || _type == TYPE_ANALOG_5CH || _type == TYPE_NET_DDP_RGBW) return true;
|
2022-03-11 11:20:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-11-28 00:21:17 +00:00
|
|
|
static void setCCT(uint16_t cct) {
|
2021-11-24 10:02:25 +00:00
|
|
|
_cct = cct;
|
|
|
|
}
|
2021-11-27 15:49:42 +00:00
|
|
|
static void setCCTBlend(uint8_t b) {
|
|
|
|
if (b > 100) b = 100;
|
|
|
|
_cctBlend = (b * 127) / 100;
|
|
|
|
//compile-time limiter for hardware that can't power both white channels at max
|
|
|
|
#ifdef WLED_MAX_CCT_BLEND
|
|
|
|
if (_cctBlend > WLED_MAX_CCT_BLEND) _cctBlend = WLED_MAX_CCT_BLEND;
|
|
|
|
#endif
|
|
|
|
}
|
2022-03-26 22:20:14 +00:00
|
|
|
inline void setAWMode(uint8_t m) { if (m < 4) _autoWhiteMode = m; }
|
|
|
|
inline uint8_t getAWMode() { return _autoWhiteMode; }
|
|
|
|
inline static void setAutoWhiteMode(uint8_t m) { if (m < 4) _gAWM = m; else _gAWM = 255; }
|
|
|
|
inline static uint8_t getAutoWhiteMode() { return _gAWM; }
|
2021-10-07 20:57:07 +00:00
|
|
|
|
2021-10-16 13:13:30 +00:00
|
|
|
bool reversed = false;
|
2021-01-19 15:51:03 +00:00
|
|
|
|
2020-11-30 23:33:47 +00:00
|
|
|
protected:
|
2022-08-21 18:50:24 +00:00
|
|
|
uint8_t _type;
|
|
|
|
uint8_t _bri;
|
|
|
|
uint16_t _start;
|
|
|
|
uint16_t _len;
|
|
|
|
bool _valid;
|
|
|
|
bool _needsRefresh;
|
2022-03-26 22:20:14 +00:00
|
|
|
uint8_t _autoWhiteMode;
|
2023-02-05 22:48:43 +00:00
|
|
|
static uint8_t _gAWM;
|
|
|
|
static int16_t _cct;
|
|
|
|
static uint8_t _cctBlend;
|
|
|
|
|
|
|
|
uint32_t autoWhiteCalc(uint32_t c);
|
2020-11-30 23:33:47 +00:00
|
|
|
};
|
|
|
|
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2020-11-30 23:33:47 +00:00
|
|
|
class BusDigital : public Bus {
|
|
|
|
public:
|
2023-02-05 22:48:43 +00:00
|
|
|
BusDigital(BusConfig &bc, uint8_t nr, const ColorOrderMap &com);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
inline void show();
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
bool canShow();
|
2021-01-15 23:50:43 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setBrightness(uint8_t b);
|
2021-11-30 15:28:26 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setStatusPixel(uint32_t c);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setPixelColor(uint16_t pix, uint32_t c);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint32_t getPixelColor(uint16_t pix);
|
2020-11-30 23:33:47 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t getColorOrder() {
|
|
|
|
return _colorOrder;
|
|
|
|
}
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint16_t getLength() {
|
|
|
|
return _len - _skip;
|
|
|
|
}
|
2021-01-19 15:51:03 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t getPins(uint8_t* pinArray);
|
2020-11-30 23:33:47 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setColorOrder(uint8_t colorOrder);
|
2021-03-29 21:12:19 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t skippedLeds() {
|
|
|
|
return _skip;
|
|
|
|
}
|
2021-01-19 16:22:37 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void reinit();
|
2021-01-16 18:53:08 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
~BusDigital() {
|
|
|
|
cleanup();
|
|
|
|
}
|
2021-01-18 19:51:32 +00:00
|
|
|
|
2023-01-06 08:24:29 +00:00
|
|
|
private:
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t _colorOrder = COL_ORDER_GRB;
|
|
|
|
uint8_t _pins[2] = {255, 255};
|
|
|
|
uint8_t _iType = 0; //I_NONE;
|
|
|
|
uint8_t _skip = 0;
|
|
|
|
void * _busPtr = nullptr;
|
|
|
|
const ColorOrderMap &_colorOrderMap;
|
2020-11-30 23:33:47 +00:00
|
|
|
};
|
|
|
|
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2020-11-30 23:33:47 +00:00
|
|
|
class BusPwm : public Bus {
|
|
|
|
public:
|
2023-02-05 22:48:43 +00:00
|
|
|
BusPwm(BusConfig &bc);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setPixelColor(uint16_t pix, uint32_t c);
|
2021-10-20 18:29:13 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
//does no index check
|
|
|
|
uint32_t getPixelColor(uint16_t pix);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void show();
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t getPins(uint8_t* pinArray);
|
2020-12-07 00:39:42 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void cleanup() {
|
|
|
|
deallocatePins();
|
2021-02-28 21:54:30 +00:00
|
|
|
}
|
2021-01-19 15:51:03 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
~BusPwm() {
|
|
|
|
cleanup();
|
|
|
|
}
|
2021-03-04 21:17:25 +00:00
|
|
|
|
2023-01-06 08:24:29 +00:00
|
|
|
private:
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t _pins[5] = {255, 255, 255, 255, 255};
|
|
|
|
uint8_t _data[5] = {0};
|
2020-12-07 00:39:42 +00:00
|
|
|
#ifdef ARDUINO_ARCH_ESP32
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t _ledcStart = 255;
|
2020-12-07 00:39:42 +00:00
|
|
|
#endif
|
2023-02-05 22:48:43 +00:00
|
|
|
|
|
|
|
void deallocatePins();
|
2020-11-30 23:33:47 +00:00
|
|
|
};
|
|
|
|
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2022-06-20 20:17:01 +00:00
|
|
|
class BusOnOff : public Bus {
|
|
|
|
public:
|
2023-02-05 22:48:43 +00:00
|
|
|
BusOnOff(BusConfig &bc);
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setPixelColor(uint16_t pix, uint32_t c);
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint32_t getPixelColor(uint16_t pix);
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void show();
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t getPins(uint8_t* pinArray);
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void cleanup() {
|
|
|
|
pinManager.deallocatePin(_pin, PinOwner::BusOnOff);
|
|
|
|
}
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
~BusOnOff() {
|
|
|
|
cleanup();
|
|
|
|
}
|
2022-06-20 20:17:01 +00:00
|
|
|
|
2023-01-06 08:24:29 +00:00
|
|
|
private:
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t _pin = 255;
|
|
|
|
uint8_t _data = 0;
|
2022-06-20 20:17:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-09-22 11:20:36 +00:00
|
|
|
class BusNetwork : public Bus {
|
2021-09-20 20:24:58 +00:00
|
|
|
public:
|
2023-02-05 22:48:43 +00:00
|
|
|
BusNetwork(BusConfig &bc);
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
bool hasRGB() { return true; }
|
|
|
|
bool hasWhite() { return _rgbw; }
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setPixelColor(uint16_t pix, uint32_t c);
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint32_t getPixelColor(uint16_t pix);
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void show();
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
bool canShow() {
|
|
|
|
// this should be a return value from UDP routine if it is still sending data out
|
|
|
|
return !_broadcastLock;
|
2021-09-21 20:18:55 +00:00
|
|
|
}
|
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t getPins(uint8_t* pinArray);
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
bool isRgbw() {
|
|
|
|
return _rgbw;
|
|
|
|
}
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint16_t getLength() {
|
|
|
|
return _len;
|
|
|
|
}
|
2021-09-20 20:24:58 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
~BusNetwork() {
|
|
|
|
cleanup();
|
|
|
|
}
|
2021-09-20 20:24:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
IPAddress _client;
|
2021-09-27 14:29:38 +00:00
|
|
|
uint8_t _UDPtype;
|
|
|
|
uint8_t _UDPchannels;
|
2021-09-20 20:24:58 +00:00
|
|
|
bool _rgbw;
|
|
|
|
bool _broadcastLock;
|
2021-10-04 11:44:44 +00:00
|
|
|
byte *_data;
|
2021-09-20 20:24:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-01-15 14:43:11 +00:00
|
|
|
class BusManager {
|
|
|
|
public:
|
2023-02-05 22:48:43 +00:00
|
|
|
BusManager() {};
|
2022-12-31 16:06:18 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
//utility to get the approx. memory usage of a given BusConfig
|
|
|
|
static uint32_t memUsage(BusConfig &bc);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
int add(BusConfig &bc);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
//do not call this method from system context (network callback)
|
|
|
|
void removeAll();
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void show();
|
2021-11-30 15:28:26 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setStatusPixel(uint32_t c);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void IRAM_ATTR setPixelColor(uint16_t pix, uint32_t c, int16_t cct=-1);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setBrightness(uint8_t b);
|
2021-11-24 10:02:25 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
void setSegmentCCT(int16_t cct, bool allowWBCorrection = false);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
uint32_t getPixelColor(uint16_t pix);
|
2021-01-15 14:43:11 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
bool canAllShow();
|
2021-01-16 18:53:08 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
Bus* getBus(uint8_t busNr);
|
2021-02-27 11:06:14 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
//semi-duplicate of strip.getLengthTotal() (though that just returns strip._length, calculated in finalizeInit())
|
|
|
|
uint16_t getTotalLength();
|
2021-12-31 20:35:27 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
inline void updateColorOrderMap(const ColorOrderMap &com) {
|
|
|
|
memcpy(&colorOrderMap, &com, sizeof(ColorOrderMap));
|
|
|
|
}
|
2021-12-31 20:35:27 +00:00
|
|
|
|
2023-02-05 22:48:43 +00:00
|
|
|
inline const ColorOrderMap& getColorOrderMap() const {
|
|
|
|
return colorOrderMap;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint8_t getNumBusses() {
|
|
|
|
return numBusses;
|
|
|
|
}
|
2022-12-31 16:06:18 +00:00
|
|
|
|
2021-01-15 14:43:11 +00:00
|
|
|
private:
|
2023-02-05 22:48:43 +00:00
|
|
|
uint8_t numBusses = 0;
|
|
|
|
Bus* busses[WLED_MAX_BUSSES+WLED_MIN_VIRTUAL_BUSSES];
|
|
|
|
ColorOrderMap colorOrderMap;
|
|
|
|
|
|
|
|
inline uint8_t getNumVirtualBusses() {
|
|
|
|
int j = 0;
|
|
|
|
for (int i=0; i<numBusses; i++) if (busses[i]->getType() >= TYPE_NET_DDP_RGB && busses[i]->getType() < 96) j++;
|
|
|
|
return j;
|
|
|
|
}
|
2021-01-15 14:43:11 +00:00
|
|
|
};
|
2021-08-23 12:14:48 +00:00
|
|
|
#endif
|