Commit bf5bf185 authored by Bodmer's avatar Bodmer

Add dmaWait() for STM32

parent 78804815
...@@ -401,8 +401,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len) ...@@ -401,8 +401,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
** Function name: dmaBusy ** Function name: dmaBusy
** Description: Check if DMA is busy (usefully non-blocking!) ** Description: Check if DMA is busy (usefully non-blocking!)
***************************************************************************************/ ***************************************************************************************/
// Use "while(tft.dmaBusy());" in sketch for a blocking wait for DMA to complete // Use while( tft.dmaBusy() ) {Do-something-useful;}"
// or "while( tft.dmaBusy() ) {Do-something-useful;}"
bool TFT_eSPI::dmaBusy(void) bool TFT_eSPI::dmaBusy(void)
{ {
//return (dmaHal.State == HAL_DMA_STATE_BUSY); // Do not use, SPI may still be busy //return (dmaHal.State == HAL_DMA_STATE_BUSY); // Do not use, SPI may still be busy
...@@ -410,6 +409,17 @@ bool TFT_eSPI::dmaBusy(void) ...@@ -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 ** Function name: pushImageDMA
** Description: Push pixels to TFT (len must be less than 32767) ** Description: Push pixels to TFT (len must be less than 32767)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment