mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-11 00:24:44 +02:00
Issue #510 part STM32F103 workaround
This commit is contained in:
@@ -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
|
// Placeholder for DMA functions
|
||||||
|
@@ -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 image is clipped, copy pixels into a contiguous block
|
||||||
if ( (dw != w) || (dh != h) ) {
|
if ( (dw != w) || (dh != h) ) {
|
||||||
if(_swapBytes) {
|
if(_swapBytes) {
|
||||||
for (uint32_t yb = 0; yb < dh; yb++) {
|
for (int32_t yb = 0; yb < dh; yb++) {
|
||||||
for (uint32_t xb = 0; xb < dw; xb++) {
|
for (int32_t xb = 0; xb < dw; xb++) {
|
||||||
uint32_t src = xb + dx + w * (yb + dy);
|
uint32_t src = xb + dx + w * (yb + dy);
|
||||||
(buffer[xb + yb * dw] = image[src] << 8 | image[src] >> 8);
|
(buffer[xb + yb * dw] = image[src] << 8 | image[src] >> 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
memcpy((uint8_t*) (buffer + yb * dw), (uint8_t*) (image + dx + w * (yb + dy)), dw << 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -187,6 +187,7 @@
|
|||||||
#if !defined (TFT_DC) || (TFT_DC < 0)
|
#if !defined (TFT_DC) || (TFT_DC < 0)
|
||||||
#define DC_C // No macro allocated so it generates no code
|
#define DC_C // No macro allocated so it generates no code
|
||||||
#define DC_D // No macro allocated so it generates no code
|
#define DC_D // No macro allocated so it generates no code
|
||||||
|
#undef TFT_DC
|
||||||
#else
|
#else
|
||||||
// Convert Arduino pin reference Dn or STM pin reference PXn to port and mask
|
// Convert Arduino pin reference Dn or STM pin reference PXn to port and mask
|
||||||
#define DC_PORT digitalPinToPort(TFT_DC)
|
#define DC_PORT digitalPinToPort(TFT_DC)
|
||||||
@@ -202,6 +203,7 @@
|
|||||||
#if !defined (TFT_CS) || (TFT_CS < 0)
|
#if !defined (TFT_CS) || (TFT_CS < 0)
|
||||||
#define CS_L // No macro allocated so it generates no code
|
#define CS_L // No macro allocated so it generates no code
|
||||||
#define CS_H // No macro allocated so it generates no code
|
#define CS_H // No macro allocated so it generates no code
|
||||||
|
#undef TFT_CS
|
||||||
#else
|
#else
|
||||||
// Convert Arduino pin reference Dx or STM pin reference PXn to port and mask
|
// Convert Arduino pin reference Dx or STM pin reference PXn to port and mask
|
||||||
#define CS_PORT digitalPinToPort(TFT_CS)
|
#define CS_PORT digitalPinToPort(TFT_CS)
|
||||||
@@ -892,11 +894,17 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Macros for all other SPI displays
|
// Macros for all other SPI displays
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#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) \
|
#define tft_Write_8(C) \
|
||||||
{ spiBuffer[0] = C; \
|
{ spiBuffer[0] = C; \
|
||||||
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); }
|
HAL_SPI_Transmit(&spiHal, spiBuffer, 1, 10); delayMicroseconds(1);}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define tft_Write_16(C) \
|
#define tft_Write_16(C) \
|
||||||
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; \
|
{ spiBuffer[0] = (C)>>8; spiBuffer[1] = C; \
|
||||||
|
@@ -526,7 +526,9 @@ void TFT_eSPI::commandList (const uint8_t *addr)
|
|||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
void TFT_eSPI::spiwrite(uint8_t c)
|
void TFT_eSPI::spiwrite(uint8_t c)
|
||||||
{
|
{
|
||||||
|
begin_tft_write();
|
||||||
tft_Write_8(c);
|
tft_Write_8(c);
|
||||||
|
end_tft_write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user