From 42bd890d90c14d1fc898508cc00ba22687237aa2 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 9 Oct 2024 20:08:18 -0700 Subject: [PATCH] c6 & h2 --- src/internal/NeoMethods.h | 16 ++++++-- .../methods/ESP/ESP32/Core_2_x/Esp32_i2s.c | 2 +- .../ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h | 5 ++- .../ESP/ESP32/DotStarEsp32DmaSpiMethod.h | 17 ++++---- .../methods/ESP/ESP32/NeoEsp32LcdXMethod.h | 2 +- .../methods/ESP/ESP32/NeoEsp32RmtSpeed.h | 2 +- ...oEsp32RmtMethod.h => NeoEsp32RmtXMethod.h} | 6 +-- .../methods/ESP/ESP32/NeoEsp32SpiMethod.h | 7 +--- .../ESP/ESP8266/NeoEsp8266I2sMethodCore.cpp | 2 +- .../methods/ESP/NeoEspBitBangMethod.cpp | 2 +- .../methods/ESP/NeoEspBitBangMethod.h | 39 ------------------- 11 files changed, 33 insertions(+), 67 deletions(-) rename src/internal/methods/ESP/ESP32/{NeoEsp32RmtMethod.h => NeoEsp32RmtXMethod.h} (98%) diff --git a/src/internal/NeoMethods.h b/src/internal/NeoMethods.h index 9c8aba3..8922a61 100644 --- a/src/internal/NeoMethods.h +++ b/src/internal/NeoMethods.h @@ -57,21 +57,29 @@ License along with NeoPixel. If not, see #elif defined(ARDUINO_ARCH_ESP32) +// once we have a core3 i2s, then fix this #if !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) #include "methods/ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h" +#include "methods/ESP/ESP32/Core_2_x/NeoEsp32I2sXMethod.h" +#endif + #if ESP_IDF_VERSION_MAJOR < 5 + #include "methods/ESP/ESP32/Core_2_x/NeoEsp32RmtMethod.h" -#else + +#else // ! ESP_IDF_VERSION_MAJOR < 5 + #if !defined(CONFIG_IDF_TARGET_ESP32C2) #include "methods/ESP/ESP32/NeoEsp32RmtXMethod.h" // every other SOC #else //CONFIG_IDF_TARGET_ESP32C2 #include "methods/ESP/ESP32/NeoEsp32SpiMethod.h" // ESP32C2 #endif //CONFIG_IDF_TARGET_ESP32C2 -#endif // ESP_IDF_VERSION_MAJOR + +#endif // ESP_IDF_VERSION_MAJOR < 5 + #include "methods/ESP/ESP32/DotStarEsp32DmaSpiMethod.h" -#include "methods/ESP/ESP32/Core_2_x/NeoEsp32I2sXMethod.h" #include "methods/ESP/ESP32/NeoEsp32LcdXMethod.h" -#endif + #include "methods/ESP/NeoEspBitBangMethod.h" diff --git a/src/internal/methods/ESP/ESP32/Core_2_x/Esp32_i2s.c b/src/internal/methods/ESP/ESP32/Core_2_x/Esp32_i2s.c index 119cbc7..affe9d9 100644 --- a/src/internal/methods/ESP/ESP32/Core_2_x/Esp32_i2s.c +++ b/src/internal/methods/ESP/ESP32/Core_2_x/Esp32_i2s.c @@ -29,7 +29,7 @@ #include "freertos/task.h" #include "freertos/semphr.h" #include "freertos/queue.h" -#include "FractionClk.h" +#include "../../../FractionClk.h" #if ESP_IDF_VERSION_MAJOR>=4 #include "esp_intr_alloc.h" diff --git a/src/internal/methods/ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h b/src/internal/methods/ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h index f8d7e78..17ee4b0 100644 --- a/src/internal/methods/ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h +++ b/src/internal/methods/ESP/ESP32/Core_2_x/NeoEsp32I2sMethod.h @@ -26,8 +26,9 @@ License along with NeoPixel. If not, see #pragma once -// ESP32 C3 & S3 I2S is not supported yet due to significant changes to interface -#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) +// ESP32 beyond C3 & S3 I2S is not supported yet +// due to significant changes to interface +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C63) && !defined(CONFIG_IDF_TARGET_ESP32H6) extern "C" diff --git a/src/internal/methods/ESP/ESP32/DotStarEsp32DmaSpiMethod.h b/src/internal/methods/ESP/ESP32/DotStarEsp32DmaSpiMethod.h index 5ab5a77..4f69194 100644 --- a/src/internal/methods/ESP/ESP32/DotStarEsp32DmaSpiMethod.h +++ b/src/internal/methods/ESP/ESP32/DotStarEsp32DmaSpiMethod.h @@ -134,8 +134,8 @@ public: // If pins aren't specified, initialize bus with just the default SCK and MOSI pins for the SPI peripheral (no SS, no >1-bit pins) void Initialize() { -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - if (T_SPIBUS::SpiHostDevice == VSPI_HOST) +#if SOC_SPI_PERIPH_NUM > 2 + if (T_SPIBUS::SpiHostDevice == SPI3_HOST) { Initialize(SCK, -1, MOSI, -1, -1, -1); } @@ -304,19 +304,20 @@ typedef DotStarEsp32DmaSpiMethodBase DotStarEsp // SPI3 -#if (defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3)) +#if SOC_SPI_PERIPH_NUM > 2 + typedef Esp32SpiBus Esp32Spi3Bus; +typedef DotStarEsp32DmaSpiMethodBase DotStarEsp32DmaSpi3Method; + +#if !defined(CONFIG_IDF_TARGET_ESP32S2) + typedef Esp32SpiBus Esp32Spi32BitBus; typedef Esp32SpiBus Esp32Spi34BitBus; -typedef DotStarEsp32DmaSpiMethodBase DotStarEsp32DmaSpi3Method; typedef DotStarEsp32DmaSpiMethodBase DotStarEsp32DmaSpi32BitMethod; typedef DotStarEsp32DmaSpiMethodBase DotStarEsp32DmaSpi34BitMethod; -#endif -#if defined(CONFIG_IDF_TARGET_ESP32S2) -typedef Esp32SpiBus Esp32Spi3Bus; -typedef DotStarEsp32DmaSpiMethodBase DotStarEsp32DmaSpi3Method; +#endif #endif // Default SpiDma methods if we don't care about bus. It's nice that every single ESP32 out there diff --git a/src/internal/methods/ESP/ESP32/NeoEsp32LcdXMethod.h b/src/internal/methods/ESP/ESP32/NeoEsp32LcdXMethod.h index 9daf075..7541a7a 100644 --- a/src/internal/methods/ESP/ESP32/NeoEsp32LcdXMethod.h +++ b/src/internal/methods/ESP/ESP32/NeoEsp32LcdXMethod.h @@ -42,7 +42,7 @@ extern "C" #include #include #include -#include "FractionClk.h" +#include "../../FractionClk.h" } // diff --git a/src/internal/methods/ESP/ESP32/NeoEsp32RmtSpeed.h b/src/internal/methods/ESP/ESP32/NeoEsp32RmtSpeed.h index 7a7abe5..6a4d98c 100644 --- a/src/internal/methods/ESP/ESP32/NeoEsp32RmtSpeed.h +++ b/src/internal/methods/ESP/ESP32/NeoEsp32RmtSpeed.h @@ -4,7 +4,7 @@ NeoPixel library helper functions for Esp32. Written by Michael C. Miller. I invest time and resources providing this open source code, -please support me by dontating (see https://github.com/Makuna/NeoPixelBus) +please support me by donating (see https://github.com/Makuna/NeoPixelBus) ------------------------------------------------------------------------- This file is part of the Makuna/NeoPixelBus library. diff --git a/src/internal/methods/ESP/ESP32/NeoEsp32RmtMethod.h b/src/internal/methods/ESP/ESP32/NeoEsp32RmtXMethod.h similarity index 98% rename from src/internal/methods/ESP/ESP32/NeoEsp32RmtMethod.h rename to src/internal/methods/ESP/ESP32/NeoEsp32RmtXMethod.h index e7459d9..5b3e3d0 100644 --- a/src/internal/methods/ESP/ESP32/NeoEsp32RmtMethod.h +++ b/src/internal/methods/ESP/ESP32/NeoEsp32RmtXMethod.h @@ -4,7 +4,7 @@ NeoPixel library helper functions for Esp32. Written by Michael C. Miller. I invest time and resources providing this open source code, -please support me by dontating (see https://github.com/Makuna/NeoPixelBus) +please support me by donating (see https://github.com/Makuna/NeoPixelBus) ------------------------------------------------------------------------- This file is part of the Makuna/NeoPixelBus library. @@ -282,7 +282,7 @@ public: private: const size_t _sizeData; // Size of '_data*' buffers - const uint8_t _pin; // output pin number + const uint8_t _pin; // output pin rmt_channel_handle_t rmt_transmit_config_t _tx_config = {}; rmt_encoder_handle_t _led_encoder = nullptr; @@ -350,7 +350,7 @@ typedef NeoEsp32RmtMethodBase NeoE // Normally I2s method is the default, defining NEOPIXEL_ESP32_RMT_DEFAULT // will switch to use RMT as the default method -// The ESP32S2 & ESP32C3 will always default to RMT +// The ESP32S2, ESP32S3, ESP32C3, ESP32C6 will allways default to RMT typedef NeoEsp32RmtXWs2805Method NeoWs2805Method; typedef NeoEsp32RmtXWs2811Method NeoWs2811Method; diff --git a/src/internal/methods/ESP/ESP32/NeoEsp32SpiMethod.h b/src/internal/methods/ESP/ESP32/NeoEsp32SpiMethod.h index b546ec8..a67c5be 100644 --- a/src/internal/methods/ESP/ESP32/NeoEsp32SpiMethod.h +++ b/src/internal/methods/ESP/ESP32/NeoEsp32SpiMethod.h @@ -6,7 +6,7 @@ Adaption of Espressif's component library code by Christian Baars Written by Michael C. Miller. I invest time and resources providing this open source code, -please support me by dontating (see https://github.com/Makuna/NeoPixelBus) +please support me by donating (see https://github.com/Makuna/NeoPixelBus) ------------------------------------------------------------------------- This file is not yet part of the Makuna/NeoPixelBus library. @@ -30,11 +30,6 @@ License along with NeoPixel. If not, see #if defined(ARDUINO_ARCH_ESP32) -#if (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C6)) && !defined(HSPI_HOST) -// HSPI_HOST depreciated in C3 -#define HSPI_HOST SPI2_HOST -#endif - #include extern void AddLog(uint32_t loglevel, PGM_P formatP, ...); // TODO: Remove all Addlogs diff --git a/src/internal/methods/ESP/ESP8266/NeoEsp8266I2sMethodCore.cpp b/src/internal/methods/ESP/ESP8266/NeoEsp8266I2sMethodCore.cpp index 9f56db6..042e3db 100644 --- a/src/internal/methods/ESP/ESP8266/NeoEsp8266I2sMethodCore.cpp +++ b/src/internal/methods/ESP/ESP8266/NeoEsp8266I2sMethodCore.cpp @@ -25,7 +25,7 @@ License along with NeoPixel. If not, see -------------------------------------------------------------------------*/ #include -#include "../NeoUtil.h" +#include "../../../NeoUtil.h" #include "NeoEsp8266I2sMethodCore.h" #ifdef ARDUINO_ARCH_ESP8266 diff --git a/src/internal/methods/ESP/NeoEspBitBangMethod.cpp b/src/internal/methods/ESP/NeoEspBitBangMethod.cpp index 910d2dc..2fb21ee 100644 --- a/src/internal/methods/ESP/NeoEspBitBangMethod.cpp +++ b/src/internal/methods/ESP/NeoEspBitBangMethod.cpp @@ -120,7 +120,7 @@ bool IRAM_ATTR neoEspBitBangWriteSpacingPixels(const uint8_t* pixels, setRegister = &GPIO.out_w1ts.val; clearRegister = &GPIO.out_w1tc.val; } -#if !defined(CONFIG_IDF_TARGET_ESP32C3) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32H2) else { setRegister = &GPIO.out1_w1ts.val; diff --git a/src/internal/methods/ESP/NeoEspBitBangMethod.h b/src/internal/methods/ESP/NeoEspBitBangMethod.h index 6a70e65..952d8e0 100644 --- a/src/internal/methods/ESP/NeoEspBitBangMethod.h +++ b/src/internal/methods/ESP/NeoEspBitBangMethod.h @@ -360,45 +360,6 @@ typedef NeoEsp32BitBangWs2805InvertedMethod NeoEsp32BitBangWs2814InvertedNoIntrM typedef NeoEsp32BitBangTm1814InvertedMethod NeoEsp32BitBangTm1914InvertedNoIntrMethod; typedef NeoEsp32BitBangSk6812InvertedMethod NeoEsp32BitBangLc8812InvertedNoIntrMethod; -#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) -// -// Esp32 C6 && H2 currently use BitBang as the default until other support -// is created, as they are not compatible with older generation chips -typedef NeoEsp32BitBangWs2812xMethod NeoWs2813Method; -typedef NeoEsp32BitBangWs2812xMethod NeoWs2812xMethod; -typedef NeoEsp32BitBang800KbpsMethod NeoWs2812Method; -typedef NeoEsp32BitBangWs2812xMethod NeoWs2811Method; -typedef NeoEsp32BitBangWs2812xMethod NeoWs2816Method; -typedef NeoEsp32BitBangWs2805Method NeoWs2805Method; -typedef NeoEsp32BitBangWs2814Method NeoWs2814Method; -typedef NeoEsp32BitBangSk6812Method NeoSk6812Method; -typedef NeoEsp32BitBangTm1814Method NeoTm1814Method; -typedef NeoEsp32BitBangTm1829Method NeoTm1829Method; -typedef NeoEsp32BitBangTm1914Method NeoTm1914Method; -typedef NeoEsp32BitBangSk6812Method NeoLc8812Method; -typedef NeoEsp32BitBangApa106Method NeoApa106Method; - -typedef NeoEsp32BitBangWs2812xMethod Neo800KbpsMethod; -typedef NeoEsp32BitBang400KbpsMethod Neo400KbpsMethod; - -typedef NeoEsp32BitBangWs2812xInvertedMethod NeoWs2813InvertedMethod; -typedef NeoEsp32BitBangWs2812xInvertedMethod NeoWs2812xInvertedMethod; -typedef NeoEsp32BitBangWs2812xInvertedMethod NeoWs2811InvertedMethod; -typedef NeoEsp32BitBangWs2812xInvertedMethod NeoWs2816InvertedMethod; -typedef NeoEsp32BitBangWs2805InvertedMethod NeoWs2805InvertedMethod; -typedef NeoEsp32BitBangWs2814InvertedMethod NeoWs2814InvertedMethod; -typedef NeoEsp32BitBang800KbpsInvertedMethod NeoWs2812InvertedMethod; -typedef NeoEsp32BitBangSk6812InvertedMethod NeoSk6812InvertedMethod; -typedef NeoEsp32BitBangTm1814InvertedMethod NeoTm1814InvertedMethod; -typedef NeoEsp32BitBangTm1829InvertedMethod NeoTm1829InvertedMethod; -typedef NeoEsp32BitBangTm1914InvertedMethod NeoTm1914InvertedMethod; -typedef NeoEsp32BitBangSk6812InvertedMethod NeoLc8812InvertedMethod; -typedef NeoEsp32BitBangApa106InvertedMethod NeoApa106InvertedMethod; - -typedef NeoEsp32BitBangWs2812xInvertedMethod Neo800KbpsInvertedMethod; -typedef NeoEsp32BitBang400KbpsInvertedMethod Neo400KbpsInvertedMethod; -#endif - #else // defined(ARDUINO_ARCH_ESP8266) typedef NeoEspBitBangMethodBase NeoEsp8266BitBangWs2811Method;