mirror of https://github.com/arendst/Tasmota.git
Add compile time define USE_WS2812_HARDWARE to select hardware type WS2812, WS2812X, WS2813, SK6812, LC8812 or APA106 (DMA mode only)
Add compile time define USE_WS2812_HARDWARE to select hardware type WS2812, WS2812X, WS2813, SK6812, LC8812 or APA106 (DMA mode only)
This commit is contained in:
parent
48783a4772
commit
b363bb55a9
|
@ -2,6 +2,7 @@
|
|||
* 6.6.0.9 20190828
|
||||
* Change theoretical baudrate range to 300..19660500 bps in 300 increments (#6294)
|
||||
* Add Full support of all protocols in IRremoteESP8266, to be used on dedicated-IR Tasmota version. Warning: +81k Flash when compiling with USE_IR_REMOTE_FULL
|
||||
* Add compile time define USE_WS2812_HARDWARE to select hardware type WS2812, WS2812X, WS2813, SK6812, LC8812 or APA106 (DMA mode only)
|
||||
*
|
||||
* 6.6.0.8 20190827
|
||||
* Add Tuya Energy monitoring by Shantur Rathore
|
||||
|
|
|
@ -487,9 +487,9 @@
|
|||
// ------------------------------------------------
|
||||
|
||||
#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
|
||||
#define USE_WS2812_BTYPE NEO_BB_DEFAULT // BitBang type (NEO_BB_DEFAULT, NEO_BB_WS2812X, NEO_BB_SK6812)
|
||||
#define USE_WS2812_CTYPE NEO_GRB // WS2812 Color type (NEO_RGB, NEO_GRB, NEO_BRG, NEO_RBG, NEO_RGBW, NEO_GRBW)
|
||||
// #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_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_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
|
||||
|
||||
|
|
|
@ -172,9 +172,12 @@ const uint32_t LOOP_SLEEP_DELAY = 50; // Lowest number of milliseconds to
|
|||
#define RGB_REMAP_BRGW 48
|
||||
#define RGB_REMAP_BGRW 54
|
||||
|
||||
#define NEO_BB_DEFAULT 0 // NeoPixelBus BitBang speed 800kBps with reset time 50 uSec
|
||||
#define NEO_BB_WS2812X 1 // NeoPixelBus BitBang speed 800kBps with reset time 300 uSec
|
||||
#define NEO_BB_SK6812 2 // NeoPixelBus BitBang speed 800kBps with reset time 80 uSec
|
||||
#define NEO_HW_WS2812 0 // NeoPixelBus hardware WS2812
|
||||
#define NEO_HW_WS2812X 1 // NeoPixelBus hardware WS2812x like WS2812b
|
||||
#define NEO_HW_WS2813 1 // NeoPixelBus hardware WS2813
|
||||
#define NEO_HW_SK6812 2 // NeoPixelBus hardware SK6812
|
||||
#define NEO_HW_LC8812 2 // NeoPixelBus hardware LC8812
|
||||
#define NEO_HW_APA106 3 // NeoPixelBus hardware APA106
|
||||
|
||||
#define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library
|
||||
#define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete
|
||||
|
|
|
@ -40,18 +40,32 @@
|
|||
#endif // USE_WS2812_CTYPE
|
||||
|
||||
#ifdef USE_WS2812_DMA
|
||||
typedef Neo800KbpsMethod selectedNeoSpeedType;
|
||||
|
||||
// See NeoEspDmaMethod.h for available options
|
||||
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
|
||||
typedef NeoEsp8266DmaWs2812xMethod selectedNeoSpeedType;
|
||||
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
|
||||
typedef NeoEsp8266DmaSk6812Method selectedNeoSpeedType;
|
||||
#elif (USE_WS2812_HARDWARE == NEO_HW_APA106)
|
||||
typedef NeoEsp8266DmaApa106Method selectedNeoSpeedType;
|
||||
#else // USE_WS2812_HARDWARE
|
||||
typedef NeoEsp8266Dma800KbpsMethod selectedNeoSpeedType;
|
||||
#endif // USE_WS2812_HARDWARE
|
||||
|
||||
#else // USE_WS2812_DMA
|
||||
|
||||
// See NeoEspBitBangMethod.h for available options
|
||||
#if (USE_WS2812_BTYPE == NEO_BB_WS2812X)
|
||||
#if (USE_WS2812_HARDWARE == NEO_HW_WS2812X)
|
||||
typedef NeoEsp8266BitBangWs2812xMethod selectedNeoSpeedType;
|
||||
#elif (USE_WS2812_BTYPE == NEO_BB_SK6812)
|
||||
#elif (USE_WS2812_HARDWARE == NEO_HW_SK6812)
|
||||
typedef NeoEsp8266BitBangSk6812Method selectedNeoSpeedType;
|
||||
#else // USE_WS2812_BTYPE
|
||||
#else // USE_WS2812_HARDWARE
|
||||
typedef NeoEsp8266BitBang800KbpsMethod selectedNeoSpeedType;
|
||||
#endif // USE_WS2812_BTYPE
|
||||
#endif // USE_WS2812_HARDWARE
|
||||
|
||||
#endif // USE_WS2812_DMA
|
||||
NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType> *strip = nullptr;
|
||||
|
||||
NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType> *strip = nullptr;
|
||||
|
||||
struct WsColor {
|
||||
uint8_t red, green, blue;
|
||||
|
@ -305,11 +319,8 @@ void Ws2812Bars(uint32_t schemenr)
|
|||
|
||||
void Ws2812Init(void)
|
||||
{
|
||||
#ifdef USE_WS2812_DMA
|
||||
strip = new NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType>(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use.
|
||||
#else // USE_WS2812_DMA
|
||||
// For DMA, the Pin is ignored as it uses GPIO3 due to DMA hardware use.
|
||||
strip = new NeoPixelBus<selectedNeoFeatureType, selectedNeoSpeedType>(WS2812_MAX_LEDS, pin[GPIO_WS2812]);
|
||||
#endif // USE_WS2812_DMA
|
||||
strip->Begin();
|
||||
Ws2812Clear();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue