diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2023-03-21 23:50:05 +0000 |
|---|---|---|
| committer | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2023-03-21 23:50:05 +0000 |
| commit | bd7cc1e217482e329ffa17b0676218d4c00aabf9 (patch) | |
| tree | 957100ec9d81183581b288bf9bb473eed010f6c5 /src | |
| parent | 93b36adf7219cb19b216863895d95a06b680708f (diff) | |
Fix S2 compiling
Diffstat (limited to 'src')
| -rw-r--r-- | src/ESP32-HUB75-MatrixPanel-I2S-DMA.h | 2 | ||||
| -rw-r--r-- | src/platforms/esp32/esp32_i2s_parallel_dma.cpp | 46 | ||||
| -rw-r--r-- | src/platforms/esp32/esp32_i2s_parallel_dma.hpp | 10 |
3 files changed, 31 insertions, 27 deletions
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h index e132b53..7332db6 100644 --- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -844,7 +844,7 @@ private: frameStruct frame_buffer[2]; frameStruct *fb; // What framebuffer we are writing pixel changes to? (pointer to either frame_buffer[0] or frame_buffer[1] basically ) used within updateMatrixDMABuffer(...) - int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too? + volatile int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too? int brightness = 128; // If you get ghosting... reduce brightness level. ((60/64)*255) seems to be the limit before ghosting on a 64 pixel wide physical panel for some panels. int lsbMsbTransitionBit = 0; // For colour depth calculations diff --git a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp index d6a0be1..5511d6f 100644 --- a/src/platforms/esp32/esp32_i2s_parallel_dma.cpp +++ b/src/platforms/esp32/esp32_i2s_parallel_dma.cpp @@ -36,19 +36,23 @@ Modified heavily for the ESP32 HUB75 DMA library by: #include <soc/rtc.h> -volatile bool previousBufferFree = true; + volatile bool previousBufferFree = true; -// Todo: handle IS20? (this is hard coded for I2S1 only) -static void IRAM_ATTR i2s_isr(void* arg) { - REG_WRITE(I2S_INT_CLR_REG(1), (REG_READ(I2S_INT_RAW_REG(1)) & 0xffffffc0) | 0x3f); + static void IRAM_ATTR i2s_isr(void* arg) { - // at this point, the previously active buffer is free, go ahead and write to it - previousBufferFree = true; -} + // From original Sprite_TM Code + //REG_WRITE(I2S_INT_CLR_REG(1), (REG_READ(I2S_INT_RAW_REG(1)) & 0xffffffc0) | 0x3f); + + // Clear flag so we can get retriggered + SET_PERI_REG_BITS(I2S_INT_CLR_REG(ESP32_I2S_DEVICE), I2S_OUT_EOF_INT_CLR_V, 1, I2S_OUT_EOF_INT_CLR_S); + + // at this point, the previously active buffer is free, go ahead and write to it + previousBufferFree = true; + } -bool DRAM_ATTR i2s_parallel_is_previous_buffer_free() { - return previousBufferFree; -} + bool DRAM_ATTR i2s_parallel_is_previous_buffer_free() { + return previousBufferFree; + } // Static @@ -369,27 +373,23 @@ bool DRAM_ATTR i2s_parallel_is_previous_buffer_free() { dev->conf1.tx_stop_en = 0; dev->timing.val = 0; - - /* If we have double buffering, then allocate an interrupt service routine function - * that can be used for I2S0/I2S1 created interrupts. - */ - - // setup I2S Interrupt - SET_PERI_REG_BITS(I2S_INT_ENA_REG(1), I2S_OUT_EOF_INT_ENA_V, 1, I2S_OUT_EOF_INT_ENA_S); - // allocate a level 1 intterupt: lowest priority, as ISR isn't urgent and may take a long time to complete - //esp_intr_alloc(ETS_I2S1_INTR_SOURCE, (int)(ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1), i2s_isr, NULL, NULL); - esp_intr_alloc(irq_source, (int)(ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1), i2s_isr, NULL, NULL); - + // If we have double buffering, then allocate an interrupt service routine function + // that can be used for I2S0/I2S1 created interrupts. - + // Setup I2S Interrupt + SET_PERI_REG_BITS(I2S_INT_ENA_REG(ESP32_I2S_DEVICE), I2S_OUT_EOF_INT_ENA_V, 1, I2S_OUT_EOF_INT_ENA_S); + + // Allocate a level 1 intterupt: lowest priority, as ISR isn't urgent and may take a long time to complete + esp_intr_alloc(irq_source, (int)(ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL1), i2s_isr, NULL, NULL); + + #if defined (CONFIG_IDF_TARGET_ESP32S2) ESP_LOGD("ESP32-S2", "init() GPIO and clock configuration set for ESP32-S2"); #else ESP_LOGD("ESP32-ORIG", "init() GPIO and clock configuration set for ESP32"); #endif - return true; } diff --git a/src/platforms/esp32/esp32_i2s_parallel_dma.hpp b/src/platforms/esp32/esp32_i2s_parallel_dma.hpp index 1d253c6..b0d3642 100644 --- a/src/platforms/esp32/esp32_i2s_parallel_dma.hpp +++ b/src/platforms/esp32/esp32_i2s_parallel_dma.hpp @@ -49,12 +49,16 @@ Contributors: #define DMA_MAX (4096-4) -// DO NOT CHANGE -#define ESP32_I2S_DEVICE I2S_NUM_1 - // The type used for this SoC #define HUB75_DMA_DESCRIPTOR_T lldesc_t + +#if defined (CONFIG_IDF_TARGET_ESP32S2) +#define ESP32_I2S_DEVICE I2S_NUM_0 +#else +#define ESP32_I2S_DEVICE I2S_NUM_1 +#endif + //---------------------------------------------------------------------------- void IRAM_ATTR irq_hndlr(void* arg); |
