From a5b4d7a2445a2c4e6d77eec842c5ac89d99ded8f Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 20 Jun 2022 15:03:17 +0200 Subject: [PATCH] add TM1829 support --- wled00/bus_wrapper.h | 124 ++++++++++++++++++++++++++++------ wled00/const.h | 1 + wled00/data/settings_leds.htm | 1 + wled00/html_settings.h | 2 +- 4 files changed, 107 insertions(+), 21 deletions(-) diff --git a/wled00/bus_wrapper.h b/wled00/bus_wrapper.h index 43623939..6d3b8861 100644 --- a/wled00/bus_wrapper.h +++ b/wled00/bus_wrapper.h @@ -33,41 +33,51 @@ #define I_8266_U1_TM1_4 14 #define I_8266_DM_TM1_4 15 #define I_8266_BB_TM1_4 16 +//TM1829 (RGB) +#define I_8266_U0_TM2_3 17 +#define I_8266_U1_TM2_3 18 +#define I_8266_DM_TM2_3 19 +#define I_8266_BB_TM2_3 20 /*** ESP32 Neopixel methods ***/ //RGB -#define I_32_RN_NEO_3 17 -#define I_32_I0_NEO_3 18 -#define I_32_I1_NEO_3 19 +#define I_32_RN_NEO_3 21 +#define I_32_I0_NEO_3 22 +#define I_32_I1_NEO_3 23 //RGBW -#define I_32_RN_NEO_4 20 -#define I_32_I0_NEO_4 21 -#define I_32_I1_NEO_4 22 +#define I_32_RN_NEO_4 24 +#define I_32_I0_NEO_4 25 +#define I_32_I1_NEO_4 26 //400Kbps -#define I_32_RN_400_3 23 -#define I_32_I0_400_3 24 -#define I_32_I1_400_3 25 +#define I_32_RN_400_3 27 +#define I_32_I0_400_3 28 +#define I_32_I1_400_3 29 //TM1814 (RGBW) -#define I_32_RN_TM1_4 26 -#define I_32_I0_TM1_4 27 -#define I_32_I1_TM1_4 28 +#define I_32_RN_TM1_4 30 +#define I_32_I0_TM1_4 31 +#define I_32_I1_TM1_4 32 +//Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S) +//TM1829 (RGB) +#define I_32_RN_TM2_3 33 +#define I_32_I0_TM2_3 34 +#define I_32_I1_TM2_3 35 //Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S) //APA102 -#define I_HS_DOT_3 29 //hardware SPI -#define I_SS_DOT_3 30 //soft SPI +#define I_HS_DOT_3 36 //hardware SPI +#define I_SS_DOT_3 37 //soft SPI //LPD8806 -#define I_HS_LPD_3 31 -#define I_SS_LPD_3 32 +#define I_HS_LPD_3 38 +#define I_SS_LPD_3 39 //WS2801 -#define I_HS_WS1_3 33 -#define I_SS_WS1_3 34 +#define I_HS_WS1_3 40 +#define I_SS_WS1_3 41 //P9813 -#define I_HS_P98_3 35 -#define I_SS_P98_3 36 +#define I_HS_P98_3 42 +#define I_SS_P98_3 43 /*** ESP8266 Neopixel methods ***/ @@ -92,6 +102,11 @@ #define B_8266_U1_TM1_4 NeoPixelBrightnessBus #define B_8266_DM_TM1_4 NeoPixelBrightnessBus #define B_8266_BB_TM1_4 NeoPixelBrightnessBus +//TM1829 (RGB) +#define B_8266_U0_TM2_4 NeoPixelBrightnessBus +#define B_8266_U1_TM2_4 NeoPixelBrightnessBus +#define B_8266_DM_TM2_4 NeoPixelBrightnessBus +#define B_8266_BB_TM2_4 NeoPixelBrightnessBus #endif /*** ESP32 Neopixel methods ***/ @@ -129,6 +144,15 @@ #define B_32_I1_TM1_4 NeoPixelBrightnessBus #endif //Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S) +//TM1829 (RGB) +#define B_32_RN_TM2_3 NeoPixelBrightnessBus +#ifndef CONFIG_IDF_TARGET_ESP32C3 +#define B_32_I0_TM2_3 NeoPixelBrightnessBus +#endif +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) +#define B_32_I1_TM2_3 NeoPixelBrightnessBus +#endif +//Bit Bang theoratically possible, but very undesirable and not needed (no pin restrictions on RMT and I2S) #endif @@ -182,6 +206,10 @@ class PolyBus { 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_8266_U0_TM2_3: (static_cast(busPtr))->Begin(); break; + case I_8266_U1_TM2_3: (static_cast(busPtr))->Begin(); break; + case I_8266_DM_TM2_3: (static_cast(busPtr))->Begin(); break; + case I_8266_BB_TM2_3: (static_cast(busPtr))->Begin(); 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; @@ -210,11 +238,14 @@ class PolyBus { case I_32_I1_400_3: (static_cast(busPtr))->Begin(); break; #endif case I_32_RN_TM1_4: beginTM1814(busPtr); break; + case I_32_RN_TM2_3: (static_cast(busPtr))->Begin(); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: beginTM1814(busPtr); break; + case I_32_I0_TM2_3: (static_cast(busPtr))->Begin(); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: beginTM1814(busPtr); break; + case I_32_I1_TM2_3: (static_cast(busPtr))->Begin(); break; #endif // 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; @@ -249,6 +280,10 @@ class PolyBus { case I_8266_U1_TM1_4: busPtr = new B_8266_U1_TM1_4(len, pins[0]); break; case I_8266_DM_TM1_4: busPtr = new B_8266_DM_TM1_4(len, pins[0]); break; case I_8266_BB_TM1_4: busPtr = new B_8266_BB_TM1_4(len, pins[0]); break; + case I_8266_U0_TM2_3: busPtr = new B_8266_U0_TM2_4(len, pins[0]); break; + case I_8266_U1_TM2_3: busPtr = new B_8266_U1_TM2_4(len, pins[0]); break; + case I_8266_DM_TM2_3: busPtr = new B_8266_DM_TM2_4(len, pins[0]); break; + case I_8266_BB_TM2_3: busPtr = new B_8266_BB_TM2_4(len, pins[0]); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: busPtr = new B_32_RN_NEO_3(len, pins[0], (NeoBusChannel)channel); break; @@ -273,11 +308,14 @@ class PolyBus { case I_32_I1_400_3: busPtr = new B_32_I1_400_3(len, pins[0]); break; #endif case I_32_RN_TM1_4: busPtr = new B_32_RN_TM1_4(len, pins[0], (NeoBusChannel)channel); break; + case I_32_RN_TM2_3: busPtr = new B_32_RN_TM2_3(len, pins[0], (NeoBusChannel)channel); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: busPtr = new B_32_I0_TM1_4(len, pins[0]); break; + case I_32_I0_TM2_3: busPtr = new B_32_I0_TM2_3(len, pins[0]); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: busPtr = new B_32_I1_TM1_4(len, pins[0]); break; + case I_32_I1_TM2_3: busPtr = new B_32_I1_TM2_3(len, pins[0]); break; #endif #endif // for 2-wire: pins[1] is clk, pins[0] is dat. begin expects (len, clk, dat) @@ -313,6 +351,10 @@ class PolyBus { case I_8266_U1_TM1_4: (static_cast(busPtr))->Show(); break; case I_8266_DM_TM1_4: (static_cast(busPtr))->Show(); break; case I_8266_BB_TM1_4: (static_cast(busPtr))->Show(); break; + case I_8266_U0_TM2_3: (static_cast(busPtr))->Show(); break; + case I_8266_U1_TM2_3: (static_cast(busPtr))->Show(); break; + case I_8266_DM_TM2_3: (static_cast(busPtr))->Show(); break; + case I_8266_BB_TM2_3: (static_cast(busPtr))->Show(); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: (static_cast(busPtr))->Show(); break; @@ -337,11 +379,14 @@ class PolyBus { case I_32_I1_400_3: (static_cast(busPtr))->Show(); break; #endif case I_32_RN_TM1_4: (static_cast(busPtr))->Show(); break; + case I_32_RN_TM2_3: (static_cast(busPtr))->Show(); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: (static_cast(busPtr))->Show(); break; + case I_32_I0_TM2_3: (static_cast(busPtr))->Show(); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: (static_cast(busPtr))->Show(); break; + case I_32_I1_TM2_3: (static_cast(busPtr))->Show(); break; #endif #endif case I_HS_DOT_3: (static_cast(busPtr))->Show(); break; @@ -374,6 +419,10 @@ class PolyBus { case I_8266_U1_TM1_4: return (static_cast(busPtr))->CanShow(); break; case I_8266_DM_TM1_4: return (static_cast(busPtr))->CanShow(); break; case I_8266_BB_TM1_4: return (static_cast(busPtr))->CanShow(); break; + case I_8266_U0_TM2_3: return (static_cast(busPtr))->CanShow(); break; + case I_8266_U1_TM2_3: return (static_cast(busPtr))->CanShow(); break; + case I_8266_DM_TM2_3: return (static_cast(busPtr))->CanShow(); break; + case I_8266_BB_TM2_3: return (static_cast(busPtr))->CanShow(); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: return (static_cast(busPtr))->CanShow(); break; @@ -398,11 +447,14 @@ class PolyBus { case I_32_I1_400_3: return (static_cast(busPtr))->CanShow(); break; #endif case I_32_RN_TM1_4: return (static_cast(busPtr))->CanShow(); break; + case I_32_RN_TM2_3: return (static_cast(busPtr))->CanShow(); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: return (static_cast(busPtr))->CanShow(); break; + case I_32_I0_TM2_3: return (static_cast(busPtr))->CanShow(); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: return (static_cast(busPtr))->CanShow(); break; + case I_32_I1_TM2_3: return (static_cast(busPtr))->CanShow(); break; #endif #endif case I_HS_DOT_3: return (static_cast(busPtr))->CanShow(); break; @@ -459,6 +511,10 @@ class PolyBus { case I_8266_U1_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; case I_8266_DM_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; case I_8266_BB_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; + case I_8266_U0_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; + case I_8266_U1_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; + case I_8266_DM_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; + case I_8266_BB_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; @@ -483,11 +539,14 @@ class PolyBus { case I_32_I1_400_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; #endif case I_32_RN_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; + case I_32_RN_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; + case I_32_I0_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: (static_cast(busPtr))->SetPixelColor(pix, col); break; + case I_32_I1_TM2_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; #endif #endif case I_HS_DOT_3: (static_cast(busPtr))->SetPixelColor(pix, RgbColor(col.R,col.G,col.B)); break; @@ -520,6 +579,10 @@ class PolyBus { case I_8266_U1_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; case I_8266_DM_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; case I_8266_BB_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; + case I_8266_U0_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; + case I_8266_U1_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; + case I_8266_DM_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; + case I_8266_BB_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: (static_cast(busPtr))->SetBrightness(b); break; @@ -544,11 +607,14 @@ class PolyBus { case I_32_I1_400_3: (static_cast(busPtr))->SetBrightness(b); break; #endif case I_32_RN_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; + case I_32_RN_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; + case I_32_I0_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: (static_cast(busPtr))->SetBrightness(b); break; + case I_32_I1_TM2_3: (static_cast(busPtr))->SetBrightness(b); break; #endif #endif case I_HS_DOT_3: (static_cast(busPtr))->SetBrightness(b); break; @@ -582,6 +648,10 @@ class PolyBus { case I_8266_U1_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; case I_8266_DM_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; case I_8266_BB_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_8266_U0_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_8266_U1_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_8266_DM_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_8266_BB_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; @@ -606,11 +676,14 @@ class PolyBus { case I_32_I1_400_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; #endif case I_32_RN_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_32_RN_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_32_I0_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: col = (static_cast(busPtr))->GetPixelColor(pix); break; + case I_32_I1_TM2_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; #endif #endif case I_HS_DOT_3: col = (static_cast(busPtr))->GetPixelColor(pix); break; @@ -661,6 +734,10 @@ class PolyBus { case I_8266_U1_TM1_4: delete (static_cast(busPtr)); break; case I_8266_DM_TM1_4: delete (static_cast(busPtr)); break; case I_8266_BB_TM1_4: delete (static_cast(busPtr)); break; + case I_8266_U0_TM2_3: delete (static_cast(busPtr)); break; + case I_8266_U1_TM2_3: delete (static_cast(busPtr)); break; + case I_8266_DM_TM2_3: delete (static_cast(busPtr)); break; + case I_8266_BB_TM2_3: delete (static_cast(busPtr)); break; #endif #ifdef ARDUINO_ARCH_ESP32 case I_32_RN_NEO_3: delete (static_cast(busPtr)); break; @@ -685,11 +762,14 @@ class PolyBus { case I_32_I1_400_3: delete (static_cast(busPtr)); break; #endif case I_32_RN_TM1_4: delete (static_cast(busPtr)); break; + case I_32_RN_TM2_3: delete (static_cast(busPtr)); break; #ifndef CONFIG_IDF_TARGET_ESP32C3 case I_32_I0_TM1_4: delete (static_cast(busPtr)); break; + case I_32_I0_TM2_3: delete (static_cast(busPtr)); break; #endif #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case I_32_I1_TM1_4: delete (static_cast(busPtr)); break; + case I_32_I1_TM2_3: delete (static_cast(busPtr)); break; #endif #endif case I_HS_DOT_3: delete (static_cast(busPtr)); break; @@ -737,6 +817,8 @@ class PolyBus { return I_8266_U0_400_3 + offset; case TYPE_TM1814: return I_8266_U0_TM1_4 + offset; + case TYPE_TM1829: + return I_8266_U0_TM2_3 + offset; } #else //ESP32 uint8_t offset = 0; //0 = RMT (num 0-7) 8 = I2S0 9 = I2S1 @@ -757,6 +839,8 @@ class PolyBus { return I_32_RN_400_3 + offset; case TYPE_TM1814: return I_32_RN_TM1_4 + offset; + case TYPE_TM1829: + return I_32_RN_TM2_3 + offset; } #endif } diff --git a/wled00/const.h b/wled00/const.h index 6b9517d9..dab92c6f 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -150,6 +150,7 @@ #define TYPE_WS2812_RGB 22 #define TYPE_GS8608 23 //same driver as WS2812, but will require signal 2x per second (else displays test pattern) #define TYPE_WS2811_400KHZ 24 //half-speed WS2812 protocol, used by very old WS2811 units +#define TYPE_TM1829 25 #define TYPE_SK6812_RGBW 30 #define TYPE_TM1814 31 //"Analog" types (PWM) (32-47) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 605ee255..00369d85 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -294,6 +294,7 @@ ${i+1}: + diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 92a25809..ed1218a5 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -76,7 +76,7 @@ const char PAGE_settings_leds[] PROGMEM = R"=====(LED Settings