In search for a fast ILI9341 lib for Teensy that is (a) fast, (b) supports multiple fonts and (c) rotation, I tried several options but neither one works sufficiently.
Marek's Arduino derivative comes close and except for some (really unneccessary, to express it kind) signature changes to existing Adafruit methods, it works fine. Quite slow on Teensy, though, at twice the speed of an 8 MHz Arduino nano.
Paul's t3 lib is amazingly fast and "correct" but only supports the small standard font.
mahatmajman, your derivative comes closest, based on Paul's t3 lib, it is fast and the multi-font support works well... except: rotation does not work correctly:
If the display is rotated 90 or 270 degrees ("setRotation(1) resp. (3)"), the clipping is done wrong. Instead of clipping text at X position 320+, it is clipped at 240+.
Demonstration code attached.
All the ILI9341 libs really feel like loose ends, add a gradient here, change a signature there, remove Teensy SPI code here, add Due code there, attaching different font libraries etc.
As my application kept growing, which led me to Teensy in the first place, looking back I spent almost half the time on choosing and adapting an appropriate library while using wrappers where necessary to be prepared for the next surprise.
Anyway, thank you very much for your efforts, Teensy and ILI9341 represent an amazing environment!
Comparing Paul's t3 and mahatmajman's t3 lib, I noticed that the latter uses the Adafruit GFX as a base class instead of "Print".
Surprisingly, all other graphical functions I tried appear to work right.
Ideas, anyone?
Frank
Code:
#include <Wire.h>
#include <SPI.h> // required for TFTs
#define sclk 13 // Don't change
#define mosi 11 // Don't change
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 // you could connect this to the Arduino reset
// use Paul Stoffregen -> mahatmajman T3 lib
#include <Adafruit_mfGFX.h>
//#include <Adafruit_GFX.h>
#include <ILI9341_t3.h>
ILI9341_t3 display = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST);
void setup()
{
display.begin();
display.setRotation(3);
}
void loop() {
// put your main code here, to run repeatedly:
display.fillRect(0, 0, 320, 320, display.color565(0,0,0));
delay(500);
display.drawFastVLine(240, 0, 240, display.color565(255,0,0));
display.setTextWrap(false);
display.setTextColor(display.color565(0, 255, 0));
display.setCursor(10, 10);
display.println("hello, this is a very long text, hopefully long enough to reach the right border");
display.setCursor(10, 220);
display.println("this text should be printed in the lower part of the TFT");
delay(1000);
}