From bf5bf1852ed1637d78e0433a78a45a77840a596f Mon Sep 17 00:00:00 2001 From: Bodmer Date: Thu, 19 Nov 2020 00:15:21 +0000 Subject: [PATCH] Add dmaWait() for STM32 --- Processors/TFT_eSPI_STM32.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Processors/TFT_eSPI_STM32.c b/Processors/TFT_eSPI_STM32.c index 0cc1ab6..aa77e77 100644 --- a/Processors/TFT_eSPI_STM32.c +++ b/Processors/TFT_eSPI_STM32.c @@ -401,8 +401,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len) ** Function name: dmaBusy ** Description: Check if DMA is busy (usefully non-blocking!) ***************************************************************************************/ -// Use "while(tft.dmaBusy());" in sketch for a blocking wait for DMA to complete -// or "while( tft.dmaBusy() ) {Do-something-useful;}" +// Use while( tft.dmaBusy() ) {Do-something-useful;}" bool TFT_eSPI::dmaBusy(void) { //return (dmaHal.State == HAL_DMA_STATE_BUSY); // Do not use, SPI may still be busy @@ -410,6 +409,17 @@ bool TFT_eSPI::dmaBusy(void) } +/*************************************************************************************** +** Function name: dmaWait +** Description: Wait until DMA is over (blocking!) +***************************************************************************************/ +void TFT_eSPI::dmaWait(void) +{ + //return (dmaHal.State == HAL_DMA_STATE_BUSY); // Do not use, SPI may still be busy + while (spiHal.State == HAL_SPI_STATE_BUSY_TX); // Check if SPI Tx is busy +} + + /*************************************************************************************** ** Function name: pushImageDMA ** Description: Push pixels to TFT (len must be less than 32767)