Skip to content

Commit

Permalink
ESP32: Fixed SemaphoreGive when using builtin driver
Browse files Browse the repository at this point in the history
  • Loading branch information
drzony committed Apr 25, 2020
1 parent 4e5f325 commit 9d1df11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions platforms/esp/32/clockless_i2s_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ class ClocklessController : public CPixelLEDController<RGB_ORDER>

// -- Allocate i2s interrupt
SET_PERI_REG_BITS(I2S_INT_ENA_REG(I2S_DEVICE), I2S_OUT_EOF_INT_ENA_V, 1, I2S_OUT_EOF_INT_ENA_S);
esp_err_t e = esp_intr_alloc(interruptSource, 0, // ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_LEVEL3,
&interruptHandler, 0, &gI2S_intr_handle);
esp_intr_alloc(interruptSource, 0, // ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_LEVEL3,
&interruptHandler, 0, &gI2S_intr_handle);

// -- Create a semaphore to block execution until all the controllers are done
if (gTX_sem == NULL) {
Expand Down
8 changes: 6 additions & 2 deletions platforms/esp/32/clockless_rmt_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,12 @@ class ClocklessController : public CPixelLEDController<RGB_ORDER>

if (gNumDone == gNumControllers) {
// -- If this is the last controller, signal that we are all done
xSemaphoreGiveFromISR(gTX_sem, &HPTaskAwoken);
if(HPTaskAwoken == pdTRUE) portYIELD_FROM_ISR();
if (FASTLED_RMT_BUILTIN_DRIVER) {
xSemaphoreGive(gTX_sem);
} else {
xSemaphoreGiveFromISR(gTX_sem, &HPTaskAwoken);
if (HPTaskAwoken == pdTRUE) portYIELD_FROM_ISR();
}
} else {
// -- Otherwise, if there are still controllers waiting, then
// start the next one on this channel
Expand Down

0 comments on commit 9d1df11

Please sign in to comment.