diff options
| author | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2021-08-19 19:02:14 +0100 |
|---|---|---|
| committer | mrfaptastic <12006953+mrfaptastic@users.noreply.github.com> | 2021-08-19 19:02:14 +0100 |
| commit | b6cbfce5dd3c99969eee8d506a6f9ecabbd81910 (patch) | |
| tree | 35c62f93325f86b1b019e7d7818bcc3a470084cb | |
| parent | c5227fd15eb6138ed6dce9a3504110eed04cb938 (diff) | |
| parent | 7a20e501d2ba3bb2d6f54d1f7998b7c5ed69584d (diff) | |
Merge branch 'master' of https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA
| -rw-r--r-- | ESP32-HUB75-MatrixPanel-I2S-DMA.h | 34 | ||||
| -rw-r--r-- | ESP32-VirtualMatrixPanel-I2S-DMA.h | 4 |
2 files changed, 17 insertions, 21 deletions
diff --git a/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/ESP32-HUB75-MatrixPanel-I2S-DMA.h index f8648a1..927d428 100644 --- a/ESP32-HUB75-MatrixPanel-I2S-DMA.h +++ b/ESP32-HUB75-MatrixPanel-I2S-DMA.h @@ -388,7 +388,7 @@ class MatrixPanel_I2S_DMA { // Setup the ESP32 DMA Engine. Sprite_TM built this stuff. configureDMA(m_cfg); //DMA and I2S configuration and setup - showDMABuffer(); // show backbuf_id of 0 + flipDMABuffer(); // show backbuf_id of 0 #if SERIAL_DEBUG if (!initialized) @@ -495,33 +495,27 @@ class MatrixPanel_I2S_DMA { inline void flipDMABuffer() { if ( !m_cfg.double_buff) return; - + + #if SERIAL_DEBUG + Serial.printf_P(PSTR("Showtime for buffer: %d\n"), back_buffer_id); + #endif + + i2s_parallel_flip_to_buffer(I2S_NUM_0, back_buffer_id); + // Flip to other buffer as the backbuffer. i.e. Graphic changes happen to this buffer (but aren't displayed until showDMABuffer()) back_buffer_id ^= 1; - #if SERIAL_DEBUG + #if SERIAL_DEBUG Serial.printf_P(PSTR("Set back buffer to: %d\n"), back_buffer_id); - #endif - - // Wait before we allow any writing to the buffer. Stop flicker. - while(!i2s_parallel_is_previous_buffer_free()) { delay(1); } + #endif } - inline void showDMABuffer() - { - - if (!m_cfg.double_buff) return; + // stub function for compatibility + void showDMABuffer(){} - #if SERIAL_DEBUG - Serial.printf_P(PSTR("Showtime for buffer: %d\n"), back_buffer_id); - #endif - - i2s_parallel_flip_to_buffer(I2S_NUM_0, back_buffer_id); + // check if backbuffer still has DMA transfer in progress or is it safe to write there + bool backbuffready(){ return i2s_parallel_is_previous_buffer_free(); } - // Wait before we allow any writing to the buffer. Stop flicker. - while(!i2s_parallel_is_previous_buffer_free()) { delay(1); } - } - inline void setPanelBrightness(int b) { // Change to set the brightness of the display, range of 1 to matrixWidth (i.e. 1 - 64) diff --git a/ESP32-VirtualMatrixPanel-I2S-DMA.h b/ESP32-VirtualMatrixPanel-I2S-DMA.h index c7b6a13..5ae1dac 100644 --- a/ESP32-VirtualMatrixPanel-I2S-DMA.h +++ b/ESP32-VirtualMatrixPanel-I2S-DMA.h @@ -98,7 +98,9 @@ class VirtualMatrixPanel } void flipDMABuffer() { display->flipDMABuffer(); } - void showDMABuffer() { display->showDMABuffer(); } + void showDMABuffer() {} + bool backbuffready(){ return display->backbuffready(); } + void drawDisplayTest(); |
