Skip to content

Commit 8480f39

Browse files
committed
Various updates - raise to version 2.4.43
Sprite class uses TFT_eSPI setBitmapColor - fn deleted Small performance improvement to RP2040 SPI PIO Typo corrections Correct (unused) tft_Write_32 for STM32 Update HX8357D rotation code Enable software reset for ILI9486 Add preliminary RM68120 support
1 parent 3b63aa9 commit 8480f39

File tree

12 files changed

+65
-40
lines changed

12 files changed

+65
-40
lines changed

Extensions/Sprite.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,6 @@ int8_t TFT_eSprite::getColorDepth(void)
335335
}
336336

337337

338-
/***************************************************************************************
339-
** Function name: setBitmapColor
340-
** Description: Set the 1bpp foreground foreground and background colour
341-
***************************************************************************************/
342-
void TFT_eSprite::setBitmapColor(uint16_t c, uint16_t b)
343-
{
344-
if (c == b) b = ~c;
345-
_tft->bitmap_fg = c;
346-
_tft->bitmap_bg = b;
347-
}
348-
349-
350338
/***************************************************************************************
351339
** Function name: setPaletteColor
352340
** Description: Set the 4bpp palette color at the given index

Extensions/Sprite.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ class TFT_eSprite : public TFT_eSPI {
4949
// Get the color at the given palette index
5050
uint16_t getPaletteColor(uint8_t index);
5151

52-
// Set foreground and background colours for 1 bit per pixel Sprite
53-
void setBitmapColor(uint16_t fg, uint16_t bg);
54-
5552
void drawPixel(int32_t x, int32_t y, uint32_t color);
5653

5754
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t font),

Processors/TFT_eSPI_ESP32.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ SPI3_HOST = 2
478478
// Write 8 bits
479479
#define tft_Write_8(C) TFT_WRITE_BITS((C)<<8, 16)
480480

481-
// Write 16 bits with corrected endianess for 16 bit colours
481+
// Write 16 bits with corrected endianness for 16 bit colours
482482
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
483483

484484
// Future option for transfer without wait
@@ -513,7 +513,7 @@ SPI3_HOST = 2
513513
// Write 8 bits
514514
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
515515
516-
// Write 16 bits with corrected endianess for 16 bit colours
516+
// Write 16 bits with corrected endianness for 16 bit colours
517517
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
518518
519519
// Write 16 bits
@@ -537,7 +537,7 @@ SPI3_HOST = 2
537537
// Write 8 bits
538538
#define tft_Write_8(C) TFT_WRITE_BITS(C, 8)
539539

540-
// Write 16 bits with corrected endianess for 16 bit colours
540+
// Write 16 bits with corrected endianness for 16 bit colours
541541
#define tft_Write_16(C) TFT_WRITE_BITS((C)<<8 | (C)>>8, 16)
542542

543543
// Future option for transfer without wait

Processors/TFT_eSPI_STM32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,8 @@
10101010
HAL_SPI_Transmit(&spiHal, spiBuffer, 2, 10); }
10111011

10121012
#define tft_Write_32(C) \
1013-
{ spiBuffer[1] = ((C)>>24); spiBuffer[3] = ((C)>>16); spiBuffer[5] = ((C)>>8); spiBuffer[7] = C; \
1014-
HAL_SPI_Transmit(&spiHal, spiBuffer, 8, 10); }
1013+
{ spiBuffer[0] = (C)>>24; spiBuffer[1] = (C)>>16; spiBuffer[2] = (C)>>8; spiBuffer[3] = C; \
1014+
HAL_SPI_Transmit(&spiHal, spiBuffer, 4, 10); }
10151015

10161016
#define tft_Write_32C(C,D) \
10171017
{ spiBuffer[1] = ((C)>>8); spiBuffer[3] = (C); spiBuffer[5] = ((D)>>8); spiBuffer[7] = D; \

Processors/pio_SPI.pio

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
public start_8:
1717
// Pull the next 32 bit value from the TX FIFO.
1818
pull side 0
19-
// Lose the top 24 bits
20-
out null, 24
19+
// Lose the top 24 bits, send 1st bit
20+
out pins, 25
2121
// Now send remaining bits
22-
jmp spi_out side 0
22+
jmp spi_out side 1
2323

2424
public set_addr_window:
2525
// Loop count in x for caset, paset and ramwr

Processors/pio_SPI.pio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
static const uint16_t tft_io_program_instructions[] = {
2424
0x90a0, // 0: pull block side 0
25-
0x6078, // 1: out null, 24
26-
0x101e, // 2: jmp 30 side 0
25+
0x6019, // 1: out pins, 25
26+
0x181e, // 2: jmp 30 side 1
2727
0xf022, // 3: set x, 2 side 0
2828
0xe000, // 4: set pins, 0
2929
0x90a0, // 5: pull block side 0

TFT_Drivers/HX8357D_Rotation.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
switch (rotation) {
66
case 0: // Portrait
77
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
8-
_width = TFT_WIDTH;
9-
_height = TFT_HEIGHT;
8+
_width = _init_width;
9+
_height = _init_height;
1010
break;
1111
case 1: // Landscape (Portrait + 90)
1212
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
13-
_width = TFT_HEIGHT;
14-
_height = TFT_WIDTH;
13+
_width = _init_height;
14+
_height = _init_width;
1515
break;
1616
case 2: // Inverter portrait
1717
writedata(TFT_MAD_COLOR_ORDER);
18-
_width = TFT_WIDTH;
19-
_height = TFT_HEIGHT;
18+
_width = _init_width;
19+
_height = _init_height;
2020
break;
2121
case 3: // Inverted landscape
2222
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
23-
_width = TFT_HEIGHT;
24-
_height = TFT_WIDTH;
23+
_width = _init_height;
24+
_height = _init_width;
2525
break;
2626
}

TFT_Drivers/ILI9486_Init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
writecommand(0x01); // SW reset
1212
delay(120);
13-
13+
1414
writecommand(0x11); // Sleep out, also SW reset
1515
delay(120);
1616

TFT_eSPI.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,9 @@ void TFT_eSPI::init(uint8_t tc)
737737
#elif defined (ILI9225_DRIVER)
738738
#include "TFT_Drivers/ILI9225_Init.h"
739739

740+
#elif defined (RM68120_DRIVER)
741+
#include "TFT_Drivers/RM68120_Init.h"
742+
740743
#endif
741744

742745
#ifdef TFT_INVERSION_ON
@@ -825,6 +828,9 @@ void TFT_eSPI::setRotation(uint8_t m)
825828
#elif defined (ILI9225_DRIVER)
826829
#include "TFT_Drivers/ILI9225_Rotation.h"
827830

831+
#elif defined (RM68120_DRIVER)
832+
#include "TFT_Drivers/RM68120_Rotation.h"
833+
828834
#endif
829835

830836
delayMicroseconds(10);
@@ -889,6 +895,7 @@ void TFT_eSPI::spiwrite(uint8_t c)
889895
** Function name: writecommand
890896
** Description: Send an 8 bit command to the TFT
891897
***************************************************************************************/
898+
#ifndef RM68120_DRIVER
892899
void TFT_eSPI::writecommand(uint8_t c)
893900
{
894901
begin_tft_write();
@@ -902,7 +909,36 @@ void TFT_eSPI::writecommand(uint8_t c)
902909
end_tft_write();
903910

904911
}
912+
#else
913+
void TFT_eSPI::writecommand(uint16_t c)
914+
{
915+
begin_tft_write();
916+
917+
DC_C;
905918

919+
tft_Write_16(c);
920+
921+
DC_D;
922+
923+
end_tft_write();
924+
925+
}
926+
void TFT_eSPI::writeRegister(uint16_t c, uint8_t d)
927+
{
928+
begin_tft_write();
929+
930+
DC_C;
931+
932+
tft_Write_16(c);
933+
934+
DC_D;
935+
936+
tft_Write_8(d);
937+
938+
end_tft_write();
939+
940+
}
941+
#endif
906942

907943
/***************************************************************************************
908944
** Function name: writedata

TFT_eSPI.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef _TFT_eSPIH_
1717
#define _TFT_eSPIH_
1818

19-
#define TFT_ESPI_VERSION "2.4.42"
19+
#define TFT_ESPI_VERSION "2.4.43"
2020

2121
// Bit level feature flags
2222
// Bit 0 set: viewport capability
@@ -620,9 +620,13 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
620620

621621
// Low level read/write
622622
void spiwrite(uint8_t); // legacy support only
623-
624-
void writecommand(uint8_t c), // Send a command, function resets DC/RS high ready for data
625-
writedata(uint8_t d); // Send data with DC/RS set high
623+
#ifndef RM68120_DRIVER
624+
void writecommand(uint8_t c); // Send a command, function resets DC/RS high ready for data
625+
#else
626+
void writecommand(uint16_t c); // Send a command, function resets DC/RS high ready for data
627+
void writeRegister(uint16_t c, uint8_t d); // Write data to 16 bit command register
628+
#endif
629+
void writedata(uint8_t d); // Send data with DC/RS set high
626630

627631
void commandList(const uint8_t *addr); // Send a initialisation sequence to TFT stored in FLASH
628632

0 commit comments

Comments
 (0)