Issue #510 part STM32F103 workaround

This commit is contained in:
Bodmer
2020-05-01 20:57:03 +01:00
parent cf979d40b7
commit 1f2d4b0a75
4 changed files with 20 additions and 10 deletions

View File

@@ -142,7 +142,7 @@ uint8_t TFT_eSPI::readByte(void)
}
////////////////////////////////////////////////////////////////////////////////////////
#elif defined (RPI_WRITE_STROBE) // For RPi TFT with write strobe ############# UNTESTED ###################
#elif defined (RPI_WRITE_STROBE) // For RPi TFT with write strobe
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@@ -168,7 +168,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
}
////////////////////////////////////////////////////////////////////////////////////////
#elif defined (ILI9488_DRIVER) // For 24 bit SPI colour TFT ############# UNTESTED ###################
#elif defined (ILI9488_DRIVER) // For 24 bit SPI colour TFT
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@@ -212,7 +212,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
}
////////////////////////////////////////////////////////////////////////////////////////
#else // Standard SPI 16 bit colour TFT All Tested
#else // Standard SPI 16 bit colour TFT
////////////////////////////////////////////////////////////////////////////////////////
/***************************************************************************************
@@ -242,7 +242,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
////////////////////////////////////////////////////////////////////////////////////////
// DMA FUNCTIONS All tested on STM32F767
// DMA FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////
// Placeholder for DMA functions

View File

@@ -440,15 +440,15 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
// If image is clipped, copy pixels into a contiguous block
if ( (dw != w) || (dh != h) ) {
if(_swapBytes) {
for (uint32_t yb = 0; yb < dh; yb++) {
for (uint32_t xb = 0; xb < dw; xb++) {
for (int32_t yb = 0; yb < dh; yb++) {
for (int32_t xb = 0; xb < dw; xb++) {
uint32_t src = xb + dx + w * (yb + dy);
(buffer[xb + yb * dw] = image[src] << 8 | image[src] >> 8);
}
}
}
else {
for (uint32_t yb = 0; yb < dh; yb++) {
for (int32_t yb = 0; yb < dh; yb++) {
memcpy((uint8_t*) (buffer + yb * dw), (uint8_t*) (image + dx + w * (yb + dy)), dw << 1);
}
}

View File

@@ -187,6 +187,7 @@
#if !defined (TFT_DC) || (TFT_DC < 0)
#define DC_C // No macro allocated so it generates no code
#define DC_D // No macro allocated so it generates no code
#undef TFT_DC
#else
// Convert Arduino pin reference Dn or STM pin reference PXn to port and mask
#define DC_PORT digitalPinToPort(TFT_DC)
@@ -202,6 +203,7 @@
#if !defined (TFT_CS) || (TFT_CS < 0)
#define CS_L // No macro allocated so it generates no code
#define CS_H // No macro allocated so it generates no code
#undef TFT_CS
#else
// Convert Arduino pin reference Dx or STM pin reference PXn to port and mask
#define CS_PORT digitalPinToPort(TFT_CS)
@@ -892,11 +894,17 @@
////////////////////////////////////////////////////////////////////////////////////////
// Macros for all other SPI displays
////////////////////////////////////////////////////////////////////////////////////////
#else
#define tft_Write_8(C) \
{ spiBuffer[0] = C; \
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); }
#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER)
// Temporary workaround for issue #510 part 2
#define tft_Write_8(C) spi.transfer(C)
#else
#define tft_Write_8(C) \
{ spiBuffer[0] = C; \
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); delayMicroseconds(1);}
#endif
#define tft_Write_16(C) \
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; \

View File

@@ -526,7 +526,9 @@ void TFT_eSPI::commandList (const uint8_t *addr)
***************************************************************************************/
void TFT_eSPI::spiwrite(uint8_t c)
{
begin_tft_write();
tft_Write_8(c);
end_tft_write();
}