Commit df23e146 authored by Bodmer's avatar Bodmer

Make DMA wait handling consistent for ESP32 and STM32

parent bf5bf185
...@@ -538,13 +538,14 @@ void TFT_eSPI::dmaWait(void) ...@@ -538,13 +538,14 @@ void TFT_eSPI::dmaWait(void)
/*************************************************************************************** /***************************************************************************************
** Function name: pushImageDMA ** Function name: pushPixelsDMA
** Description: Push pixels to TFT (len must be less than 32767) ** Description: Push pixels to TFT (len must be less than 32767)
***************************************************************************************/ ***************************************************************************************/
// This will byte swap the original image if setSwapBytes(true) was called by sketch. // This will byte swap the original image if setSwapBytes(true) was called by sketch.
void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len) void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
{ {
if ((len == 0) || (!DMA_Enabled)) return; if ((len == 0) || (!DMA_Enabled)) return;
dmaWait(); dmaWait();
if(_swapBytes) { if(_swapBytes) {
...@@ -592,7 +593,10 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t ...@@ -592,7 +593,10 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
uint32_t len = dw*dh; uint32_t len = dw*dh;
if (buffer == nullptr) { buffer = image; dmaWait(); } if (buffer == nullptr) {
buffer = image;
dmaWait();
}
// If image is clipped, copy pixels into a contiguous block // If image is clipped, copy pixels into a contiguous block
if ( (dw != w) || (dh != h) ) { if ( (dw != w) || (dh != h) ) {
......
...@@ -421,7 +421,7 @@ void TFT_eSPI::dmaWait(void) ...@@ -421,7 +421,7 @@ void TFT_eSPI::dmaWait(void)
/*************************************************************************************** /***************************************************************************************
** Function name: pushImageDMA ** Function name: pushPixelsDMA
** Description: Push pixels to TFT (len must be less than 32767) ** Description: Push pixels to TFT (len must be less than 32767)
***************************************************************************************/ ***************************************************************************************/
// This will byte swap the original image if setSwapBytes(true) was called by sketch. // This will byte swap the original image if setSwapBytes(true) was called by sketch.
...@@ -462,11 +462,12 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t ...@@ -462,11 +462,12 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
if (dw < 1 || dh < 1) return; if (dw < 1 || dh < 1) return;
if (buffer == nullptr) buffer = image;
uint32_t len = dw*dh; uint32_t len = dw*dh;
while (spiHal.State == HAL_SPI_STATE_BUSY_TX); // Check if SPI Tx is busy if (buffer == nullptr) {
buffer = image;
while (spiHal.State == HAL_SPI_STATE_BUSY_TX); // Check if SPI Tx is busy
}
// If image is clipped, copy pixels into a contiguous block // If image is clipped, copy pixels into a contiguous block
if ( (dw != w) || (dh != h) ) { if ( (dw != w) || (dh != h) ) {
......
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