diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index c96896c37..bd3da14d0 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -28,7 +28,7 @@ #define I_8266_U1_400_3 10 #define I_8266_DM_400_3 11 #define I_8266_BB_400_3 12 -//TM1418 (RGBW) +//TM1814 (RGBW) #define I_8266_U0_TM1_4 13 #define I_8266_U1_TM1_4 14 #define I_8266_DM_TM1_4 15 @@ -68,7 +68,7 @@ #define I_32_R7_400_3 44 #define I_32_I0_400_3 45 #define I_32_I1_400_3 46 -//TM1418 (RGBW) +//TM1814 (RGBW) #define I_32_R0_TM1_4 47 #define I_32_R1_TM1_4 48 #define I_32_R2_TM1_4 49 @@ -115,7 +115,7 @@ #define B_8266_U1_400_3 NeoPixelBrightnessBus //3 chan, esp8266, gpio2 #define B_8266_DM_400_3 NeoPixelBrightnessBus //3 chan, esp8266, gpio3 #define B_8266_BB_400_3 NeoPixelBrightnessBus //3 chan, esp8266, bb (any pin) -//TM1418 (RGBW) +//TM1814 (RGBW) #define B_8266_U0_TM1_4 NeoPixelBrightnessBus #define B_8266_U1_TM1_4 NeoPixelBrightnessBus #define B_8266_DM_TM1_4 NeoPixelBrightnessBus @@ -157,7 +157,7 @@ #define B_32_R7_400_3 NeoPixelBrightnessBus #define B_32_I0_400_3 NeoPixelBrightnessBus #define B_32_I1_400_3 NeoPixelBrightnessBus -//TM1418 (RGBW) +//TM1814 (RGBW) #define B_32_R0_TM1_4 NeoPixelBrightnessBus #define B_32_R1_TM1_4 NeoPixelBrightnessBus #define B_32_R2_TM1_4 NeoPixelBrightnessBus @@ -191,6 +191,15 @@ //handles pointer type conversion for all possible bus types class PolyBus { public: + // Begin & initialize the PixelSettings for TM1814 strips. + template + static void beginTM1814(void* busPtr) { + T tm1814_strip = static_cast(busPtr); + tm1814_strip->Begin(); + // Max current for each LED (38.0 mA). + const uint16_t max = NeoTm1814Settings::MaxCurrent; + tm1814_strip->SetPixelSettings(NeoTm1814Settings(/*R*/max, /*G*/max, /*B*/max, /*W*/max)); + } static void begin(void* busPtr, uint8_t busType, uint8_t* pins) { switch (busType) { case I_NONE: break; @@ -207,10 +216,10 @@ class PolyBus { case I_8266_U1_400_3: (static_cast(busPtr))->Begin(); break; case I_8266_DM_400_3: (static_cast(busPtr))->Begin(); break; case I_8266_BB_400_3: (static_cast(busPtr))->Begin(); break; - case I_8266_U0_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_8266_U1_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_8266_DM_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_8266_BB_TM1_4: (static_cast(busPtr))->Begin(); break; + case I_8266_U0_TM1_4: beginTM1814(busPtr); break; + case I_8266_U1_TM1_4: beginTM1814(busPtr); break; + case I_8266_DM_TM1_4: beginTM1814(busPtr); break; + case I_8266_BB_TM1_4: beginTM1814(busPtr); break; case I_HS_DOT_3: (static_cast(busPtr))->Begin(); break; case I_HS_LPD_3: (static_cast(busPtr))->Begin(); break; case I_HS_WS1_3: (static_cast(busPtr))->Begin(); break; @@ -247,16 +256,16 @@ class PolyBus { case I_32_R7_400_3: (static_cast(busPtr))->Begin(); break; case I_32_I0_400_3: (static_cast(busPtr))->Begin(); break; case I_32_I1_400_3: (static_cast(busPtr))->Begin(); break; - case I_32_R0_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R1_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R2_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R3_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R4_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R5_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R6_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_R7_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_I0_TM1_4: (static_cast(busPtr))->Begin(); break; - case I_32_I1_TM1_4: (static_cast(busPtr))->Begin(); break; + case I_32_R0_TM1_4: beginTM1814(busPtr); break; + case I_32_R1_TM1_4: beginTM1814(busPtr); break; + case I_32_R2_TM1_4: beginTM1814(busPtr); break; + case I_32_R3_TM1_4: beginTM1814(busPtr); break; + case I_32_R4_TM1_4: beginTM1814(busPtr); break; + case I_32_R5_TM1_4: beginTM1814(busPtr); break; + case I_32_R6_TM1_4: beginTM1814(busPtr); break; + case I_32_R7_TM1_4: beginTM1814(busPtr); break; + case I_32_I0_TM1_4: beginTM1814(busPtr); break; + case I_32_I1_TM1_4: beginTM1814(busPtr); break; // ESP32 can (and should, to avoid inadvertantly driving the chip select signal) specify the pins used for SPI, but only in begin() case I_HS_DOT_3: (static_cast(busPtr))->Begin(pins[1], -1, pins[0], -1); break; case I_HS_LPD_3: (static_cast(busPtr))->Begin(pins[1], -1, pins[0], -1); break; @@ -860,6 +869,8 @@ class PolyBus { return I_8266_U0_NEO_4 + offset; case TYPE_WS2811_400KHZ: return I_8266_U0_400_3 + offset; + case TYPE_TM1814: + return I_8266_U0_TM1_4 + offset; } #else //ESP32 uint8_t offset = num; //RMT bus # == bus index in BusManager @@ -872,6 +883,8 @@ class PolyBus { return I_32_R0_NEO_4 + offset; case TYPE_WS2811_400KHZ: return I_32_R0_400_3 + offset; + case TYPE_TM1814: + return I_32_R0_TM1_4 + offset; } #endif }