Double buffer function reduction

Can't get rid of the wait while statement though...
This commit is contained in:
mrfaptastic 2021-08-19 19:34:40 +01:00
parent d9e2f85f98
commit 055ff08fe5

View file

@ -388,7 +388,7 @@ class MatrixPanel_I2S_DMA {
// Setup the ESP32 DMA Engine. Sprite_TM built this stuff. // Setup the ESP32 DMA Engine. Sprite_TM built this stuff.
configureDMA(m_cfg); //DMA and I2S configuration and setup configureDMA(m_cfg); //DMA and I2S configuration and setup
showDMABuffer(); // show backbuf_id of 0 //showDMABuffer(); // show backbuf_id of 0
#if SERIAL_DEBUG #if SERIAL_DEBUG
if (!initialized) if (!initialized)
@ -492,7 +492,7 @@ class MatrixPanel_I2S_DMA {
static void color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b); static void color565to888(const uint16_t color, uint8_t &r, uint8_t &g, uint8_t &b);
inline void flipDMABuffer() inline void IRAM_ATTR flipDMABuffer()
{ {
if ( !m_cfg.double_buff) return; if ( !m_cfg.double_buff) return;
@ -503,25 +503,12 @@ class MatrixPanel_I2S_DMA {
Serial.printf_P(PSTR("Set back buffer to: %d\n"), back_buffer_id); Serial.printf_P(PSTR("Set back buffer to: %d\n"), back_buffer_id);
#endif #endif
// Wait before we allow any writing to the buffer. Stop flicker.
while(!i2s_parallel_is_previous_buffer_free()) { delay(1); }
}
inline void showDMABuffer()
{
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); i2s_parallel_flip_to_buffer(I2S_NUM_0, back_buffer_id);
// Wait before we allow any writing to the buffer. Stop flicker. // Wait before we allow any writing to the buffer. Stop flicker.
while(!i2s_parallel_is_previous_buffer_free()) { delay(1); } while(i2s_parallel_is_previous_buffer_free() == false) { }
} }
inline void setPanelBrightness(int b) inline void setPanelBrightness(int b)
{ {
// Change to set the brightness of the display, range of 1 to matrixWidth (i.e. 1 - 64) // Change to set the brightness of the display, range of 1 to matrixWidth (i.e. 1 - 64)