2025-01-19 09:17:33 +00:00
# pragma once
2020-12-07 00:39:42 +00:00
# ifndef BusWrapper_h
# define BusWrapper_h
2025-01-19 09:17:33 +00:00
//#define NPB_CONF_4STEP_CADENCE
2023-04-27 23:28:57 +00:00
# include "NeoPixelBusLg.h"
2020-12-07 00:39:42 +00:00
//Hardware SPI Pins
# define P_8266_HS_MOSI 13
# define P_8266_HS_CLK 14
# define P_32_HS_MOSI 13
# define P_32_HS_CLK 14
# define P_32_VS_MOSI 23
# define P_32_VS_CLK 18
//The dirty list of possible bus types. Quite a lot...
# define I_NONE 0
//ESP8266 RGB
# define I_8266_U0_NEO_3 1
# define I_8266_U1_NEO_3 2
# define I_8266_DM_NEO_3 3
# define I_8266_BB_NEO_3 4
//RGBW
# define I_8266_U0_NEO_4 5
# define I_8266_U1_NEO_4 6
# define I_8266_DM_NEO_4 7
# define I_8266_BB_NEO_4 8
//400Kbps
# define I_8266_U0_400_3 9
# define I_8266_U1_400_3 10
# define I_8266_DM_400_3 11
# define I_8266_BB_400_3 12
2021-04-18 17:14:12 +00:00
//TM1814 (RGBW)
2020-12-07 00:39:42 +00:00
# define I_8266_U0_TM1_4 13
# define I_8266_U1_TM1_4 14
# define I_8266_DM_TM1_4 15
# define I_8266_BB_TM1_4 16
2022-06-20 13:03:17 +00:00
//TM1829 (RGB)
2022-10-10 14:46:23 +00:00
# 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
2023-04-27 23:28:57 +00:00
//UCS8903 (RGB)
2025-01-19 09:17:33 +00:00
# define I_8266_U0_UCS_3 21
# define I_8266_U1_UCS_3 22
# define I_8266_DM_UCS_3 23
# define I_8266_BB_UCS_3 24
2023-04-27 23:28:57 +00:00
//UCS8904 (RGBW)
2025-01-19 09:17:33 +00:00
# define I_8266_U0_UCS_4 25
# define I_8266_U1_UCS_4 26
# define I_8266_DM_UCS_4 27
# define I_8266_BB_UCS_4 28
2023-07-19 07:22:29 +00:00
//FW1906 GRBCW
2025-01-19 09:17:33 +00:00
# define I_8266_U0_FW6_5 29
# define I_8266_U1_FW6_5 30
# define I_8266_DM_FW6_5 31
# define I_8266_BB_FW6_5 32
2023-12-11 08:26:20 +00:00
//ESP8266 APA106
2025-01-19 09:17:33 +00:00
# define I_8266_U0_APA106_3 33
# define I_8266_U1_APA106_3 34
# define I_8266_DM_APA106_3 35
# define I_8266_BB_APA106_3 36
2024-04-15 14:13:13 +00:00
//WS2805 (RGBCW)
2025-01-19 09:17:33 +00:00
# define I_8266_U0_2805_5 37
# define I_8266_U1_2805_5 38
# define I_8266_DM_2805_5 39
# define I_8266_BB_2805_5 40
2024-04-17 17:00:16 +00:00
//TM1914 (RGB)
2025-01-19 09:17:33 +00:00
# define I_8266_U0_TM1914_3 41
# define I_8266_U1_TM1914_3 42
# define I_8266_DM_TM1914_3 43
# define I_8266_BB_TM1914_3 44
2024-08-05 18:56:12 +00:00
//SM16825 (RGBCW)
2025-01-19 09:17:33 +00:00
# define I_8266_U0_SM16825_5 45
# define I_8266_U1_SM16825_5 46
# define I_8266_DM_SM16825_5 47
# define I_8266_BB_SM16825_5 48
2020-12-07 00:39:42 +00:00
/*** ESP32 Neopixel methods ***/
//RGB
2025-01-19 09:17:33 +00:00
# define I_32_RN_NEO_3 1
# define I_32_I2_NEO_3 2
2020-12-07 00:39:42 +00:00
//RGBW
2025-01-19 09:17:33 +00:00
# define I_32_RN_NEO_4 5
# define I_32_I2_NEO_4 6
2020-12-07 00:39:42 +00:00
//400Kbps
2025-01-19 09:17:33 +00:00
# define I_32_RN_400_3 9
# define I_32_I2_400_3 10
2021-04-18 17:14:12 +00:00
//TM1814 (RGBW)
2025-01-19 09:17:33 +00:00
# define I_32_RN_TM1_4 13
# define I_32_I2_TM1_4 14
2022-06-20 13:03:17 +00:00
//TM1829 (RGB)
2025-01-19 09:17:33 +00:00
# define I_32_RN_TM2_3 17
# define I_32_I2_TM2_3 18
2023-04-27 23:28:57 +00:00
//UCS8903 (RGB)
2025-01-19 09:17:33 +00:00
# define I_32_RN_UCS_3 21
# define I_32_I2_UCS_3 22
2023-04-27 23:28:57 +00:00
//UCS8904 (RGBW)
2025-01-19 09:17:33 +00:00
# define I_32_RN_UCS_4 25
# define I_32_I2_UCS_4 26
2023-07-19 07:22:29 +00:00
//FW1906 GRBCW
2025-01-19 09:17:33 +00:00
# define I_32_RN_FW6_5 29
# define I_32_I2_FW6_5 30
2024-03-24 16:37:11 +00:00
//APA106
2025-01-19 09:17:33 +00:00
# define I_32_RN_APA106_3 33
# define I_32_I2_APA106_3 34
2024-04-15 14:13:13 +00:00
//WS2805 (RGBCW)
2025-01-19 09:17:33 +00:00
# define I_32_RN_2805_5 37
# define I_32_I2_2805_5 38
2024-04-15 14:13:13 +00:00
//TM1914 (RGB)
2025-01-19 09:17:33 +00:00
# define I_32_RN_TM1914_3 41
# define I_32_I2_TM1914_3 42
2024-08-05 18:56:12 +00:00
//SM16825 (RGBCW)
2025-01-19 09:17:33 +00:00
# define I_32_RN_SM16825_5 45
# define I_32_I2_SM16825_5 46
2023-07-19 07:22:29 +00:00
2020-12-07 00:39:42 +00:00
//APA102
2025-01-19 09:17:33 +00:00
# define I_HS_DOT_3 101 //hardware SPI
# define I_SS_DOT_3 102 //soft SPI
2020-12-07 00:39:42 +00:00
//LPD8806
2025-01-19 09:17:33 +00:00
# define I_HS_LPD_3 103
# define I_SS_LPD_3 104
2020-12-07 00:39:42 +00:00
//WS2801
2025-01-19 09:17:33 +00:00
# define I_HS_WS1_3 105
# define I_SS_WS1_3 106
2020-12-07 00:39:42 +00:00
//P9813
2025-01-19 09:17:33 +00:00
# define I_HS_P98_3 107
# define I_SS_P98_3 108
2020-12-07 00:39:42 +00:00
2021-12-27 22:54:37 +00:00
//LPD6803
2025-01-19 09:17:33 +00:00
# define I_HS_LPO_3 109
# define I_SS_LPO_3 110
2021-12-27 22:54:37 +00:00
2020-12-07 00:39:42 +00:00
2023-06-10 18:43:27 +00:00
// In the following NeoGammaNullMethod can be replaced with NeoGammaWLEDMethod to perform Gamma correction implicitly
// unfortunately that may apply Gamma correction to pre-calculated palettes which is undesired
2020-12-07 00:39:42 +00:00
/*** ESP8266 Neopixel methods ***/
# ifdef ESP8266
//RGB
2023-04-27 23:28:57 +00:00
# define B_8266_U0_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //3 chan, esp8266, gpio1
# define B_8266_U1_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //3 chan, esp8266, gpio2
# define B_8266_DM_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, gpio3
# define B_8266_BB_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, bb (any pin but 16)
2020-12-07 00:39:42 +00:00
//RGBW
2023-04-27 23:28:57 +00:00
# define B_8266_U0_NEO_4 NeoPixelBusLg<NeoGrbwFeature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //4 chan, esp8266, gpio1
# define B_8266_U1_NEO_4 NeoPixelBusLg<NeoGrbwFeature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //4 chan, esp8266, gpio2
# define B_8266_DM_NEO_4 NeoPixelBusLg<NeoGrbwFeature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, gpio3
# define B_8266_BB_NEO_4 NeoPixelBusLg<NeoGrbwFeature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, bb (any pin)
2020-12-07 00:39:42 +00:00
//400Kbps
2023-04-27 23:28:57 +00:00
# define B_8266_U0_400_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Uart0400KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, gpio1
# define B_8266_U1_400_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Uart1400KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, gpio2
# define B_8266_DM_400_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266Dma400KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, gpio3
# define B_8266_BB_400_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266BitBang400KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, bb (any pin)
2021-04-18 17:14:12 +00:00
//TM1814 (RGBW)
2023-04-27 23:28:57 +00:00
# define B_8266_U0_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, NeoEsp8266Uart0Tm1814Method, NeoGammaNullMethod>
# define B_8266_U1_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, NeoEsp8266Uart1Tm1814Method, NeoGammaNullMethod>
# define B_8266_DM_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, NeoEsp8266DmaTm1814Method, NeoGammaNullMethod>
# define B_8266_BB_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, NeoEsp8266BitBangTm1814Method, NeoGammaNullMethod>
2022-06-20 13:03:17 +00:00
//TM1829 (RGB)
2024-04-15 14:13:13 +00:00
# define B_8266_U0_TM2_3 NeoPixelBusLg<NeoBrgFeature, NeoEsp8266Uart0Tm1829Method, NeoGammaNullMethod>
# define B_8266_U1_TM2_3 NeoPixelBusLg<NeoBrgFeature, NeoEsp8266Uart1Tm1829Method, NeoGammaNullMethod>
# define B_8266_DM_TM2_3 NeoPixelBusLg<NeoBrgFeature, NeoEsp8266DmaTm1829Method, NeoGammaNullMethod>
# define B_8266_BB_TM2_3 NeoPixelBusLg<NeoBrgFeature, NeoEsp8266BitBangTm1829Method, NeoGammaNullMethod>
2023-04-27 23:28:57 +00:00
//UCS8903
# define B_8266_U0_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //3 chan, esp8266, gpio1
# define B_8266_U1_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //3 chan, esp8266, gpio2
# define B_8266_DM_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, gpio3
# define B_8266_BB_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //3 chan, esp8266, bb (any pin but 16)
//UCS8904 RGBW
# define B_8266_U0_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //4 chan, esp8266, gpio1
# define B_8266_U1_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //4 chan, esp8266, gpio2
# define B_8266_DM_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, gpio3
# define B_8266_BB_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //4 chan, esp8266, bb (any pin)
2023-12-11 08:26:20 +00:00
//APA106
# define B_8266_U0_APA106_3 NeoPixelBusLg<NeoRbgFeature, NeoEsp8266Uart0Apa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio1
# define B_8266_U1_APA106_3 NeoPixelBusLg<NeoRbgFeature, NeoEsp8266Uart1Apa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio2
# define B_8266_DM_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266DmaApa106Method, NeoGammaNullMethod> //3 chan, esp8266, gpio3
# define B_8266_BB_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp8266BitBangApa106Method, NeoGammaNullMethod> //3 chan, esp8266, bb (any pin but 16)
2023-07-19 07:22:29 +00:00
//FW1906 GRBCW
# define B_8266_U0_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod> //esp8266, gpio1
# define B_8266_U1_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod> //esp8266, gpio2
# define B_8266_DM_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod> //esp8266, gpio3
# define B_8266_BB_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, NeoEsp8266BitBang800KbpsMethod, NeoGammaNullMethod> //esp8266, bb
2024-03-24 16:37:11 +00:00
//WS2805 GRBCW
# define B_8266_U0_2805_5 NeoPixelBusLg<NeoGrbwwFeature, NeoEsp8266Uart0Ws2805Method, NeoGammaNullMethod> //esp8266, gpio1
# define B_8266_U1_2805_5 NeoPixelBusLg<NeoGrbwwFeature, NeoEsp8266Uart1Ws2805Method, NeoGammaNullMethod> //esp8266, gpio2
# define B_8266_DM_2805_5 NeoPixelBusLg<NeoGrbwwFeature, NeoEsp8266DmaWs2805Method, NeoGammaNullMethod> //esp8266, gpio3
# define B_8266_BB_2805_5 NeoPixelBusLg<NeoGrbwwFeature, NeoEsp8266BitBangWs2805Method, NeoGammaNullMethod> //esp8266, bb
2024-04-15 14:13:13 +00:00
//TM1914 (RGB)
# define B_8266_U0_TM1914_3 NeoPixelBusLg<NeoRgbTm1914Feature, NeoEsp8266Uart0Tm1914Method, NeoGammaNullMethod>
# define B_8266_U1_TM1914_3 NeoPixelBusLg<NeoRgbTm1914Feature, NeoEsp8266Uart1Tm1914Method, NeoGammaNullMethod>
# define B_8266_DM_TM1914_3 NeoPixelBusLg<NeoRgbTm1914Feature, NeoEsp8266DmaTm1914Method, NeoGammaNullMethod>
# define B_8266_BB_TM1914_3 NeoPixelBusLg<NeoRgbTm1914Feature, NeoEsp8266BitBangTm1914Method, NeoGammaNullMethod>
2024-08-05 18:56:12 +00:00
//Sm16825 (RGBWC)
# define B_8266_U0_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266Uart0Ws2813Method, NeoGammaNullMethod>
# define B_8266_U1_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266Uart1Ws2813Method, NeoGammaNullMethod>
# define B_8266_DM_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266Dma800KbpsMethod, NeoGammaNullMethod>
# define B_8266_BB_SM16825_5 NeoPixelBusLg<NeoRgbwcSm16825eFeature, NeoEsp8266BitBangWs2813Method, NeoGammaNullMethod>
2020-12-07 00:39:42 +00:00
# endif
/*** ESP32 Neopixel methods ***/
# ifdef ARDUINO_ARCH_ESP32
2025-01-19 09:17:33 +00:00
// C3: I2S0 and I2S1 methods not supported (has one I2S bus)
// S2: I2S0 methods supported (single & parallel), I2S1 methods not supported (has one I2S bus)
// S3: I2S0 methods not supported, I2S1 supports LCD parallel methods (has two I2S buses)
// https://github.com/Makuna/NeoPixelBus/blob/b32f719e95ef3c35c46da5c99538017ef925c026/src/internal/Esp32_i2s.h#L4
// https://github.com/Makuna/NeoPixelBus/blob/b32f719e95ef3c35c46da5c99538017ef925c026/src/internal/NeoEsp32RmtMethod.h#L857
# if defined(CONFIG_IDF_TARGET_ESP32S3)
// S3 will always use LCD parallel output
typedef X8Ws2812xMethod X1Ws2812xMethod ;
typedef X8Sk6812Method X1Sk6812Method ;
typedef X8400KbpsMethod X1400KbpsMethod ;
typedef X8800KbpsMethod X1800KbpsMethod ;
typedef X8Tm1814Method X1Tm1814Method ;
typedef X8Tm1829Method X1Tm1829Method ;
typedef X8Apa106Method X1Apa106Method ;
typedef X8Ws2805Method X1Ws2805Method ;
typedef X8Tm1914Method X1Tm1914Method ;
# elif defined(CONFIG_IDF_TARGET_ESP32S2)
// S2 will use I2S0
typedef NeoEsp32I2s0Ws2812xMethod X1Ws2812xMethod ;
typedef NeoEsp32I2s0Sk6812Method X1Sk6812Method ;
typedef NeoEsp32I2s0400KbpsMethod X1400KbpsMethod ;
typedef NeoEsp32I2s0800KbpsMethod X1800KbpsMethod ;
typedef NeoEsp32I2s0Tm1814Method X1Tm1814Method ;
typedef NeoEsp32I2s0Tm1829Method X1Tm1829Method ;
typedef NeoEsp32I2s0Apa106Method X1Apa106Method ;
typedef NeoEsp32I2s0Ws2805Method X1Ws2805Method ;
typedef NeoEsp32I2s0Tm1914Method X1Tm1914Method ;
# elif !defined(CONFIG_IDF_TARGET_ESP32C3)
// regular ESP32 will use I2S1
typedef NeoEsp32I2s1Ws2812xMethod X1Ws2812xMethod ;
typedef NeoEsp32I2s1Sk6812Method X1Sk6812Method ;
typedef NeoEsp32I2s1400KbpsMethod X1400KbpsMethod ;
typedef NeoEsp32I2s1800KbpsMethod X1800KbpsMethod ;
typedef NeoEsp32I2s1Tm1814Method X1Tm1814Method ;
typedef NeoEsp32I2s1Tm1829Method X1Tm1829Method ;
typedef NeoEsp32I2s1Apa106Method X1Apa106Method ;
typedef NeoEsp32I2s1Ws2805Method X1Ws2805Method ;
typedef NeoEsp32I2s1Tm1914Method X1Tm1914Method ;
# endif
2020-12-07 00:39:42 +00:00
//RGB
2025-01-19 09:17:33 +00:00
# define B_32_RN_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32RmtNWs2812xMethod, NeoGammaNullMethod> // ESP32, S2, S3, C3
//#define B_32_IN_NEO_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32I2sNWs2812xMethod, NeoGammaNullMethod> // ESP32 (dynamic I2S selection)
# define B_32_I2_NEO_3 NeoPixelBusLg<NeoGrbFeature, X1Ws2812xMethod, NeoGammaNullMethod> // ESP32, S2, S3 (automatic I2S selection, see typedef above)
# define B_32_IP_NEO_3 NeoPixelBusLg<NeoGrbFeature, X8Ws2812xMethod, NeoGammaNullMethod> // parallel I2S (ESP32, S2, S3)
2020-12-07 00:39:42 +00:00
//RGBW
2024-03-30 10:02:28 +00:00
# define B_32_RN_NEO_4 NeoPixelBusLg<NeoGrbwFeature, NeoEsp32RmtNSk6812Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_NEO_4 NeoPixelBusLg<NeoGrbwFeature, X1Sk6812Method, NeoGammaNullMethod>
# define B_32_IP_NEO_4 NeoPixelBusLg<NeoGrbwFeature, X8Sk6812Method, NeoGammaNullMethod> // parallel I2S
2020-12-07 00:39:42 +00:00
//400Kbps
2023-04-27 23:28:57 +00:00
# define B_32_RN_400_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32RmtN400KbpsMethod, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_400_3 NeoPixelBusLg<NeoGrbFeature, X1400KbpsMethod, NeoGammaNullMethod>
# define B_32_IP_400_3 NeoPixelBusLg<NeoGrbFeature, X8400KbpsMethod, NeoGammaNullMethod> // parallel I2S
2021-04-18 17:14:12 +00:00
//TM1814 (RGBW)
2023-04-27 23:28:57 +00:00
# define B_32_RN_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, NeoEsp32RmtNTm1814Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, X1Tm1814Method, NeoGammaNullMethod>
# define B_32_IP_TM1_4 NeoPixelBusLg<NeoWrgbTm1814Feature, X8Tm1814Method, NeoGammaNullMethod> // parallel I2S
2022-06-20 13:03:17 +00:00
//TM1829 (RGB)
2023-04-27 23:28:57 +00:00
# define B_32_RN_TM2_3 NeoPixelBusLg<NeoBrgFeature, NeoEsp32RmtNTm1829Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_TM2_3 NeoPixelBusLg<NeoBrgFeature, X1Tm1829Method, NeoGammaNullMethod>
# define B_32_IP_TM2_3 NeoPixelBusLg<NeoBrgFeature, X8Tm1829Method, NeoGammaNullMethod> // parallel I2S
2023-04-27 23:28:57 +00:00
//UCS8903
# define B_32_RN_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, NeoEsp32RmtNWs2812xMethod, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, X1800KbpsMethod, NeoGammaNullMethod>
# define B_32_IP_UCS_3 NeoPixelBusLg<NeoRgbUcs8903Feature, X8800KbpsMethod, NeoGammaNullMethod> // parallel I2S
2023-04-27 23:28:57 +00:00
//UCS8904
# define B_32_RN_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, NeoEsp32RmtNWs2812xMethod, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, X1800KbpsMethod, NeoGammaNullMethod>
# define B_32_IP_UCS_4 NeoPixelBusLg<NeoRgbwUcs8904Feature, X8800KbpsMethod, NeoGammaNullMethod> // parallel I2S
2024-06-12 16:00:00 +00:00
//APA106
2023-12-11 08:26:20 +00:00
# define B_32_RN_APA106_3 NeoPixelBusLg<NeoGrbFeature, NeoEsp32RmtNApa106Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_APA106_3 NeoPixelBusLg<NeoGrbFeature, X1Apa106Method, NeoGammaNullMethod>
# define B_32_IP_APA106_3 NeoPixelBusLg<NeoGrbFeature, X8Apa106Method, NeoGammaNullMethod> // parallel I2S
2023-07-19 07:22:29 +00:00
//FW1906 GRBCW
# define B_32_RN_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, NeoEsp32RmtNWs2812xMethod, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, X1800KbpsMethod, NeoGammaNullMethod>
# define B_32_IP_FW6_5 NeoPixelBusLg<NeoGrbcwxFeature, X8800KbpsMethod, NeoGammaNullMethod> // parallel I2S
2024-03-24 16:37:11 +00:00
//WS2805 RGBWC
# define B_32_RN_2805_5 NeoPixelBusLg<NeoGrbwwFeature, NeoEsp32RmtNWs2805Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_2805_5 NeoPixelBusLg<NeoGrbwwFeature, X1Ws2805Method, NeoGammaNullMethod>
# define B_32_IP_2805_5 NeoPixelBusLg<NeoGrbwwFeature, X8Ws2805Method, NeoGammaNullMethod> // parallel I2S
2024-04-15 14:13:13 +00:00
//TM1914 (RGB)
# define B_32_RN_TM1914_3 NeoPixelBusLg<NeoGrbTm1914Feature, NeoEsp32RmtNTm1914Method, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_TM1914_3 NeoPixelBusLg<NeoGrbTm1914Feature, X1Tm1914Method, NeoGammaNullMethod>
# define B_32_IP_TM1914_3 NeoPixelBusLg<NeoGrbTm1914Feature, X8Tm1914Method, NeoGammaNullMethod> // parallel I2S
2024-08-05 18:56:12 +00:00
//Sm16825 (RGBWC)
2024-08-07 20:39:31 +00:00
# define B_32_RN_SM16825_5 NeoPixelBusLg<NeoRgbcwSm16825eFeature, NeoEsp32RmtNWs2812xMethod, NeoGammaNullMethod>
2025-01-19 09:17:33 +00:00
# define B_32_I2_SM16825_5 NeoPixelBusLg<NeoRgbcwSm16825eFeature, X1Ws2812xMethod, NeoGammaNullMethod>
# define B_32_IP_SM16825_5 NeoPixelBusLg<NeoRgbcwSm16825eFeature, X8Ws2812xMethod, NeoGammaNullMethod> // parallel I2S
2020-12-07 00:39:42 +00:00
# endif
//APA102
2023-03-12 12:10:40 +00:00
# ifdef WLED_USE_ETHERNET
// fix for #2542 (by @BlackBird77)
2023-04-27 23:28:57 +00:00
# define B_HS_DOT_3 NeoPixelBusLg<DotStarBgrFeature, DotStarEsp32HspiHzMethod, NeoGammaNullMethod> //hardware HSPI (was DotStarEsp32DmaHspi5MhzMethod in NPB @ 2.6.9)
2023-03-12 12:10:40 +00:00
# else
2023-04-27 23:28:57 +00:00
# define B_HS_DOT_3 NeoPixelBusLg<DotStarBgrFeature, DotStarSpiHzMethod, NeoGammaNullMethod> //hardware VSPI
2023-03-12 12:10:40 +00:00
# endif
2023-04-27 23:28:57 +00:00
# define B_SS_DOT_3 NeoPixelBusLg<DotStarBgrFeature, DotStarMethod, NeoGammaNullMethod> //soft SPI
2020-12-07 00:39:42 +00:00
//LPD8806
2023-04-27 23:28:57 +00:00
# define B_HS_LPD_3 NeoPixelBusLg<Lpd8806GrbFeature, Lpd8806SpiHzMethod, NeoGammaNullMethod>
# define B_SS_LPD_3 NeoPixelBusLg<Lpd8806GrbFeature, Lpd8806Method, NeoGammaNullMethod>
2020-12-07 00:39:42 +00:00
2021-12-27 22:54:37 +00:00
//LPD6803
2023-04-27 23:28:57 +00:00
# define B_HS_LPO_3 NeoPixelBusLg<Lpd6803GrbFeature, Lpd6803SpiHzMethod, NeoGammaNullMethod>
# define B_SS_LPO_3 NeoPixelBusLg<Lpd6803GrbFeature, Lpd6803Method, NeoGammaNullMethod>
2021-12-27 22:54:37 +00:00
2020-12-07 00:39:42 +00:00
//WS2801
2023-06-06 14:34:22 +00:00
# ifdef WLED_USE_ETHERNET
# define B_HS_WS1_3 NeoPixelBusLg<NeoRbgFeature, Ws2801MethodBase<TwoWireHspiImple<SpiSpeedHz>>, NeoGammaNullMethod>
# else
2023-04-27 23:28:57 +00:00
# define B_HS_WS1_3 NeoPixelBusLg<NeoRbgFeature, Ws2801SpiHzMethod, NeoGammaNullMethod>
2023-06-06 14:34:22 +00:00
# endif
2023-04-27 23:28:57 +00:00
# define B_SS_WS1_3 NeoPixelBusLg<NeoRbgFeature, Ws2801Method, NeoGammaNullMethod>
2020-12-07 00:39:42 +00:00
//P9813
2023-04-27 23:28:57 +00:00
# define B_HS_P98_3 NeoPixelBusLg<P9813BgrFeature, P9813SpiHzMethod, NeoGammaNullMethod>
# define B_SS_P98_3 NeoPixelBusLg<P9813BgrFeature, P9813Method, NeoGammaNullMethod>
// 48bit & 64bit to 24bit & 32bit RGB(W) conversion
# define toRGBW32(c) (RGBW32((c>>40)&0xFF, (c>>24)&0xFF, (c>>8)&0xFF, (c>>56)&0xFF))
# define RGBW32(r,g,b,w) (uint32_t((byte(w) << 24) | (byte(r) << 16) | (byte(g) << 8) | (byte(b))))
2020-12-07 00:39:42 +00:00
//handles pointer type conversion for all possible bus types
class PolyBus {
2024-06-12 16:00:00 +00:00
private :
2025-01-19 10:37:57 +00:00
static bool _useParallelI2S ;
2024-06-12 16:00:00 +00:00
2020-12-07 00:39:42 +00:00
public :
2025-01-19 10:37:57 +00:00
static inline void setParallelI2S1Output ( bool b = true ) { _useParallelI2S = b ; }
static inline bool isParallelI2S1Output ( void ) { return _useParallelI2S ; }
2023-07-19 07:22:29 +00:00
2023-04-27 22:27:19 +00:00
// initialize SPI bus speed for DotStar methods
template < class T >
2024-11-27 14:05:10 +00:00
static void beginDotStar ( void * busPtr , int8_t sck , int8_t miso , int8_t mosi , int8_t ss , uint16_t clock_kHz /* 0 == use default */ ) {
2023-04-27 22:27:19 +00:00
T dotStar_strip = static_cast < T > ( busPtr ) ;
# ifdef ESP8266
dotStar_strip - > Begin ( ) ;
# else
if ( sck = = - 1 & & mosi = = - 1 ) dotStar_strip - > Begin ( ) ;
else dotStar_strip - > Begin ( sck , miso , mosi , ss ) ;
# endif
if ( clock_kHz ) dotStar_strip - > SetMethodSettings ( NeoSpiSettings ( ( uint32_t ) clock_kHz * 1000 ) ) ;
}
2023-06-30 19:12:59 +00:00
2021-04-18 17:14:12 +00:00
// Begin & initialize the PixelSettings for TM1814 strips.
template < class T >
static void beginTM1814 ( void * busPtr ) {
T tm1814_strip = static_cast < T > ( busPtr ) ;
tm1814_strip - > Begin ( ) ;
2021-04-20 19:36:52 +00:00
// Max current for each LED (22.5 mA).
tm1814_strip - > SetPixelSettings ( NeoTm1814Settings ( /*R*/ 225 , /*G*/ 225 , /*B*/ 225 , /*W*/ 225 ) ) ;
2021-04-18 17:14:12 +00:00
}
2023-06-30 19:12:59 +00:00
2024-04-15 14:13:13 +00:00
template < class T >
static void beginTM1914 ( void * busPtr ) {
T tm1914_strip = static_cast < T > ( busPtr ) ;
tm1914_strip - > Begin ( ) ;
tm1914_strip - > SetPixelSettings ( NeoTm1914Settings ( ) ) ; //NeoTm1914_Mode_DinFdinAutoSwitch, NeoTm1914_Mode_DinOnly, NeoTm1914_Mode_FdinOnly
}
2024-11-27 14:05:10 +00:00
static void begin ( void * busPtr , uint8_t busType , uint8_t * pins , uint16_t clock_kHz /* only used by DotStar */ ) {
2021-01-16 18:53:08 +00:00
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
case I_8266_U0_NEO_3 : ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_NEO_3 : ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_NEO_3 : ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_NEO_3 : ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U0_NEO_4 : ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_NEO_4 : ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_NEO_4 : ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_NEO_4 : ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U0_400_3 : ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_400_3 : ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_400_3 : ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_400_3 : ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2021-04-18 17:14:12 +00:00
case I_8266_U0_TM1_4 : beginTM1814 < B_8266_U0_TM1_4 * > ( busPtr ) ; break ;
case I_8266_U1_TM1_4 : beginTM1814 < B_8266_U1_TM1_4 * > ( busPtr ) ; break ;
case I_8266_DM_TM1_4 : beginTM1814 < B_8266_DM_TM1_4 * > ( busPtr ) ; break ;
case I_8266_BB_TM1_4 : beginTM1814 < B_8266_BB_TM1_4 * > ( busPtr ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_TM2_3 : ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_TM2_3 : ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_TM2_3 : ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2023-04-27 22:27:19 +00:00
case I_HS_DOT_3 : beginDotStar < B_HS_DOT_3 * > ( busPtr , - 1 , - 1 , - 1 , - 1 , clock_kHz ) ; break ;
case I_HS_LPD_3 : beginDotStar < B_HS_LPD_3 * > ( busPtr , - 1 , - 1 , - 1 , - 1 , clock_kHz ) ; break ;
case I_HS_LPO_3 : beginDotStar < B_HS_LPO_3 * > ( busPtr , - 1 , - 1 , - 1 , - 1 , clock_kHz ) ; break ;
case I_HS_WS1_3 : beginDotStar < B_HS_WS1_3 * > ( busPtr , - 1 , - 1 , - 1 , - 1 , clock_kHz ) ; break ;
case I_HS_P98_3 : beginDotStar < B_HS_P98_3 * > ( busPtr , - 1 , - 1 , - 1 , - 1 , clock_kHz ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_UCS_3 : ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_UCS_3 : ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_UCS_3 : ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U0_UCS_4 : ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_UCS_4 : ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_UCS_4 : ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_UCS_4 : ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_APA106_3 : ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_APA106_3 : ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_APA106_3 : ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_FW6_5 : ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_FW6_5 : ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_FW6_5 : ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_2805_5 : ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_2805_5 : ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_2805_5 : ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : beginTM1914 < B_8266_U0_TM1914_3 * > ( busPtr ) ; break ;
case I_8266_U1_TM1914_3 : beginTM1914 < B_8266_U1_TM1914_3 * > ( busPtr ) ; break ;
case I_8266_DM_TM1914_3 : beginTM1914 < B_8266_DM_TM1914_3 * > ( busPtr ) ; break ;
case I_8266_BB_TM1914_3 : beginTM1914 < B_8266_BB_TM1914_3 * > ( busPtr ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_U1_SM16825_5 : ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_DM_SM16825_5 : ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_8266_BB_SM16825_5 : ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
2021-01-16 18:53:08 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2021-07-03 11:52:23 +00:00
case I_32_RN_NEO_3 : ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_NEO_4 : ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_400_3 : ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_TM1_4 : beginTM1814 < B_32_RN_TM1_4 * > ( busPtr ) ; break ;
2022-06-20 13:03:17 +00:00
case I_32_RN_TM2_3 : ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_UCS_4 : ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_FW6_5 : ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_APA106_3 : ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_2805_5 : ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_RN_TM1914_3 : beginTM1914 < B_32_RN_TM1914_3 * > ( busPtr ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or parellel buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) beginTM1814 < B_32_IP_TM1_4 * > ( busPtr ) ; else beginTM1814 < B_32_I2_TM1_4 * > ( busPtr ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) beginTM1914 < B_32_IP_TM1914_3 * > ( busPtr ) ; else beginTM1914 < B_32_I2_TM1914_3 * > ( busPtr ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; else ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > Begin ( ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-02-17 17:03:57 +00:00
// ESP32 can (and should, to avoid inadvertantly driving the chip select signal) specify the pins used for SPI, but only in begin()
2023-04-27 22:27:19 +00:00
case I_HS_DOT_3 : beginDotStar < B_HS_DOT_3 * > ( busPtr , pins [ 1 ] , - 1 , pins [ 0 ] , - 1 , clock_kHz ) ; break ;
case I_HS_LPD_3 : beginDotStar < B_HS_LPD_3 * > ( busPtr , pins [ 1 ] , - 1 , pins [ 0 ] , - 1 , clock_kHz ) ; break ;
case I_HS_LPO_3 : beginDotStar < B_HS_LPO_3 * > ( busPtr , pins [ 1 ] , - 1 , pins [ 0 ] , - 1 , clock_kHz ) ; break ;
case I_HS_WS1_3 : beginDotStar < B_HS_WS1_3 * > ( busPtr , pins [ 1 ] , - 1 , pins [ 0 ] , - 1 , clock_kHz ) ; break ;
case I_HS_P98_3 : beginDotStar < B_HS_P98_3 * > ( busPtr , pins [ 1 ] , - 1 , pins [ 0 ] , - 1 , clock_kHz ) ; break ;
2021-01-16 18:53:08 +00:00
# endif
case I_SS_DOT_3 : ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_SS_LPD_3 : ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2021-12-27 22:54:37 +00:00
case I_SS_LPO_3 : ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
2021-01-16 18:53:08 +00:00
case I_SS_WS1_3 : ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
case I_SS_P98_3 : ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > Begin ( ) ; break ;
}
2023-06-30 19:12:59 +00:00
}
2024-11-27 14:05:10 +00:00
static void * create ( uint8_t busType , uint8_t * pins , uint16_t len , uint8_t channel ) {
2024-04-26 18:07:27 +00:00
# if defined(ARDUINO_ARCH_ESP32) && !(defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3))
// NOTE: "channel" is only used on ESP32 (and its variants) for RMT channel allocation
// since 0.15.0-b3 I2S1 is favoured for classic ESP32 and moved to position 0 (channel 0) so we need to subtract 1 for correct RMT allocation
2025-01-19 09:17:33 +00:00
if ( ! _useParallelI2S & & channel > 0 ) channel - - ; // accommodate I2S1 which is used as 1st bus on classic ESP32
// if user selected parallel I2S, RMT is used 1st (8 channels) followed by parallel I2S (8 channels)
2024-04-26 18:07:27 +00:00
# endif
2021-01-16 18:53:08 +00:00
void * busPtr = nullptr ;
2021-01-15 23:50:43 +00:00
switch ( busType ) {
2021-01-16 18:53:08 +00:00
case I_NONE : break ;
2021-01-15 23:50:43 +00:00
# ifdef ESP8266
2021-01-16 18:53:08 +00:00
case I_8266_U0_NEO_3 : busPtr = new B_8266_U0_NEO_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_NEO_3 : busPtr = new B_8266_U1_NEO_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_NEO_3 : busPtr = new B_8266_DM_NEO_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_NEO_3 : busPtr = new B_8266_BB_NEO_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U0_NEO_4 : busPtr = new B_8266_U0_NEO_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_NEO_4 : busPtr = new B_8266_U1_NEO_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_NEO_4 : busPtr = new B_8266_DM_NEO_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_NEO_4 : busPtr = new B_8266_BB_NEO_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_U0_400_3 : busPtr = new B_8266_U0_400_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_400_3 : busPtr = new B_8266_U1_400_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_400_3 : busPtr = new B_8266_DM_400_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_400_3 : busPtr = new B_8266_BB_400_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U0_TM1_4 : busPtr = new B_8266_U0_TM1_4 ( len , pins [ 0 ] ) ; break ;
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 ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : busPtr = new B_8266_U0_TM2_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_TM2_3 : busPtr = new B_8266_U1_TM2_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_TM2_3 : busPtr = new B_8266_DM_TM2_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_TM2_3 : busPtr = new B_8266_BB_TM2_3 ( len , pins [ 0 ] ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : busPtr = new B_8266_U0_UCS_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_UCS_3 : busPtr = new B_8266_U1_UCS_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_UCS_3 : busPtr = new B_8266_DM_UCS_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_UCS_3 : busPtr = new B_8266_BB_UCS_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U0_UCS_4 : busPtr = new B_8266_U0_UCS_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_UCS_4 : busPtr = new B_8266_U1_UCS_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_UCS_4 : busPtr = new B_8266_DM_UCS_4 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_UCS_4 : busPtr = new B_8266_BB_UCS_4 ( len , pins [ 0 ] ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : busPtr = new B_8266_U0_APA106_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_APA106_3 : busPtr = new B_8266_U1_APA106_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_APA106_3 : busPtr = new B_8266_DM_APA106_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_APA106_3 : busPtr = new B_8266_BB_APA106_3 ( len , pins [ 0 ] ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : busPtr = new B_8266_U0_FW6_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_FW6_5 : busPtr = new B_8266_U1_FW6_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_FW6_5 : busPtr = new B_8266_DM_FW6_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_FW6_5 : busPtr = new B_8266_BB_FW6_5 ( len , pins [ 0 ] ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : busPtr = new B_8266_U0_2805_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_2805_5 : busPtr = new B_8266_U1_2805_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_2805_5 : busPtr = new B_8266_DM_2805_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_2805_5 : busPtr = new B_8266_BB_2805_5 ( len , pins [ 0 ] ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : busPtr = new B_8266_U0_TM1914_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_TM1914_3 : busPtr = new B_8266_U1_TM1914_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_TM1914_3 : busPtr = new B_8266_DM_TM1914_3 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_TM1914_3 : busPtr = new B_8266_BB_TM1914_3 ( len , pins [ 0 ] ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : busPtr = new B_8266_U0_SM16825_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_U1_SM16825_5 : busPtr = new B_8266_U1_SM16825_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_DM_SM16825_5 : busPtr = new B_8266_DM_SM16825_5 ( len , pins [ 0 ] ) ; break ;
case I_8266_BB_SM16825_5 : busPtr = new B_8266_BB_SM16825_5 ( len , pins [ 0 ] ) ; break ;
2021-01-15 23:50:43 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2021-07-03 11:52:23 +00:00
case I_32_RN_NEO_3 : busPtr = new B_32_RN_NEO_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_NEO_4 : busPtr = new B_32_RN_NEO_4 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_400_3 : busPtr = new B_32_RN_400_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_TM1_4 : busPtr = new B_32_RN_TM1_4 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
2022-06-20 13:03:17 +00:00
case I_32_RN_TM2_3 : busPtr = new B_32_RN_TM2_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : busPtr = new B_32_RN_UCS_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_UCS_4 : busPtr = new B_32_RN_UCS_4 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_APA106_3 : busPtr = new B_32_RN_APA106_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_FW6_5 : busPtr = new B_32_RN_FW6_5 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_2805_5 : busPtr = new B_32_RN_2805_5 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
case I_32_RN_TM1914_3 : busPtr = new B_32_RN_TM1914_3 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : busPtr = new B_32_RN_SM16825_5 ( len , pins [ 0 ] , ( NeoBusChannel ) channel ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_NEO_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_NEO_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) busPtr = new B_32_IP_NEO_4 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_NEO_4 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_400_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_400_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) busPtr = new B_32_IP_TM1_4 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_TM1_4 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_TM2_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_TM2_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_UCS_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_UCS_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) busPtr = new B_32_IP_UCS_4 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_UCS_4 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_APA106_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_APA106_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) busPtr = new B_32_IP_FW6_5 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_FW6_5 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) busPtr = new B_32_IP_2805_5 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_2805_5 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) busPtr = new B_32_IP_TM1914_3 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_TM1914_3 ( len , pins [ 0 ] ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) busPtr = new B_32_IP_SM16825_5 ( len , pins [ 0 ] ) ; else busPtr = new B_32_I2_SM16825_5 ( len , pins [ 0 ] ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-15 23:50:43 +00:00
# endif
2021-02-17 16:58:03 +00:00
// for 2-wire: pins[1] is clk, pins[0] is dat. begin expects (len, clk, dat)
case I_HS_DOT_3 : busPtr = new B_HS_DOT_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_SS_DOT_3 : busPtr = new B_SS_DOT_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_HS_LPD_3 : busPtr = new B_HS_LPD_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_SS_LPD_3 : busPtr = new B_SS_LPD_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
2021-12-27 22:54:37 +00:00
case I_HS_LPO_3 : busPtr = new B_HS_LPO_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_SS_LPO_3 : busPtr = new B_SS_LPO_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
2021-02-17 16:58:03 +00:00
case I_HS_WS1_3 : busPtr = new B_HS_WS1_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_SS_WS1_3 : busPtr = new B_SS_WS1_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_HS_P98_3 : busPtr = new B_HS_P98_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
case I_SS_P98_3 : busPtr = new B_SS_P98_3 ( len , pins [ 1 ] , pins [ 0 ] ) ; break ;
2021-01-15 23:50:43 +00:00
}
2024-11-23 17:29:46 +00:00
2021-01-15 23:50:43 +00:00
return busPtr ;
2023-06-30 19:12:59 +00:00
}
2023-07-18 21:33:28 +00:00
static void show ( void * busPtr , uint8_t busType , bool consistent = true ) {
2021-01-15 14:43:11 +00:00
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
2023-07-18 21:33:28 +00:00
case I_8266_U0_NEO_3 : ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_NEO_3 : ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_NEO_3 : ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_NEO_3 : ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U0_NEO_4 : ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_NEO_4 : ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_NEO_4 : ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_NEO_4 : ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U0_400_3 : ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_400_3 : ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_400_3 : ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_400_3 : ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U0_TM1_4 : ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_TM1_4 : ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_TM1_4 : ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_TM1_4 : ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_TM2_3 : ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_TM2_3 : ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_TM2_3 : ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2023-07-18 21:33:28 +00:00
case I_8266_U0_UCS_3 : ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_UCS_3 : ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_UCS_3 : ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_UCS_3 : ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U0_UCS_4 : ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_UCS_4 : ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_UCS_4 : ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_UCS_4 : ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_APA106_3 : ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_APA106_3 : ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_APA106_3 : ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_FW6_5 : ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_FW6_5 : ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_FW6_5 : ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_2805_5 : ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_2805_5 : ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_2805_5 : ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_TM1914_3 : ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_TM1914_3 : ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_TM1914_3 : ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_U1_SM16825_5 : ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_DM_SM16825_5 : ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_8266_BB_SM16825_5 : ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2021-01-15 14:43:11 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2023-07-18 21:33:28 +00:00
case I_32_RN_NEO_3 : ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_NEO_4 : ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_400_3 : ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_TM1_4 : ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_TM2_3 : ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_UCS_4 : ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_APA106_3 : ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_FW6_5 : ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_2805_5 : ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_RN_TM1914_3 : ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; else ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-15 14:43:11 +00:00
# endif
2023-07-18 21:33:28 +00:00
case I_HS_DOT_3 : ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_SS_DOT_3 : ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_HS_LPD_3 : ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_SS_LPD_3 : ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_HS_LPO_3 : ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_SS_LPO_3 : ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_HS_WS1_3 : ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_SS_WS1_3 : ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_HS_P98_3 : ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
case I_SS_P98_3 : ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > Show ( consistent ) ; break ;
2021-01-15 14:43:11 +00:00
}
2023-06-30 19:12:59 +00:00
}
2021-01-15 14:43:11 +00:00
static bool canShow ( void * busPtr , uint8_t busType ) {
2021-01-15 23:50:43 +00:00
switch ( busType ) {
case I_NONE : return true ;
# ifdef ESP8266
case I_8266_U0_NEO_3 : return ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_NEO_3 : return ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_NEO_3 : return ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_NEO_3 : return ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U0_NEO_4 : return ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_NEO_4 : return ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_NEO_4 : return ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_NEO_4 : return ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U0_400_3 : return ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_400_3 : return ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_400_3 : return ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_400_3 : return ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U0_TM1_4 : return ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_TM1_4 : return ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_TM1_4 : return ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_TM1_4 : return ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : return ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_TM2_3 : return ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_TM2_3 : return ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_TM2_3 : return ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : return ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_UCS_3 : return ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_UCS_3 : return ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_UCS_3 : return ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U0_UCS_4 : return ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_UCS_4 : return ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_UCS_4 : return ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2025-01-19 09:17:33 +00:00
case I_8266_BB_UCS_4 : return ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : return ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_APA106_3 : return ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_APA106_3 : return ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_APA106_3 : return ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : return ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_FW6_5 : return ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_FW6_5 : return ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_FW6_5 : return ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : return ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_2805_5 : return ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_2805_5 : return ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_2805_5 : return ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : return ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_TM1914_3 : return ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_TM1914_3 : return ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_TM1914_3 : return ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : return ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_U1_SM16825_5 : return ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_DM_SM16825_5 : return ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_8266_BB_SM16825_5 : return ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2021-01-15 23:50:43 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2024-10-03 13:21:39 +00:00
case I_32_RN_NEO_3 : return ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_NEO_4 : return ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_400_3 : return ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_TM1_4 : return ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_TM2_3 : return ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_UCS_3 : return ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_UCS_4 : return ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_APA106_3 : return ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_FW6_5 : return ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_2805_5 : return ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_TM1914_3 : return ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_RN_SM16825_5 : return ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) return ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; else return ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-15 23:50:43 +00:00
# endif
case I_HS_DOT_3 : return ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_SS_DOT_3 : return ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_HS_LPD_3 : return ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_SS_LPD_3 : return ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2021-12-27 22:54:37 +00:00
case I_HS_LPO_3 : return ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_SS_LPO_3 : return ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
2021-01-15 23:50:43 +00:00
case I_HS_WS1_3 : return ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_SS_WS1_3 : return ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_HS_P98_3 : return ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
case I_SS_P98_3 : return ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > CanShow ( ) ; break ;
}
return true ;
2023-06-30 19:12:59 +00:00
}
2025-01-19 10:37:57 +00:00
[ [ gnu : : hot ] ] static void setPixelColor ( void * busPtr , uint8_t busType , uint16_t pix , uint32_t c , uint8_t co , uint16_t wwcw = 0 ) {
2021-01-15 23:50:43 +00:00
uint8_t r = c > > 16 ;
uint8_t g = c > > 8 ;
uint8_t b = c > > 0 ;
uint8_t w = c > > 24 ;
2021-01-16 16:11:23 +00:00
RgbwColor col ;
2024-03-11 10:17:45 +00:00
uint8_t cctWW = wwcw & 0xFF , cctCW = ( wwcw > > 8 ) & 0xFF ;
2021-01-16 16:11:23 +00:00
2022-04-30 10:45:38 +00:00
// reorder channels to selected order
switch ( co & 0x0F ) {
default : col . G = g ; col . R = r ; col . B = b ; break ; //0 = GRB, default
2021-01-16 16:11:23 +00:00
case 1 : col . G = r ; col . R = g ; col . B = b ; break ; //1 = RGB, common for WS2811
case 2 : col . G = b ; col . R = r ; col . B = g ; break ; //2 = BRG
case 3 : col . G = r ; col . R = b ; col . B = g ; break ; //3 = RBG
case 4 : col . G = b ; col . R = g ; col . B = r ; break ; //4 = BGR
2022-04-30 10:45:38 +00:00
case 5 : col . G = g ; col . R = b ; col . B = r ; break ; //5 = GBR
}
// upper nibble contains W swap information
switch ( co > > 4 ) {
default : col . W = w ; break ; // no swapping
case 1 : col . W = col . B ; col . B = w ; break ; // swap W & B
case 2 : col . W = col . G ; col . G = w ; break ; // swap W & G
case 3 : col . W = col . R ; col . R = w ; break ; // swap W & R
2024-08-05 18:56:12 +00:00
case 4 : std : : swap ( cctWW , cctCW ) ; break ; // swap WW & CW
2021-01-16 16:11:23 +00:00
}
2021-01-15 23:50:43 +00:00
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
2023-04-27 23:28:57 +00:00
case I_8266_U0_NEO_3 : ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_U1_NEO_3 : ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_DM_NEO_3 : ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_BB_NEO_3 : ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2021-01-16 16:11:23 +00:00
case I_8266_U0_NEO_4 : ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_U1_NEO_4 : ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_DM_NEO_4 : ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_BB_NEO_4 : ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_400_3 : ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_U1_400_3 : ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_DM_400_3 : ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_BB_400_3 : ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2021-01-16 16:11:23 +00:00
case I_8266_U0_TM1_4 : ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_U1_TM1_4 : ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_DM_TM1_4 : ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_8266_BB_TM1_4 : ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_U1_TM2_3 : ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_DM_TM2_3 : ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_BB_TM2_3 : ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_8266_U1_UCS_3 : ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_8266_DM_UCS_3 : ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_8266_BB_UCS_3 : ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_8266_U0_UCS_4 : ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
case I_8266_U1_UCS_4 : ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
case I_8266_DM_UCS_4 : ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
case I_8266_BB_UCS_4 : ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_U1_APA106_3 : ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_DM_APA106_3 : ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_BB_APA106_3 : ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_U1_FW6_5 : ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_DM_FW6_5 : ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_BB_FW6_5 : ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_U1_2805_5 : ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_DM_2805_5 : ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_8266_BB_2805_5 : ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_U1_TM1914_3 : ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_DM_TM1914_3 : ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_8266_BB_TM1914_3 : ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
case I_8266_U1_SM16825_5 : ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
case I_8266_DM_SM16825_5 : ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
case I_8266_BB_SM16825_5 : ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
2021-01-15 23:50:43 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2023-04-27 23:28:57 +00:00
case I_32_RN_NEO_3 : ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2021-07-03 11:52:23 +00:00
case I_32_RN_NEO_4 : ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
2023-04-27 23:28:57 +00:00
case I_32_RN_400_3 : ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2021-07-03 11:52:23 +00:00
case I_32_RN_TM1_4 : ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
2023-04-27 23:28:57 +00:00
case I_32_RN_TM2_3 : ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_32_RN_UCS_4 : ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
case I_32_RN_APA106_3 : ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_RN_FW6_5 : ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_32_RN_2805_5 : ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_32_RN_TM1914_3 : ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > SetPixelColor ( pix , col ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgb48Color ( RgbColor ( col ) ) ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbw64Color ( col ) ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; else ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; else ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbwwColor ( col . R , col . G , col . B , cctWW , cctCW ) ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; else ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; else ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > SetPixelColor ( pix , Rgbww80Color ( col . R * 257 , col . G * 257 , col . B * 257 , cctWW * 257 , cctCW * 257 ) ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-15 23:50:43 +00:00
# endif
2023-04-27 23:28:57 +00:00
case I_HS_DOT_3 : ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_SS_DOT_3 : ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_HS_LPD_3 : ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_SS_LPD_3 : ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_HS_LPO_3 : ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_SS_LPO_3 : ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_HS_WS1_3 : ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_SS_WS1_3 : ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_HS_P98_3 : ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
case I_SS_P98_3 : ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > SetPixelColor ( pix , RgbColor ( col ) ) ; break ;
2021-01-15 23:50:43 +00:00
}
2023-06-30 19:12:59 +00:00
}
2021-01-15 23:50:43 +00:00
static void setBrightness ( void * busPtr , uint8_t busType , uint8_t b ) {
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
2023-06-26 20:12:32 +00:00
case I_8266_U0_NEO_3 : ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_NEO_3 : ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_NEO_3 : ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_NEO_3 : ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U0_NEO_4 : ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_NEO_4 : ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_NEO_4 : ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_NEO_4 : ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U0_400_3 : ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_400_3 : ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_400_3 : ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_400_3 : ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U0_TM1_4 : ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_TM1_4 : ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_TM1_4 : ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_TM1_4 : ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_TM2_3 : ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_TM2_3 : ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_TM2_3 : ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2023-06-26 20:12:32 +00:00
case I_8266_U0_UCS_3 : ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_UCS_3 : ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_UCS_3 : ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_UCS_3 : ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U0_UCS_4 : ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_UCS_4 : ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_UCS_4 : ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_UCS_4 : ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_APA106_3 : ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_APA106_3 : ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_APA106_3 : ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_FW6_5 : ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_FW6_5 : ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_FW6_5 : ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_2805_5 : ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_2805_5 : ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_2805_5 : ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_TM1914_3 : ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_TM1914_3 : ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_TM1914_3 : ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_U1_SM16825_5 : ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_DM_SM16825_5 : ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_8266_BB_SM16825_5 : ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2021-01-15 23:50:43 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2023-06-26 20:12:32 +00:00
case I_32_RN_NEO_3 : ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_NEO_4 : ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_400_3 : ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_TM1_4 : ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_TM2_3 : ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_UCS_4 : ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_APA106_3 : ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_FW6_5 : ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_2805_5 : ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_RN_TM1914_3 : ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; else ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-15 23:50:43 +00:00
# endif
2023-06-26 20:12:32 +00:00
case I_HS_DOT_3 : ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_SS_DOT_3 : ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_HS_LPD_3 : ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_SS_LPD_3 : ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_HS_LPO_3 : ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_SS_LPO_3 : ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_HS_WS1_3 : ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_SS_WS1_3 : ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_HS_P98_3 : ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
case I_SS_P98_3 : ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > SetLuminance ( b ) ; break ;
2021-01-15 23:50:43 +00:00
}
2023-06-30 19:12:59 +00:00
}
2025-01-19 10:37:57 +00:00
[ [ gnu : : hot ] ] static uint32_t getPixelColor ( void * busPtr , uint8_t busType , uint16_t pix , uint8_t co ) {
2023-01-06 08:24:29 +00:00
RgbwColor col ( 0 , 0 , 0 , 0 ) ;
2021-01-16 16:11:23 +00:00
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
case I_8266_U0_NEO_3 : col = ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_NEO_3 : col = ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_NEO_3 : col = ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_NEO_3 : col = ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U0_NEO_4 : col = ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_NEO_4 : col = ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_NEO_4 : col = ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_NEO_4 : col = ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U0_400_3 : col = ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_400_3 : col = ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_400_3 : col = ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_400_3 : col = ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U0_TM1_4 : col = ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_TM1_4 : col = ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_TM1_4 : col = ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_TM1_4 : col = ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : col = ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_TM2_3 : col = ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_TM2_3 : col = ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_TM2_3 : col = ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : { Rgb48Color c = ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , 0 ) ; } break ;
case I_8266_U1_UCS_3 : { Rgb48Color c = ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , 0 ) ; } break ;
case I_8266_DM_UCS_3 : { Rgb48Color c = ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , 0 ) ; } break ;
case I_8266_BB_UCS_3 : { Rgb48Color c = ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , 0 ) ; } break ;
case I_8266_U0_UCS_4 : { Rgbw64Color c = ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , c . W > > 8 ) ; } break ;
case I_8266_U1_UCS_4 : { Rgbw64Color c = ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , c . W > > 8 ) ; } break ;
case I_8266_DM_UCS_4 : { Rgbw64Color c = ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , c . W > > 8 ) ; } break ;
case I_8266_BB_UCS_4 : { Rgbw64Color c = ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , c . W > > 8 ) ; } break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : col = ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_APA106_3 : col = ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_APA106_3 : col = ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_APA106_3 : col = ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2024-03-11 10:17:45 +00:00
case I_8266_U0_FW6_5 : { RgbwwColor c = ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_U1_FW6_5 : { RgbwwColor c = ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_DM_FW6_5 : { RgbwwColor c = ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_BB_FW6_5 : { RgbwwColor c = ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : { RgbwwColor c = ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_U1_2805_5 : { RgbwwColor c = ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_DM_2805_5 : { RgbwwColor c = ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_BB_2805_5 : { RgbwwColor c = ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : col = ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_U1_TM1914_3 : col = ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_DM_TM1914_3 : col = ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_8266_BB_TM1914_3 : col = ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : { Rgbww80Color c = ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_U1_SM16825_5 : { Rgbww80Color c = ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_DM_SM16825_5 : { Rgbww80Color c = ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_8266_BB_SM16825_5 : { Rgbww80Color c = ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
2021-01-16 16:11:23 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2021-07-03 11:52:23 +00:00
case I_32_RN_NEO_3 : col = ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_RN_NEO_4 : col = ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_RN_400_3 : col = ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_RN_TM1_4 : col = ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2022-06-20 13:03:17 +00:00
case I_32_RN_TM2_3 : col = ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : { Rgb48Color c = ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , 0 ) ; } break ;
case I_32_RN_UCS_4 : { Rgbw64Color c = ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R > > 8 , c . G > > 8 , c . B > > 8 , c . W > > 8 ) ; } break ;
case I_32_RN_APA106_3 : col = ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_RN_FW6_5 : { RgbwwColor c = ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_32_RN_2805_5 : { RgbwwColor c = ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_32_RN_TM1914_3 : col = ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : { Rgbww80Color c = ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R / 257 , c . G / 257 , c . B / 257 , max ( c . WW , c . CW ) / 257 ) ; } break ; // will not return original W
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_NEO_4 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_400_3 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_TM1_4 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_TM2_3 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_UCS_3 : { Rgb48Color c = ( _useParallelI2S ) ? ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R / 257 , c . G / 257 , c . B / 257 , 0 ) ; } break ;
case I_32_I2_UCS_4 : { Rgbw64Color c = ( _useParallelI2S ) ? ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R / 257 , c . G / 257 , c . B / 257 , c . W / 257 ) ; } break ;
case I_32_I2_APA106_3 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_FW6_5 : { RgbwwColor c = ( _useParallelI2S ) ? ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_32_I2_2805_5 : { RgbwwColor c = ( _useParallelI2S ) ? ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R , c . G , c . B , max ( c . WW , c . CW ) ) ; } break ; // will not return original W
case I_32_I2_TM1914_3 : col = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_32_I2_SM16825_5 : { Rgbww80Color c = ( _useParallelI2S ) ? ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) : ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; col = RGBW32 ( c . R / 257 , c . G / 257 , c . B / 257 , max ( c . WW , c . CW ) / 257 ) ; } break ; // will not return original W
2024-04-15 14:13:13 +00:00
# endif
2021-01-16 16:11:23 +00:00
# endif
case I_HS_DOT_3 : col = ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_SS_DOT_3 : col = ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_HS_LPD_3 : col = ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_SS_LPD_3 : col = ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2021-12-27 22:54:37 +00:00
case I_HS_LPO_3 : col = ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_SS_LPO_3 : col = ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
2021-01-16 16:11:23 +00:00
case I_HS_WS1_3 : col = ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_SS_WS1_3 : col = ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_HS_P98_3 : col = ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
case I_SS_P98_3 : col = ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > GetPixelColor ( pix ) ; break ;
}
2023-01-06 08:24:29 +00:00
2022-04-30 10:45:38 +00:00
// upper nibble contains W swap information
uint8_t w = col . W ;
switch ( co > > 4 ) {
case 1 : col . W = col . B ; col . B = w ; break ; // swap W & B
case 2 : col . W = col . G ; col . G = w ; break ; // swap W & G
case 3 : col . W = col . R ; col . R = w ; break ; // swap W & R
}
switch ( co & 0x0F ) {
2021-01-16 16:11:23 +00:00
// W G R B
2022-04-30 10:45:38 +00:00
default : return ( ( col . W < < 24 ) | ( col . G < < 8 ) | ( col . R < < 16 ) | ( col . B ) ) ; //0 = GRB, default
2021-01-16 16:11:23 +00:00
case 1 : return ( ( col . W < < 24 ) | ( col . R < < 8 ) | ( col . G < < 16 ) | ( col . B ) ) ; //1 = RGB, common for WS2811
case 2 : return ( ( col . W < < 24 ) | ( col . B < < 8 ) | ( col . R < < 16 ) | ( col . G ) ) ; //2 = BRG
case 3 : return ( ( col . W < < 24 ) | ( col . B < < 8 ) | ( col . G < < 16 ) | ( col . R ) ) ; //3 = RBG
case 4 : return ( ( col . W < < 24 ) | ( col . R < < 8 ) | ( col . B < < 16 ) | ( col . G ) ) ; //4 = BGR
case 5 : return ( ( col . W < < 24 ) | ( col . G < < 8 ) | ( col . B < < 16 ) | ( col . R ) ) ; //5 = GBR
}
return 0 ;
2021-01-15 23:50:43 +00:00
}
2021-01-16 18:53:08 +00:00
static void cleanup ( void * busPtr , uint8_t busType ) {
if ( busPtr = = nullptr ) return ;
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
case I_8266_U0_NEO_3 : delete ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_NEO_3 : delete ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_NEO_3 : delete ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_NEO_3 : delete ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) ; break ;
case I_8266_U0_NEO_4 : delete ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) ; break ;
case I_8266_U1_NEO_4 : delete ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) ; break ;
case I_8266_DM_NEO_4 : delete ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) ; break ;
case I_8266_BB_NEO_4 : delete ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) ; break ;
case I_8266_U0_400_3 : delete ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_400_3 : delete ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_400_3 : delete ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_400_3 : delete ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) ; break ;
case I_8266_U0_TM1_4 : delete ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) ; break ;
case I_8266_U1_TM1_4 : delete ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) ; break ;
case I_8266_DM_TM1_4 : delete ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) ; break ;
case I_8266_BB_TM1_4 : delete ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM2_3 : delete ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_TM2_3 : delete ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_TM2_3 : delete ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_TM2_3 : delete ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) ; break ;
2023-04-27 23:28:57 +00:00
case I_8266_U0_UCS_3 : delete ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_UCS_3 : delete ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_UCS_3 : delete ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_UCS_3 : delete ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) ; break ;
case I_8266_U0_UCS_4 : delete ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) ; break ;
case I_8266_U1_UCS_4 : delete ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) ; break ;
case I_8266_DM_UCS_4 : delete ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) ; break ;
case I_8266_BB_UCS_4 : delete ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) ; break ;
2023-12-11 08:26:20 +00:00
case I_8266_U0_APA106_3 : delete ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_APA106_3 : delete ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_APA106_3 : delete ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_APA106_3 : delete ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) ; break ;
2023-07-19 07:22:29 +00:00
case I_8266_U0_FW6_5 : delete ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) ; break ;
case I_8266_U1_FW6_5 : delete ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) ; break ;
case I_8266_DM_FW6_5 : delete ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) ; break ;
case I_8266_BB_FW6_5 : delete ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) ; break ;
2024-03-24 16:37:11 +00:00
case I_8266_U0_2805_5 : delete ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) ; break ;
case I_8266_U1_2805_5 : delete ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) ; break ;
case I_8266_DM_2805_5 : delete ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) ; break ;
case I_8266_BB_2805_5 : delete ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) ; break ;
2024-04-15 14:13:13 +00:00
case I_8266_U0_TM1914_3 : delete ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) ; break ;
case I_8266_U1_TM1914_3 : delete ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) ; break ;
case I_8266_DM_TM1914_3 : delete ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) ; break ;
case I_8266_BB_TM1914_3 : delete ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) ; break ;
2024-08-05 18:56:12 +00:00
case I_8266_U0_SM16825_5 : delete ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) ; break ;
case I_8266_U1_SM16825_5 : delete ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) ; break ;
case I_8266_DM_SM16825_5 : delete ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) ; break ;
case I_8266_BB_SM16825_5 : delete ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) ; break ;
2021-01-16 18:53:08 +00:00
# endif
# ifdef ARDUINO_ARCH_ESP32
2024-06-12 16:00:00 +00:00
// RMT buses
2021-07-03 11:52:23 +00:00
case I_32_RN_NEO_3 : delete ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) ; break ;
case I_32_RN_NEO_4 : delete ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) ; break ;
case I_32_RN_400_3 : delete ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) ; break ;
case I_32_RN_TM1_4 : delete ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) ; break ;
2022-06-20 13:03:17 +00:00
case I_32_RN_TM2_3 : delete ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) ; break ;
2024-06-12 16:00:00 +00:00
case I_32_RN_UCS_3 : delete ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) ; break ;
case I_32_RN_UCS_4 : delete ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) ; break ;
case I_32_RN_APA106_3 : delete ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) ; break ;
case I_32_RN_FW6_5 : delete ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) ; break ;
case I_32_RN_2805_5 : delete ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) ; break ;
case I_32_RN_TM1914_3 : delete ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) ; break ;
2024-08-05 18:56:12 +00:00
case I_32_RN_SM16825_5 : delete ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) ; break ;
2024-06-12 16:00:00 +00:00
// I2S1 bus or paralell buses
2025-01-19 09:17:33 +00:00
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) ; break ;
case I_32_I2_NEO_4 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) ; break ;
case I_32_I2_400_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) ; break ;
case I_32_I2_TM1_4 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) ; break ;
case I_32_I2_TM2_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) ; break ;
case I_32_I2_UCS_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) ; break ;
case I_32_I2_UCS_4 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) ; break ;
case I_32_I2_APA106_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) ; break ;
case I_32_I2_FW6_5 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) ; break ;
case I_32_I2_2805_5 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) ; break ;
case I_32_I2_TM1914_3 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) ; break ;
case I_32_I2_SM16825_5 : if ( _useParallelI2S ) delete ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) ; else delete ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) ; break ;
2024-04-15 14:13:13 +00:00
# endif
2021-01-16 18:53:08 +00:00
# endif
case I_HS_DOT_3 : delete ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) ; break ;
case I_SS_DOT_3 : delete ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) ; break ;
case I_HS_LPD_3 : delete ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) ; break ;
case I_SS_LPD_3 : delete ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) ; break ;
2021-12-27 22:54:37 +00:00
case I_HS_LPO_3 : delete ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) ; break ;
case I_SS_LPO_3 : delete ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) ; break ;
2021-01-16 18:53:08 +00:00
case I_HS_WS1_3 : delete ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) ; break ;
case I_SS_WS1_3 : delete ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) ; break ;
case I_HS_P98_3 : delete ( static_cast < B_HS_P98_3 * > ( busPtr ) ) ; break ;
case I_SS_P98_3 : delete ( static_cast < B_SS_P98_3 * > ( busPtr ) ) ; break ;
}
}
2025-01-19 09:17:33 +00:00
static unsigned getDataSize ( void * busPtr , uint8_t busType ) {
unsigned size = 0 ;
switch ( busType ) {
case I_NONE : break ;
# ifdef ESP8266
case I_8266_U0_NEO_3 : size = ( static_cast < B_8266_U0_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_NEO_3 : size = ( static_cast < B_8266_U1_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_NEO_3 : size = ( static_cast < B_8266_DM_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_NEO_3 : size = ( static_cast < B_8266_BB_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_NEO_4 : size = ( static_cast < B_8266_U0_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_NEO_4 : size = ( static_cast < B_8266_U1_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_NEO_4 : size = ( static_cast < B_8266_DM_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_NEO_4 : size = ( static_cast < B_8266_BB_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_400_3 : size = ( static_cast < B_8266_U0_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_400_3 : size = ( static_cast < B_8266_U1_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_400_3 : size = ( static_cast < B_8266_DM_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_400_3 : size = ( static_cast < B_8266_BB_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_TM1_4 : size = ( static_cast < B_8266_U0_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_TM1_4 : size = ( static_cast < B_8266_U1_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_TM1_4 : size = ( static_cast < B_8266_DM_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_TM1_4 : size = ( static_cast < B_8266_BB_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_TM2_3 : size = ( static_cast < B_8266_U0_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_TM2_3 : size = ( static_cast < B_8266_U1_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_TM2_3 : size = ( static_cast < B_8266_DM_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_TM2_3 : size = ( static_cast < B_8266_BB_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_UCS_3 : size = ( static_cast < B_8266_U0_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_UCS_3 : size = ( static_cast < B_8266_U1_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_UCS_3 : size = ( static_cast < B_8266_DM_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_UCS_3 : size = ( static_cast < B_8266_BB_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_UCS_4 : size = ( static_cast < B_8266_U0_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_UCS_4 : size = ( static_cast < B_8266_U1_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_UCS_4 : size = ( static_cast < B_8266_DM_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_UCS_4 : size = ( static_cast < B_8266_BB_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_APA106_3 : size = ( static_cast < B_8266_U0_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_APA106_3 : size = ( static_cast < B_8266_U1_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_APA106_3 : size = ( static_cast < B_8266_DM_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_APA106_3 : size = ( static_cast < B_8266_BB_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_FW6_5 : size = ( static_cast < B_8266_U0_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_FW6_5 : size = ( static_cast < B_8266_U1_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_FW6_5 : size = ( static_cast < B_8266_DM_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_FW6_5 : size = ( static_cast < B_8266_BB_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_2805_5 : size = ( static_cast < B_8266_U0_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_2805_5 : size = ( static_cast < B_8266_U1_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_2805_5 : size = ( static_cast < B_8266_DM_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_2805_5 : size = ( static_cast < B_8266_BB_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_TM1914_3 : size = ( static_cast < B_8266_U0_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_TM1914_3 : size = ( static_cast < B_8266_U1_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_TM1914_3 : size = ( static_cast < B_8266_DM_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_TM1914_3 : size = ( static_cast < B_8266_BB_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U0_SM16825_5 : size = ( static_cast < B_8266_U0_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_U1_SM16825_5 : size = ( static_cast < B_8266_U1_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_8266_DM_SM16825_5 : size = ( static_cast < B_8266_DM_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 5 ; break ;
case I_8266_BB_SM16825_5 : size = ( static_cast < B_8266_BB_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
# endif
# ifdef ARDUINO_ARCH_ESP32
// RMT buses (front + back + small system managed RMT)
case I_32_RN_NEO_3 : size = ( static_cast < B_32_RN_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_NEO_4 : size = ( static_cast < B_32_RN_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_400_3 : size = ( static_cast < B_32_RN_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_TM1_4 : size = ( static_cast < B_32_RN_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_TM2_3 : size = ( static_cast < B_32_RN_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_UCS_3 : size = ( static_cast < B_32_RN_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_UCS_4 : size = ( static_cast < B_32_RN_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_APA106_3 : size = ( static_cast < B_32_RN_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_FW6_5 : size = ( static_cast < B_32_RN_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_2805_5 : size = ( static_cast < B_32_RN_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_TM1914_3 : size = ( static_cast < B_32_RN_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_32_RN_SM16825_5 : size = ( static_cast < B_32_RN_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
// I2S1 bus or paralell buses (front + DMA; DMA = front * cadence, aligned to 4 bytes)
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_NEO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_NEO_4 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_NEO_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_400_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_400_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_TM1_4 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_TM1_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_TM2_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_TM2_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_UCS_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_UCS_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_UCS_4 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_UCS_4 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_APA106_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_APA106_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_FW6_5 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_FW6_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_2805_5 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_2805_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_TM1914_3 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_TM1914_3 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
case I_32_I2_SM16825_5 : size = ( _useParallelI2S ) ? ( static_cast < B_32_IP_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 : ( static_cast < B_32_I2_SM16825_5 * > ( busPtr ) ) - > PixelsSize ( ) * 4 ; break ;
# endif
# endif
case I_HS_DOT_3 : size = ( static_cast < B_HS_DOT_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_SS_DOT_3 : size = ( static_cast < B_SS_DOT_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_HS_LPD_3 : size = ( static_cast < B_HS_LPD_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_SS_LPD_3 : size = ( static_cast < B_SS_LPD_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_HS_LPO_3 : size = ( static_cast < B_HS_LPO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_SS_LPO_3 : size = ( static_cast < B_SS_LPO_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_HS_WS1_3 : size = ( static_cast < B_HS_WS1_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_SS_WS1_3 : size = ( static_cast < B_SS_WS1_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_HS_P98_3 : size = ( static_cast < B_HS_P98_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
case I_SS_P98_3 : size = ( static_cast < B_SS_P98_3 * > ( busPtr ) ) - > PixelsSize ( ) * 2 ; break ;
}
return size ;
}
static unsigned memUsage ( unsigned count , unsigned busType ) {
unsigned size = count * 3 ; // let's assume 3 channels, we will add count or 2*count below for 4 channels or 5 channels
switch ( busType ) {
case I_NONE : size = 0 ; break ;
# ifdef ESP8266
// UART methods have front + back buffers + small UART
case I_8266_U0_NEO_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_U1_NEO_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_BB_NEO_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_U0_TM1_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_U1_TM1_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_BB_TM1_4 : size = ( size + count ) * 2 ; break ; // 4 channels
case I_8266_U0_UCS_3 : size * = 4 ; break ; // 16 bit
case I_8266_U1_UCS_3 : size * = 4 ; break ; // 16 bit
case I_8266_BB_UCS_3 : size * = 4 ; break ; // 16 bit
case I_8266_U0_UCS_4 : size = ( size + count ) * 2 * 2 ; break ; // 16 bit 4 channels
case I_8266_U1_UCS_4 : size = ( size + count ) * 2 * 2 ; break ; // 16 bit 4 channels
case I_8266_BB_UCS_4 : size = ( size + count ) * 2 * 2 ; break ; // 16 bit 4 channels
case I_8266_U0_FW6_5 : size = ( size + 2 * count ) * 2 ; break ; // 5 channels
case I_8266_U1_FW6_5 : size = ( size + 2 * count ) * 2 ; break ; // 5channels
case I_8266_BB_FW6_5 : size = ( size + 2 * count ) * 2 ; break ; // 5 channels
case I_8266_U0_2805_5 : size = ( size + 2 * count ) * 2 ; break ; // 5 channels
case I_8266_U1_2805_5 : size = ( size + 2 * count ) * 2 ; break ; // 5 channels
case I_8266_BB_2805_5 : size = ( size + 2 * count ) * 2 ; break ; // 5 channels
case I_8266_U0_SM16825_5 : size = ( size + 2 * count ) * 2 * 2 ; break ; // 16 bit 5 channels
case I_8266_U1_SM16825_5 : size = ( size + 2 * count ) * 2 * 2 ; break ; // 16 bit 5 channels
case I_8266_BB_SM16825_5 : size = ( size + 2 * count ) * 2 * 2 ; break ; // 16 bit 5 channels
// DMA methods have front + DMA buffer = ((1+(3+1)) * channels)
case I_8266_DM_NEO_3 : size * = 5 ; break ;
case I_8266_DM_NEO_4 : size = ( size + count ) * 5 ; break ;
case I_8266_DM_400_3 : size * = 5 ; break ;
case I_8266_DM_TM1_4 : size = ( size + count ) * 5 ; break ;
case I_8266_DM_TM2_3 : size * = 5 ; break ;
case I_8266_DM_UCS_3 : size * = 2 * 5 ; break ;
case I_8266_DM_UCS_4 : size = ( size + count ) * 2 * 5 ; break ;
case I_8266_DM_APA106_3 : size * = 5 ; break ;
case I_8266_DM_FW6_5 : size = ( size + 2 * count ) * 5 ; break ;
case I_8266_DM_2805_5 : size = ( size + 2 * count ) * 5 ; break ;
case I_8266_DM_TM1914_3 : size * = 5 ; break ;
case I_8266_DM_SM16825_5 : size = ( size + 2 * count ) * 2 * 5 ; break ;
# endif
# ifdef ARDUINO_ARCH_ESP32
// RMT buses (1x front and 1x back buffer)
case I_32_RN_NEO_4 : size = ( size + count ) * 2 ; break ;
case I_32_RN_TM1_4 : size = ( size + count ) * 2 ; break ;
case I_32_RN_UCS_3 : size * = 2 * 2 ; break ;
case I_32_RN_UCS_4 : size = ( size + count ) * 2 * 2 ; break ;
case I_32_RN_FW6_5 : size = ( size + 2 * count ) * 2 ; break ;
case I_32_RN_2805_5 : size = ( size + 2 * count ) * 2 ; break ;
case I_32_RN_SM16825_5 : size = ( size + 2 * count ) * 2 * 2 ; break ;
// I2S1 bus or paralell buses (individual 1x front and 1 DMA (3x or 4x pixel count) or common back DMA buffers)
# ifndef CONFIG_IDF_TARGET_ESP32C3
case I_32_I2_NEO_3 : size * = 4 ; break ;
case I_32_I2_NEO_4 : size = ( size + count ) * 4 ; break ;
case I_32_I2_400_3 : size * = 4 ; break ;
case I_32_I2_TM1_4 : size = ( size + count ) * 4 ; break ;
case I_32_I2_TM2_3 : size * = 4 ; break ;
case I_32_I2_UCS_3 : size * = 2 * 4 ; break ;
case I_32_I2_UCS_4 : size = ( size + count ) * 2 * 4 ; break ;
case I_32_I2_APA106_3 : size * = 4 ; break ;
case I_32_I2_FW6_5 : size = ( size + 2 * count ) * 4 ; break ;
case I_32_I2_2805_5 : size = ( size + 2 * count ) * 4 ; break ;
case I_32_I2_TM1914_3 : size * = 4 ; break ;
case I_32_I2_SM16825_5 : size = ( size + 2 * count ) * 2 * 4 ; break ;
# endif
# endif
// everything else uses 2 buffers
default : size * = 2 ; break ;
}
return size ;
}
2023-01-06 08:24:29 +00:00
//gives back the internal type index (I_XX_XXX_X above) for the input
2025-01-19 09:17:33 +00:00
static uint8_t getI ( uint8_t busType , const uint8_t * pins , uint8_t num = 0 ) {
2024-08-24 09:35:32 +00:00
if ( ! Bus : : isDigital ( busType ) ) return I_NONE ;
if ( Bus : : is2Pin ( busType ) ) { //SPI LED chips
2020-12-07 00:39:42 +00:00
bool isHSPI = false ;
# ifdef ESP8266
if ( pins [ 0 ] = = P_8266_HS_MOSI & & pins [ 1 ] = = P_8266_HS_CLK ) isHSPI = true ;
# else
2022-09-09 15:16:52 +00:00
// temporary hack to limit use of hardware SPI to a single SPI peripheral (HSPI): only allow ESP32 hardware serial on segment 0
// SPI global variable is normally linked to VSPI on ESP32 (or FSPI C3, S3)
2021-03-29 07:00:41 +00:00
if ( ! num ) isHSPI = true ;
2020-12-07 00:39:42 +00:00
# endif
uint8_t t = I_NONE ;
switch ( busType ) {
2021-02-17 16:58:03 +00:00
case TYPE_APA102 : t = I_SS_DOT_3 ; break ;
case TYPE_LPD8806 : t = I_SS_LPD_3 ; break ;
2021-12-27 22:54:37 +00:00
case TYPE_LPD6803 : t = I_SS_LPO_3 ; break ;
2021-02-17 16:58:03 +00:00
case TYPE_WS2801 : t = I_SS_WS1_3 ; break ;
case TYPE_P9813 : t = I_SS_P98_3 ; break ;
default : t = I_NONE ;
2020-12-07 00:39:42 +00:00
}
if ( t > I_NONE & & isHSPI ) t - - ; //hardware SPI has one smaller ID than software
return t ;
} else {
# ifdef ESP8266
uint8_t offset = pins [ 0 ] - 1 ; //for driver: 0 = uart0, 1 = uart1, 2 = dma, 3 = bitbang
if ( offset > 3 ) offset = 3 ;
switch ( busType ) {
2023-02-14 00:33:06 +00:00
case TYPE_WS2812_1CH_X3 :
case TYPE_WS2812_2CH_X3 :
2020-12-07 00:39:42 +00:00
case TYPE_WS2812_RGB :
case TYPE_WS2812_WWA :
2021-10-08 06:30:06 +00:00
return I_8266_U0_NEO_3 + offset ;
2020-12-07 00:39:42 +00:00
case TYPE_SK6812_RGBW :
2021-10-08 06:30:06 +00:00
return I_8266_U0_NEO_4 + offset ;
2020-12-07 00:39:42 +00:00
case TYPE_WS2811_400KHZ :
return I_8266_U0_400_3 + offset ;
2021-04-18 17:14:12 +00:00
case TYPE_TM1814 :
return I_8266_U0_TM1_4 + offset ;
2022-06-20 13:03:17 +00:00
case TYPE_TM1829 :
return I_8266_U0_TM2_3 + offset ;
2023-04-27 23:28:57 +00:00
case TYPE_UCS8903 :
return I_8266_U0_UCS_3 + offset ;
case TYPE_UCS8904 :
return I_8266_U0_UCS_4 + offset ;
2023-12-11 08:26:20 +00:00
case TYPE_APA106 :
return I_8266_U0_APA106_3 + offset ;
2023-07-19 07:22:29 +00:00
case TYPE_FW1906 :
return I_8266_U0_FW6_5 + offset ;
2024-03-24 16:37:11 +00:00
case TYPE_WS2805 :
return I_8266_U0_2805_5 + offset ;
2024-04-15 14:13:13 +00:00
case TYPE_TM1914 :
return I_8266_U0_TM1914_3 + offset ;
2024-08-05 18:56:12 +00:00
case TYPE_SM16825 :
return I_8266_U0_SM16825_5 + offset ;
2020-12-07 00:39:42 +00:00
}
# else //ESP32
2024-03-30 10:02:28 +00:00
uint8_t offset = 0 ; // 0 = RMT (num 1-8), 1 = I2S0 (used by Audioreactive), 2 = I2S1
2022-10-13 12:25:01 +00:00
# if defined(CONFIG_IDF_TARGET_ESP32S2)
2022-10-10 15:04:25 +00:00
// ESP32-S2 only has 4 RMT channels
2025-01-19 09:17:33 +00:00
if ( _useParallelI2S ) {
if ( num > 11 ) return I_NONE ;
if ( num > 3 ) offset = 1 ; // use x8 parallel I2S0 channels (use last to allow Audioreactive)
} else {
if ( num > 4 ) return I_NONE ;
if ( num > 3 ) offset = 1 ; // only one I2S0 (use last to allow Audioreactive)
}
2022-10-10 15:04:25 +00:00
# elif defined(CONFIG_IDF_TARGET_ESP32C3)
// On ESP32-C3 only the first 2 RMT channels are usable for transmitting
if ( num > 1 ) return I_NONE ;
2022-10-13 12:25:01 +00:00
//if (num > 1) offset = 1; // I2S not supported yet (only 1 I2S)
2022-10-10 15:04:25 +00:00
# elif defined(CONFIG_IDF_TARGET_ESP32S3)
// On ESP32-S3 only the first 4 RMT channels are usable for transmitting
2025-01-19 09:17:33 +00:00
if ( _useParallelI2S ) {
if ( num > 11 ) return I_NONE ;
if ( num > 3 ) offset = 1 ; // use x8 parallel I2S LCD channels
} else {
if ( num > 3 ) return I_NONE ; // do not use single I2S (as it is not supported)
}
2022-10-10 15:04:25 +00:00
# else
2025-01-19 09:17:33 +00:00
// standard ESP32 has 8 RMT and x1/x8 I2S1 channels
if ( _useParallelI2S ) {
if ( num > 15 ) return I_NONE ;
if ( num > 7 ) offset = 1 ; // 8 RMT followed by 8 I2S
2024-06-12 16:00:00 +00:00
} else {
if ( num > 9 ) return I_NONE ;
2025-01-19 09:17:33 +00:00
if ( num = = 0 ) offset = 1 ; // prefer I2S1 for 1st bus (less flickering but more RAM needed)
2024-06-12 16:00:00 +00:00
}
2021-04-24 20:24:14 +00:00
# endif
2020-12-07 00:39:42 +00:00
switch ( busType ) {
2023-02-14 00:33:06 +00:00
case TYPE_WS2812_1CH_X3 :
case TYPE_WS2812_2CH_X3 :
2020-12-07 00:39:42 +00:00
case TYPE_WS2812_RGB :
case TYPE_WS2812_WWA :
2021-10-08 06:30:06 +00:00
return I_32_RN_NEO_3 + offset ;
2020-12-07 00:39:42 +00:00
case TYPE_SK6812_RGBW :
2021-10-08 06:30:06 +00:00
return I_32_RN_NEO_4 + offset ;
2020-12-07 00:39:42 +00:00
case TYPE_WS2811_400KHZ :
2021-07-03 11:52:23 +00:00
return I_32_RN_400_3 + offset ;
2021-04-18 17:14:12 +00:00
case TYPE_TM1814 :
2021-07-03 11:52:23 +00:00
return I_32_RN_TM1_4 + offset ;
2022-06-20 13:03:17 +00:00
case TYPE_TM1829 :
return I_32_RN_TM2_3 + offset ;
2023-04-27 23:28:57 +00:00
case TYPE_UCS8903 :
return I_32_RN_UCS_3 + offset ;
case TYPE_UCS8904 :
return I_32_RN_UCS_4 + offset ;
2023-12-11 08:26:20 +00:00
case TYPE_APA106 :
return I_32_RN_APA106_3 + offset ;
2023-07-19 07:22:29 +00:00
case TYPE_FW1906 :
return I_32_RN_FW6_5 + offset ;
2024-03-24 16:37:11 +00:00
case TYPE_WS2805 :
return I_32_RN_2805_5 + offset ;
2024-04-15 14:13:13 +00:00
case TYPE_TM1914 :
return I_32_RN_TM1914_3 + offset ;
2024-08-05 18:56:12 +00:00
case TYPE_SM16825 :
return I_32_RN_SM16825_5 + offset ;
2020-12-07 00:39:42 +00:00
}
# endif
}
return I_NONE ;
}
} ;
2023-07-19 07:22:29 +00:00
# endif