STM32 update

Boost performance for ILI9488 display with STM32 processors.
Enable smooth fonts in setup files (smooth fonts for STM32 processors is now supported with fonts in program memory)
This commit is contained in:
Bodmer
2020-03-02 22:25:39 +00:00
parent ed160f6476
commit 65ccbf0139
10 changed files with 94 additions and 27 deletions

View File

@@ -221,17 +221,38 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len)
** Function name: pushBlock - for STM32 and 3 byte RGB display
** Description: Write a block of pixels of the same colour
***************************************************************************************/
#define BUF_SIZE 240*3
void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
{
// Split out the colours
spiBuffer[0] = (color & 0xF800)>>8; // Red
spiBuffer[1] = (color & 0x07E0)>>3; // Green
spiBuffer[2] = (color & 0x001F)<<3; // Blue
uint8_t col[BUF_SIZE];
// Always using swapped bytes is a peculiarity of this function...
//color = color>>8 | color<<8;
uint8_t r = (color & 0xF800)>>8; // Red
uint8_t g = (color & 0x07E0)>>3; // Green
uint8_t b = (color & 0x001F)<<3; // Blue
while (len--) HAL_SPI_Transmit(&spiHal, spiBuffer, 3, HAL_MAX_DELAY);
if (len<BUF_SIZE/3) {
for (uint32_t i = 0; i < len*3; i++) {
col[i] = r;
col[++i] = g;
col[++i] = b;
}
HAL_SPI_Transmit(&spiHal, col, len*3, HAL_MAX_DELAY);
return;
}
for (uint32_t i = 0; i < BUF_SIZE; i++) {
col[i] = r;
col[++i] = g;
col[++i] = b;
}
do {
HAL_SPI_Transmit(&spiHal, col, BUF_SIZE, HAL_MAX_DELAY);
len -= BUF_SIZE/3;
} while ( len>=BUF_SIZE/3 ) ;
// Send remaining pixels
if (len) HAL_SPI_Transmit(&spiHal, col, len*3, HAL_MAX_DELAY); //*/
}
/***************************************************************************************
** Function name: pushPixels - for STM32 and 3 byte RGB display
** Description: Write a sequence of pixels

View File

@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.1.4"
#define TFT_ESPI_VERSION "2.1.5"
/***************************************************************************************
** Section 1: Load required header files

View File

@@ -49,9 +49,8 @@
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// At the moment SMOOTH fonts must be disabled for STM32 processors (due to lack of SPIFFS)
// Support for smooth fonts via SD cards is planned.
//#define SMOOTH_FONT // Must be commented out for STM32
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc

View File

@@ -47,6 +47,5 @@
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// At the moment SMOOTH fonts must be disabled for STM32 processors (due to lack of SPIFFS)
// Support for smooth fonts via SD cards is planned.
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT

View File

@@ -48,6 +48,5 @@
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// At the moment SMOOTH fonts must be disabled for STM32 processors (due to lack of SPIFFS)
// Support for smooth fonts via SD cards is planned.
//#define SMOOTH_FONT
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT

View File

@@ -36,7 +36,7 @@
// T_DIN - connect to processor MOSI
// T_CS - connect to processor pin specified by TOUCH_CS above
// T_SCK - connect to processor SCK
//*
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
@@ -44,10 +44,9 @@
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
//*/
// At the moment SMOOTH fonts MUST be disabled for STM32 processors (due to lack of SPIFFS)
// Support for smooth fonts via SD cards is planned.
//#define SMOOTH_FONT // Must be commented out for STM32
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT
// Assuming the processor clock is 72MHz:
#define SPI_FREQUENCY 36000000 // 36MHz SPI clock

View File

@@ -50,11 +50,10 @@
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// At the moment SMOOTH fonts must be disabled for STM32 processors (due to lack of SPIFFS)
// Support for smooth fonts via SD cards is planned.
//#define SMOOTH_FONT // Must be commented out for STM32
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT
// Nucleo-F767ZI has a ~216MHZ CPU clock, this is divided by 4, 8, 16 etc
#define SPI_FREQUENCY 20000000 // 27MHz SPI clock

View File

@@ -0,0 +1,51 @@
////////////////////////////////////////////////////
// Setup for Nucleo 64 or 144 and ILI9341 display //
////////////////////////////////////////////////////
// See SetupX_Template.h for all options available
// Define STM32 to invoke optimised processor support
#define STM32
// Defining the board allows the library to optimise the performance
// for UNO compatible "MCUfriend" style shields
#define NUCLEO_64_TFT
//#define NUCLEO_144_TFT
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
#define TFT_PARALLEL_8_BIT
// Define the display driver chip type
//#define ILI9341_DRIVER
#define ILI9481_DRIVER
// Define the Nucleo 64/144 pins used for the parallel interface TFT
// The pins can be changed here but these are the ones used by the
// common "MCUfriend" shields
#define TFT_CS A3 // Chip select control pin
#define TFT_DC A2 // Data Command control pin
#define TFT_RST A4 // Reset pin
#define TFT_WR A1 // Write strobe control pin
#define TFT_RD A0 // Read pin
#define TFT_D0 D8 // 8 bit parallel bus to TFT
#define TFT_D1 D9
#define TFT_D2 D2
#define TFT_D3 D3
#define TFT_D4 D4
#define TFT_D5 D5
#define TFT_D6 D6
#define TFT_D7 D7
// Fonts to be available
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// STM32 support for smooth fonts via program memory (FLASH) arrays
#define SMOOTH_FONT

View File

@@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "2.1.4",
"version": "2.1.5",
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
"repository":

View File

@@ -1,5 +1,5 @@
name=TFT_eSPI
version=2.1.4
version=2.1.5
author=Bodmer
maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32