Commit 1917e8f5 authored by Bodmer's avatar Bodmer

Add fast STM32 parallel mode

parent 8bdb3ea6
...@@ -12,19 +12,21 @@ You can take this one step further and have your own setup select file and then ...@@ -12,19 +12,21 @@ You can take this one step further and have your own setup select file and then
To select a new setup you then edit your own my_setup_select.h file (which will not get over-written during an upgrade). To select a new setup you then edit your own my_setup_select.h file (which will not get over-written during an upgrade).
# News # News
1. A new "Animated_dial" example has been added to show how dials can be created using a rotated Sprite for the needle. To run this example the TFT must support reading from the screen RAM. The dial rim and scale is a jpeg image, created using a paint program. 1. A new option has been added for STM32 processors to optimise performance where Port A (or B) pins 0-7 are used for the 8 bit parallel interface data pins 0-7 to the TFT. This gives a dramatic 8 times better rendering performance for the lower clock rate STM32 processors such as the STM32F103 "Blue Pill" or STM411 "Black Pill" since no time consuming data bit manipulation is required. See setup file "User_Setups/Setup35_ILI9341_STM32_Port_Bus.h".
2. A new "Animated_dial" example has been added to show how dials can be created using a rotated Sprite for the needle. To run this example the TFT must support reading from the screen RAM. The dial rim and scale is a jpeg image, created using a paint program.
![Animated_dial](https://i.imgur.com/S736Rg6.png) ![Animated_dial](https://i.imgur.com/S736Rg6.png)
2. Anti-aliased (smooth) fonts can now be stored as arrays in FLASH (program) memory. This means that processors such as STM32 that do not have SPIFFS support can use the fonts. The processor must have sufficient FLASH memory to store the fonts used. 3. Anti-aliased (smooth) fonts can now be stored as arrays in FLASH (program) memory. This means that processors such as STM32 that do not have SPIFFS support can use the fonts. The processor must have sufficient FLASH memory to store the fonts used.
3. The Sprite class now supports 4 bits per pixel with a 16 color palette. Three new examples have been added. 4. The Sprite class now supports 4 bits per pixel with a 16 color palette. Three new examples have been added.
4. The library has been upgraded to support STM32 processors when used with SPI or 8 bit parallel displays. DMA capability for SPI displays has been added for STM32F103 (e.g. "Blue Pill") and STM32F2xx/4xx/7xx (e.g. 32/64/144 Nucleo boards). New DMA demo examples have been added (for STM32 only). 5. The library has been upgraded to support STM32 processors when used with SPI or 8 bit parallel displays. DMA capability for SPI displays has been added for STM32F103 (e.g. "Blue Pill") and STM32F2xx/4xx/7xx (e.g. 32/64/144 Nucleo boards). New DMA demo examples have been added (for STM32 only).
5. The ST7796 display controller has been added. The ST7796 RPi MHS-4.0 inch Display-B type display is supported (this is fast for a SPI display as an ESP32 can clock it at 80MHz (ESP8266 at 40MHz)), see setups 27 and 28. 6. The ST7796 display controller has been added. The ST7796 RPi MHS-4.0 inch Display-B type display is supported (this is fast for a SPI display as an ESP32 can clock it at 80MHz (ESP8266 at 40MHz)), see setups 27 and 28.
6. A callback function has been added, this allows antialiased fonts to be rendered over colour gradients or images. Two new examples have been added to illustrate this new capability: 7. A callback function has been added, this allows antialiased fonts to be rendered over colour gradients or images. Two new examples have been added to illustrate this new capability:
"Smooth_font_reading_TFT" "Smooth_font_reading_TFT"
......
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
//#define NUCLEO_64_TFT //#define NUCLEO_64_TFT
//#define NUCLEO_144_TFT //#define NUCLEO_144_TFT
// STM32 8 bit parallel only:
// If STN32 Port A or B pins 0-7 are used for 8 bit parallel data bus bits 0-7
// then this will improve rendering performance by a factor of ~8x
//#define STM_PORTA_DATA_BUS
//#define STM_PORTA_DATA_BUS
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed) // Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
//#define TFT_PARALLEL_8_BIT //#define TFT_PARALLEL_8_BIT
...@@ -93,19 +99,23 @@ ...@@ -93,19 +99,23 @@
// #define TFT_INVERSION_ON // #define TFT_INVERSION_ON
// #define TFT_INVERSION_OFF // #define TFT_INVERSION_OFF
// ##################################################################################
//
// Section 2. Define the pins that are used to interface with the display here
//
// ##################################################################################
// If a backlight control signal is available then define the TFT_BL pin in Section 2 // If a backlight control signal is available then define the TFT_BL pin in Section 2
// below. The backlight will be turned ON when tft.begin() is called, but the library // below. The backlight will be turned ON when tft.begin() is called, but the library
// needs to know if the LEDs are ON with the pin HIGH or LOW. If the LEDs are to be // needs to know if the LEDs are ON with the pin HIGH or LOW. If the LEDs are to be
// driven with a PWM signal or turned OFF/ON then this must be handled by the user // driven with a PWM signal or turned OFF/ON then this must be handled by the user
// sketch. e.g. with digitalWrite(TFT_BL, LOW); // sketch. e.g. with digitalWrite(TFT_BL, LOW);
// #define TFT_BACKLIGHT_ON HIGH // HIGH or LOW are options // #define TFT_BL 32 // LED back-light control pin
// #define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
// ##################################################################################
//
// Section 2. Define the pins that are used to interface with the display here
//
// ##################################################################################
// We must use hardware SPI, a minimum of 3 GPIO pins is needed. // We must use hardware SPI, a minimum of 3 GPIO pins is needed.
// Typical setup for ESP8266 NodeMCU ESP-12 is : // Typical setup for ESP8266 NodeMCU ESP-12 is :
...@@ -183,8 +193,6 @@ ...@@ -183,8 +193,6 @@
//#define TFT_RST 4 // Reset pin (could connect to RST pin) //#define TFT_RST 4 // Reset pin (could connect to RST pin)
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST //#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
//#define TFT_BL 32 // LED back-light (only for ST7789 with backlight control pin)
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen //#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only //#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
...@@ -205,10 +213,11 @@ ...@@ -205,10 +213,11 @@
// Wemos D32 boards need to be modified, see diagram in Tools folder. // Wemos D32 boards need to be modified, see diagram in Tools folder.
// Only ILI9481 and ILI9341 based displays have been tested! // Only ILI9481 and ILI9341 based displays have been tested!
// Parallel bus is only supported on ESP32 // Parallel bus is only supported for the STM32 and ESP32
// Uncomment line below to use ESP32 Parallel interface instead of SPI // Example below is for ESP32 Parallel interface with UNO displays
//#define ESP32_PARALLEL // Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
//#define TFT_PARALLEL_8_BIT
// The ESP32 and TFT the pins used for testing are: // The ESP32 and TFT the pins used for testing are:
//#define TFT_CS 33 // Chip select control pin (library pulls permanently low //#define TFT_CS 33 // Chip select control pin (library pulls permanently low
......
...@@ -59,10 +59,14 @@ ...@@ -59,10 +59,14 @@
//#include <User_Setups/Setup29_ILI9341_STM32.h> // Setup for Nucleo board //#include <User_Setups/Setup29_ILI9341_STM32.h> // Setup for Nucleo board
//#include <User_Setups/Setup30_ILI9341_Parallel_STM32.h> // Setup for Nucleo board and parallel display //#include <User_Setups/Setup30_ILI9341_Parallel_STM32.h> // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup31_ST7796_Parallel_STM32.h> // Setup for Nucleo board and parallel display //#include <User_Setups/Setup31_ST7796_Parallel_STM32.h> // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup32_ILI9341_STM32F103.h> // Setup for "Blue Pill" //#include <User_Setups/Setup32_ILI9341_STM32F103.h> // Setup for "Blue Pill"
//#include <User_Setups/Setup33_RPi_ILI9486_STM32.h> // Setup for Nucleo board //#include <User_Setups/Setup33_RPi_ILI9486_STM32.h> // Setup for Nucleo board
//#include <User_Setups/Setup36_RPi_touch_ILI9341.h> // Setup file configured for ESP32 and RPi TFT with touch //#include <User_Setups/Setup34_ILI9481_Parallel_STM32.h> // Setup for Nucleo board and parallel display
//#include <User_Setups/Setup35_ILI9341_STM32_Port_Bus.h> // Setup for STM32 port A parallel display
//#include <User_Setups/Setup36_RPi_touch_ILI9341.h> // Setup file configured for ESP32 and RPi TFT with touch
//#include <User_Setups/Setup43_ST7735.h> // Setup file configured for my ST7735S 80x160 //#include <User_Setups/Setup43_ST7735.h> // Setup file configured for my ST7735S 80x160
......
//////////////////////////////////////////////////////////////
// Setup for STM32 and ILI9341 display //
//////////////////////////////////////////////////////////////
// Last update by Bodmer: 28/3/20
// Define STM32 to invoke STM32 optimised driver
#define STM32
// Define if Port A (or B) pins 0-7 are used for data bus bits 0-7
// this will improve rendering performance by a factor of ~8x
#define STM_PORTA_DATA_BUS
//#define STM_PORTB_DATA_BUS // Pins below must re re-allocated to use this option
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
#define TFT_PARALLEL_8_BIT
// Define ONE of the the TFT display drivers
#define ILI9341_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER
//#define ST7796_DRIVER
#define TFT_CS PB7 // Chip select control pin
#define TFT_DC PB8 // Data Command control pin
#define TFT_RST PB0 // Reset pin
#define TFT_WR PB9 // Write strobe control pin
#define TFT_RD PB1 // Read pin
#define TFT_D0 PA0 // 8 bit Port A parallel bus to TFT
#define TFT_D1 PA1
#define TFT_D2 PA2
#define TFT_D3 PA3
#define TFT_D4 PA4
#define TFT_D5 PA5
#define TFT_D6 PA6
#define TFT_D7 PA7
#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
// Assuming the processor clock is 72MHz:
#define SPI_FREQUENCY 36000000 // 36MHz SPI clock
//#define SPI_FREQUENCY 18000000 // 18MHz SPI clock
#define SPI_READ_FREQUENCY 12000000 // Reads need a slower SPI clock
#define SPI_TOUCH_FREQUENCY 2500000 // Must be very slow
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