Skip to content
Modified ILI9341_T3 library modified to use SPIN
C C++
Branch: master
Clone or download
KurtE Fix duplice link issue if Adafruit_GFX included
We #ifdefed out the define of the class if Adafruit GFX was incuded, but we had the class code defined in our code base which then conflicted with the code in Adafruit library
Latest commit bdf85f0 Sep 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Example programs - Header file name - Case sensitive Apr 28, 2019
extras Update examples to use this library name Oct 28, 2016
.gitattributes :neckbeard: Added .gitattributes & .gitignore files Jul 23, 2016
.gitignore :neckbeard: Added .gitattributes & .gitignore files Jul 23, 2016
ILI9341_t3n.cpp Fix duplice link issue if Adafruit_GFX included Sep 17, 2019
ILI9341_t3n.h Fix duplice link issue if Adafruit_GFX included Sep 17, 2019 Mention T3.5 has frame buffer now in Readme May 15, 2018
cat.bmp First drop Jul 23, 2016
flowers.bmp First drop Jul 23, 2016
glcdfont.c First drop Jul 23, 2016
ili9341_t3n_font_Arial.c rename fonts to not compile issue with main ili9341_t3 librar Dec 28, 2016
ili9341_t3n_font_Arial.h rename fonts to not compile issue with main ili9341_t3 librar Dec 28, 2016
ili9341_t3n_font_ArialBold.c Font file name updated Feb 9, 2017
ili9341_t3n_font_ArialBold.h rename fonts to not compile issue with main ili9341_t3 librar Dec 28, 2016
ili9341_t3n_font_ComicSansMS.c Updates for scrolling Apr 6, 2019
ili9341_t3n_font_ComicSansMS.h Updates for scrolling Apr 6, 2019
ili9341_t3n_font_OpenSans.c Basic anti-alias font support (BDF v2.3) Apr 22, 2019
ili9341_t3n_font_OpenSans.h Basic anti-alias font support (BDF v2.3) Apr 22, 2019
keywords.txt Add new functions and keywords Apr 3, 2019
library.json Update examples to use this library name Oct 28, 2016 More test case configurations, plus Sep 7, 2016
purple.bmp First drop Jul 23, 2016

Overview and Warning:

This is a modified version of the official PJRC ILI9341_t3 library ( And it is always a Work In Progress.

This library borrows some concepts and functionality like the usage of DMA from another variant library:

This library was originally created to be able to test out SPI on the newer Teensy boards (3.5 and 3.6), which have multiple SPI busses. Later it was also adapted to allow this on the Teensy LC as well.


Currently this library uses my SPIN library (, which allows me to use different SPI busses.

The constructor for the class now takes an optional pointer to a SPIN object, which defaults to SPIN which is for the SPI buss. To use SPI1, pass in &SPIN1, and likewise for SPI2 buss pass in &SPIN2. Note: there is also code in place that if you forget to update which SPIN object to use and the begin method finds that the passed in values for MISO/MOSI/SCK are not valid for the currently selected buss, it will see if those pins are valid on SPI1 or SPI2 and if so, will recover and set to use the appropriate SPIN object.

In addition, this code allows the ILI9341 code to work with only one hardware CS pin available, which in this case must be used for the DC pin. This is very useful to support SPI1 on the new T3.5 and T3.6 boards which only have one CS pin unless you use some form of adapter to use the SPI pins that are on the SDCARD.

Frame Buffer

The teensy 3.6 and now 3.5 have a lot more memory than previous Teensy processors, so on these boards, I borrowed some ideas from the ILI9341_t3DMA library and added code to be able to use a logical Frame Buffer. To enable this I added a couple of API's

uint8_t useFrameBuffer(boolean b) - if b non-zero it will allocate memory and start using
void	freeFrameBuffer(void) - Will free up the memory that was used.
void	updateScreen(void); - Will update the screen with all of your updates...
void	setFrameBuffer(uint16_t *frame_buffer); - Now have the ability allocate the frame buffer and pass it in, to avoid use of malloc

Asynchronous Update support (Frame buffer)

The code now has support to use DMA for Asynchronous updates of the screen. You can choose to do the updates once or in continuous mode. Note: I mainly use the oneshot as I prefer more control on when the screen updates which helps to minimize things like flashing and tearing. Some of the New methods for this include:

bool	updateScreenAsync(bool update_cont = false); - Starts an update either one shot or continuous
void	waitUpdateAsyncComplete(void);  - Wait for any active update to complete
void	endUpdateAsync();			 - Turn of the continuous mode.
boolean	asyncUpdateActive(void)      - Lets you know if an async operation is still active

Additional APIs

In addition, this library now has some of the API's and functionality that has been requested in a pull request. In particular it now supports, the ability to set a clipping rectangle as well as setting an origin that is used with the drawing primitives. These new API's include:

void setOrigin(int16_t x = 0, int16_t y = 0); 
void getOrigin(int16_t* x, int16_t* y);
void setClipRect(int16_t x1, int16_t y1, int16_t w, int16_t h); 
void setClipRect();

Discussion regarding this optimized version:

This version of the library supports the Adafruit displays that use the ILI9341 displays, but in addition are setup to support the displays that are sold by PJRC, which include:

Note: this library like the ILI9341_t3 library which it is derived from no longer require any of the Adafruit libraries, such as their Adafruit_ILI9341 and Adafruit_GFX libraries APIS are based on.

Adafruit library info

But as this code is based of of their work, their original information is included below:

This is a library for the Adafruit ILI9341 display products

This library works with the Adafruit 2.8" Touch Shield V2 (SPI) ---->

Check out the links above for our tutorials and wiring diagrams. These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional).

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_ILI9341. Check that the Adafruit_ILI9341 folder contains Adafruit_ILI9341.cpp and Adafruit_ILI9341.

Place the Adafruit_ILI9341 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE

Also requires the Adafruit_GFX library for Arduino.

Future Updates

I am hoping to phase out SPIN and be able to directly use SPI. This has been helped by the recent updates to SPI, which all of the SPI objects are of one class. Currently I still need a few additional things like pointers to the underlying SPI registers. But hopefully will get there.

Again WIP

You can’t perform that action at this time.