SPI Library for 240x320 TFT LCD with ILI9320, ILI9325 and ILI9328 chip
Dependents: KL25Z_ILI9320_Demo Mini-DK
Other LCD drivers
05-30-2014
Device initialization for ILI9325 and ILI9328 has been added to the library.
The library will auto-detect what driver chip is connected (ILI9320, ILI9325 or ILI9328) and use the appropriate init sequence.
Please use the Issues tab to report any problems.
SPI TFT library for LPC1768, LPC11U24 and KL25Z
Loading fonts
When using this libary, don't forget to load the TFT_FONTS library from Peter Drescher at http://mbed.org/users/dreschpe/code/TFT_fonts/
KL25Z : limitations
The filetoflash function (see below) is not available.
Writing to the LCD is a little slower as the KL25Z only supports 8-bit SPI communication.
LPC1768 and LPC11U24 : filetoflash (SD to CPU flash)
This library contains a function to copy an image from the SD card to the CPU flash memory.
It allows you to use an image as background without speed loss when writing other text and graphics.
By default, this option is enabled.
It can be disabled by adding following instruction BEFORE you load the library:
#define NO_FLASH_BUFFER
Since the flash memory has limited write endurance, DO NOT use this feature when you intend to read multiple images from the SD card (eg: when used as a photo frame).
Sample code
#include "mbed.h" // SPI TFT demo // NOTES // - Connect the LCD reset pin to the reset pin of the CPU board or connect a // separate reset circuit to the LCD reset pin (pull-up 10k to 3v3 + 100nf capacitor to GND). // - When using the mbed LPC1768 board, following hardware modifications are needed: // Connect the LCD reset pin to the nR input. // Connect a 100nF capacitor between the nR input and GND. // Connect a pushbutton parallel to the 100nF capacitor. // Use the new pushbutton as the reset button (instead of the LPC1768 on-board reset button). #define NO_FLASH_BUFFER // Do not use CPU flash for storing bitmaps #include "SPI_TFT_ILI9320.h" #include "Arial12x12.h" #include "Arial24x23.h" #include "Arial28x28.h" #include "font_big.h" SPI_TFT TFT(p11, p12, p13, p14,"TFT"); //mosi, miso, clk, cs int main (void) { TFT.claim(stdout); // send stdout to the TFT display // Disable stdout buffering, allows us to omit \n with printf. // More info at http://www.cplusplus.com/reference/cstdio/setvbuf/ setvbuf ( stdout , NULL , _IONBF , NULL ); TFT.background(Black); // set background to black TFT.foreground(White); // set chars to white TFT.cls(); // clear the screen TFT.set_font((unsigned char*) Arial12x12); // select the font TFT.locate(0,0); printf("ILI9320 SPI TFT library\n"); printf("Simple demo\n"); }
Demo code LPC1768 (Mini-DK board)
Import programLPC1768_Mini-DK
LPC1768 Mini-DK board with 2.8" SPI TFT and SPI touch
Demo code FRDM-KL25Z board
Import programKL25Z_ILI9320_Demo
KL25Z driving an ILI9320 LCD board with touch panel (HY28A-LCDB SPI)