Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: KL25Z_ILI9320_Demo Mini-DK
You are viewing an older revision! See the latest version
Homepage
IMPORTANT NOTES¶
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/
¶
filetoflash (SD to CPU flash)¶
This library contains an option to copy an image from the SD card to the CPU flash memory. This 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
// NOTE : connect the LCD reset pin the reset pin of the CPU board.
// eg: on the mbed board, this is the 'nR' connection.
#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
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");
}