Skip to content

Install ILI9341_t3 for Teensy

Calvin Hass edited this page May 1, 2019 · 8 revisions

ILI9341 library for Teensy

Paul Stoffregen has recommended a 2.8" ILI9341 TFT to work well with the Teensy. There are two display driver libraries suggested for this TFT:

  • Adafruit_ILI9341: Supports Teensy LC, 3.2, 3.5, 3.6, etc.
  • ILI9341_t3: Supports Teensy 3.2, 3.5, 3.6, etc.

Using ILI9341_t3

If one wishes to use the Teensy-optimized version of the ILI9341 display driver, the PaulStoffregen/ILI9341_t3 library is a great choice. GUIslice can use this display driver, but it requires a recent version for certain APIs that were recently added.

Errors if using older ILI9341_t3 library

If you have configured GUIslice to use ILI9341_t3 but the ILI9341_t3 is an older version, you may see the following error messages during compile:

error: 'class ILI9341_t3' has no member named 'measureTextWidth'
error: 'class ILI9341_t3' has no member named 'measureTextHeight'

If you see these messages, then you will need to update your ILI9341_t3 library.

Installing latest ILI9341_t3

In order to get the latest version, perform the following steps:

  • Download the ZIP file from https://github.com/PaulStoffregen/ILI9341_t3/archive/master.zip
  • Do not use the Arduino IDE "Add ZIP library" feature, instead we are going to manually install it into your Arduino libraries folder
  • Uncompress the ZIP file (ILI9341_t3-master.zip)
  • Rename the uncompressed folder from ILI9341_t3-master to ILI9341_t3
  • Delete any existing copies of ILI9341_t3 from your Arduino/libraries folder
  • Copy the new ILI9341_t3 folder into your Arduino/libraries folder
  • Close and reopen the Arduino IDE

Special Notes for ILI9341_t3

There are a couple differences in how the t3 library works versus other display libraries. In particular:

  • Must not include Adafruit-GFX in t3 sketches.
    • Adafruit-GFX should not be included because the t3 library already includes much of this code.
    • If the GFX library is included, then an error will be shown indicating that the GFX Button class has already been defined: ILI9341_t3.cpp:1690: multiple definition of 'Adafruit_GFX_Button::drawButton(bool)'
  • t3 Fonts require a FontSetMode() call with parameter GSLC_FONTREF_MODE_1, ie.:
    • gslc_FontSetMode(&m_gui,E_FONT_ARIAL14,GSLC_FONTREF_MODE_1);
  • t3 fonts have a different include file name than the Adafruit-GFX extra fonts. Instead of:
    • #include "Fonts/FreeMono9pt7b.h"
    • The ILI9341_t3 has font files in the form of:
    • #include <font_Arial.h>

Additional clarifying detail will be added to the above soon.

General Notes for Teensy 3

  • As the Teensy 3 starts executing code very quickly, it is usually necessary to add in a delay after Serial.begin() in order to see any debug messages. 2 seconds is often sufficient. For example:
void setup()
{
  // Initialize debug output
  Serial.begin(9600);
  gslc_InitDebug(&DebugOut);
  delay(2000);
  ...
Clone this wiki locally