[ESP-IDF5.1] Tweak NeoPixel support on ESP32-C3

This commit is contained in:
TD-er
2023-11-05 19:49:20 +01:00
parent d37a51a7d1
commit 4ece6168ac
4 changed files with 25 additions and 14 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ public:
{
}
~NeoPixelBus()
virtual ~NeoPixelBus()
{
}
@@ -395,7 +395,7 @@ public:
construct();
}
~NeoEsp32RmtMethodBase()
virtual ~NeoEsp32RmtMethodBase()
{
// wait until the last send finishes before destructing everything
// arbitrary time out of 10 seconds
@@ -421,6 +421,8 @@ public:
#ifndef NEOESP32_RMT_FLAGS_WITH_DMA
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#define NEOESP32_RMT_FLAGS_WITH_DMA true
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#define NEOESP32_RMT_FLAGS_WITH_DMA false
#else
#define NEOESP32_RMT_FLAGS_WITH_DMA false
#endif
@@ -430,15 +432,18 @@ public:
#ifndef NEOESP32_RMT_MEM_BLOCK_SYMBOLS
#if defined(CONFIG_IDF_TARGET_ESP32S3)
#ifdef NEOESP32_RMT_FLAGS_WITH_DMA
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 1536
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 1536 // 16 RGB pixels or 12 RGBW pixels
#else
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 96
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 96 // Use 2x platform default
#endif
#elif defined(CONFIG_IDF_TARGET_ESP32)
// Uses DMA, but should not set config.flags.with_dma = true;
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 384
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 128 // Use 2x platform default (Only ESP32 and ESP32-S2 have 64)
// We use RMT channel 1, so we only can use upto 3x he default mem_block_symbols of 64
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 192 // Use 3x platform default (Only ESP32 and ESP32-S2 have 64)
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 192
#else
#define NEOESP32_RMT_MEM_BLOCK_SYMBOLS 96 // Use 2x platform default
#endif
@@ -6,15 +6,6 @@ NeoPixelBus_wrapper::NeoPixelBus_wrapper(uint16_t _maxPixels,
int16_t _gpioPin,
neoPixelType _stripType)
: numLEDs(_maxPixels) {
if (NEO_GRB == (_stripType & NEO_GRB)) {
#ifdef ESP8266
neopixels_grb = new (std::nothrow) NEOPIXEL_LIB<NeoGrbFeature, METHOD>(_maxPixels);
#endif // ifdef ESP8266
#ifdef ESP32
neopixels_grb = new (std::nothrow) NEOPIXEL_LIB<NeoGrbFeature, METHOD>(_maxPixels, _gpioPin);
#endif // ifdef ESP32
}
if (NEO_GRBW == (_stripType & NEO_GRBW)) {
#ifdef ESP8266
neopixels_grbw = new (std::nothrow) NEOPIXEL_LIB<NeoGrbwFeature, METHOD>(_maxPixels);
@@ -22,6 +13,13 @@ NeoPixelBus_wrapper::NeoPixelBus_wrapper(uint16_t _maxPixels,
#ifdef ESP32
neopixels_grbw = new (std::nothrow) NEOPIXEL_LIB<NeoGrbwFeature, METHOD>(_maxPixels, _gpioPin);
#endif // ifdef ESP32
} else if (NEO_GRB == (_stripType & NEO_GRB)) {
#ifdef ESP8266
neopixels_grb = new (std::nothrow) NEOPIXEL_LIB<NeoGrbFeature, METHOD>(_maxPixels);
#endif // ifdef ESP8266
#ifdef ESP32
neopixels_grb = new (std::nothrow) NEOPIXEL_LIB<NeoGrbFeature, METHOD>(_maxPixels, _gpioPin);
#endif // ifdef ESP32
}
}
+8
View File
@@ -134,3 +134,11 @@ build_flags = ${esp32c3_common.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DFEATURE_SD=1
-DPLUGIN_NEOPIXEL_COLLECTION
[env:neopixel_ESP32c3_4M316k_LittleFS_CDC]
extends = esp32c3_common_LittleFS
board = esp32c3cdc
build_flags = ${esp32c3_common_LittleFS.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DFEATURE_SD=1
-DPLUGIN_NEOPIXEL_COLLECTION