diff --git a/src/wsLED.cpp b/src/wsLED.cpp index 8aae605..339cf24 100644 --- a/src/wsLED.cpp +++ b/src/wsLED.cpp @@ -103,7 +103,7 @@ void wsLED::begin(void) ESP_ERROR_CHECK(rmt_config(&config)); ESP_ERROR_CHECK(rmt_driver_install(config.channel, 0, 0)); - _semaphore = xSemaphoreCreateBinary(); + _mutex = xSemaphoreCreateMutex(); #endif _color[0] = _color[1] = _color[2] = 0; show(); @@ -123,7 +123,7 @@ void ICACHE_RAM_ATTR wsLED::rtLed(void) uint32_t timing; #if defined(ESP32) - xSemaphoreTakeFromISR(_semaphore, pdFALSE); + xSemaphoreTake(_mutex, portMAX_DELAY); #endif _handler.detach(); switch (_ledState) { @@ -173,7 +173,7 @@ void ICACHE_RAM_ATTR wsLED::rtLed(void) show(); _handler.attach_ms(timing, ledTrampoline, this); #if defined(ESP32) - xSemaphoreGiveFromISR(_semaphore, pdFALSE); + xSemaphoreGive(_mutex); #endif } @@ -227,7 +227,7 @@ void wsLED::pulse(LEDRGB color, uint32_t duration) if (NOT_A_PIN != _pin) { #if defined(ESP32) - xSemaphoreTake(_semaphore, portMAX_DELAY); + xSemaphoreTake(_mutex, portMAX_DELAY); #endif _handler.detach(); _scale = 0xff; @@ -239,7 +239,7 @@ void wsLED::pulse(LEDRGB color, uint32_t duration) _ledState = LED_PULSE_START; _handler.attach_ms(5, ledTrampoline, this); #if defined(ESP32) - xSemaphoreGive(_semaphore); + xSemaphoreGive(_mutex); #endif } } diff --git a/src/wsLED.h b/src/wsLED.h index 258e32e..9275aa0 100644 --- a/src/wsLED.h +++ b/src/wsLED.h @@ -146,7 +146,7 @@ protected: #if defined(ARDUINO_ARCH_ESP32) int _rmtChannel; rmt_item32_t led_data_buffer[LED_BUFFER_ITEMS]; - SemaphoreHandle_t _semaphore; + SemaphoreHandle_t _mutex; #endif void show(void);