From b7066ea04dfbb226169284a081575f6692d54f5f Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 8 Sep 2022 21:36:11 +0200 Subject: [PATCH] Fixed i2s implementation --- CMakeLists.txt | 1 + platforms/esp/32/clockless_i2s_esp32.h | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ac4a9a..761c304 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,4 +28,5 @@ idf_component_register( . REQUIRES arduino-esp32 + esp_rom ) diff --git a/platforms/esp/32/clockless_i2s_esp32.h b/platforms/esp/32/clockless_i2s_esp32.h index 08d25a0..6ba9fdc 100644 --- a/platforms/esp/32/clockless_i2s_esp32.h +++ b/platforms/esp/32/clockless_i2s_esp32.h @@ -89,11 +89,9 @@ // This is way too noisy. Is output a LARGE NUMBER of times. // #pragma message "NOTE: ESP32 support using I2S parallel driver. All strips must use the same chipset" -FASTLED_NAMESPACE_BEGIN - -#ifdef __cplusplus -extern "C" { -#endif +//#ifdef __cplusplus +//extern "C" { +//#endif #include "esp_heap_caps.h" #include "esp_intr_alloc.h" @@ -107,15 +105,23 @@ extern "C" { #include "soc/io_mux_reg.h" #include "driver/gpio.h" #include "driver/periph_ctrl.h" +#include "driver/i2s.h" #include "esp32/rom/lldesc.h" +#include "esp32/rom/gpio.h" #include "esp_log.h" +#include "freertos/FreeRTOS.h" + #include "clockless_esp32.h" + +#include "math.h" -#ifdef __cplusplus -} -#endif +//#ifdef __cplusplus +//} +//#endif + +FASTLED_NAMESPACE_BEGIN #define FASTLED_HAS_CLOCKLESS 1 #define NUM_COLOR_CHANNELS 3 @@ -144,7 +150,7 @@ static int gNumStarted = 0; // -- Global semaphore for the whole show process // Semaphore is not given until all data has been sent -static xSemaphoreHandle gTX_sem = NULL; +static SemaphoreHandle_t gTX_sem = NULL; // -- One-time I2S initialization static bool gInitialized = false;