Add support for inverted NeoPixelBus data

Add support for inverted NeoPixelBus data line by enabling ``#define USE_WS2812_INVERTED`` (#8988)
This commit is contained in:
Theo Arends 2020-10-05 19:03:40 +02:00
parent 2ffb04d4da
commit 539ba11690
4 changed files with 35 additions and 2 deletions

View File

@ -79,3 +79,4 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
- Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
- Add SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)
- Add support for inverted NeoPixelBus data line by enabling ``#define USE_WS2812_INVERTED`` (#8988)

View File

@ -20,6 +20,7 @@
- Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
- Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
- Add SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)
- Add support for inverted NeoPixelBus data line by enabling ``#define USE_WS2812_INVERTED`` (#8988)
## Released

View File

@ -474,6 +474,7 @@
// -- Optional light modules ----------------------
#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
// #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow
// #define USE_WS2812_INVERTED // Use inverted data signal
#define USE_WS2812_HARDWARE NEO_HW_WS2812 // Hardware type (NEO_HW_WS2812, NEO_HW_WS2812X, NEO_HW_WS2813, NEO_HW_SK6812, NEO_HW_LC8812, NEO_HW_APA106)
#define USE_WS2812_CTYPE NEO_GRB // Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_RGBW, NEO_GRBW)
#define USE_MY92X1 // Add support for MY92X1 RGBCW led controller as used in Sonoff B1, Ailight and Lohas

View File

@ -63,7 +63,21 @@ void (* const Ws2812Command[])(void) PROGMEM = {
#ifdef USE_WS2812_DMA
#ifdef USE_WS2812_INVERTED
// See NeoEspDmaMethod.h for available options
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
typedef NeoEsp8266DmaInvertedWs2812xMethod selectedNeoSpeedType;
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
typedef NeoEsp8266DmaInvertedSk6812Method selectedNeoSpeedType;
#elif (USE_WS2812_HARDWARE == NEO_HW_APA106)
typedef NeoEsp8266DmaInvertedApa106Method selectedNeoSpeedType;
#else // USE_WS2812_HARDWARE
typedef NeoEsp8266DmaInverted800KbpsMethod selectedNeoSpeedType;
#endif // USE_WS2812_HARDWARE
#else // No USE_WS2812_INVERTED
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
typedef NeoEsp8266DmaWs2812xMethod selectedNeoSpeedType;
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
@ -74,9 +88,23 @@ void (* const Ws2812Command[])(void) PROGMEM = {
typedef NeoEsp8266Dma800KbpsMethod selectedNeoSpeedType;
#endif // USE_WS2812_HARDWARE
#else // USE_WS2812_DMA
#endif // No USE_WS2812_INVERTED
#else // No USE_WS2812_DMA
#ifdef USE_WS2812_INVERTED
// See NeoEspBitBangMethod.h for available options
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
typedef NeoEsp8266BitBangWs2812xInvertedMethod selectedNeoSpeedType;
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
typedef NeoEsp8266BitBangSk6812InvertedMethod selectedNeoSpeedType;
#else // USE_WS2812_HARDWARE
typedef NeoEsp8266BitBang400KbpsInvertedMethod selectedNeoSpeedType;
#endif // USE_WS2812_HARDWARE
#else // No USE_WS2812_INVERTED
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
typedef NeoEsp8266BitBangWs2812xMethod selectedNeoSpeedType;
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
@ -85,7 +113,9 @@ void (* const Ws2812Command[])(void) PROGMEM = {
typedef NeoEsp8266BitBang800KbpsMethod selectedNeoSpeedType;
#endif // USE_WS2812_HARDWARE
#endif // USE_WS2812_DMA
#endif // No USE_WS2812_INVERTED
#endif // No USE_WS2812_DMA
NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType> *strip = nullptr;