ILI9340 SPI TFT Library for Raspberry Pi/Orange Pi
You can show a chart to ILI9340/ILI9341/ILI9163C/ST7735 SPI TFT.
You can choose bmc2835 library/WiringPi(WiringOp) library.
I tested these TFT.
1.44 inch 128x128 ST7735
1.44 inch 128x128 ILI9163C
1.8 inch 128x160 ST7735
2.2 inch 240x320 ILI9340
2.4 inch 240x320 ILI9341
2.4 inch 240x320 ILI9341
TFT | Rpi/Opi | |
---|---|---|
VCC | -- | 3.3V |
GND | -- | GND |
CS | -- | Pin#24(SPI CE0) |
RES | -- | Pin#5(*) |
D/C | -- | Pin#3(*) |
MOSI | -- | Pin#19(SPI MOSI) |
SCK | -- | Pin#23(SPI SCLK) |
LED | -- | 3.3V |
MISO | -- | N/C |
(*) You can change any pin.
Note:
Opi have only 1 SPI.
OPi-PC have CE0 and GPIO8.
OPi ZERO have CE1 and GPIO8.
RPi Only, Very fast
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.56.tar.gz
tar zxvf bcm2835-1.56.tar.gz
cd bcm2835-1.56
./configure
make
sudo make check
sudo make install
* This tool require 1.56 or later.
* Because this tool uses bcm2835_spi_write.
cd $HOME
git clone https://github.com/nopnop2002/Raspberry-ili9340spi
cd Raspberry-ili9340spi
cc -o demo demo.c fontx.c ili9340.c -lbcm2835 -lm -DBCM
Both of RPi/OPi, But slow
git clone https://github.com/nopnop2002/Raspberry-ili9340spi
cd Raspberry-ili9340spi
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -DWPI
TFT resolution is set to tft.conf.
If your TFT doesn't use a memory from 0th address in GRAM, It use GRAM offset which set to tft.conf.
This library can use ILI9341 TFT.
From left 2.8" ILI9341,2.4" ILI9341, 2.2" ILI9340.
This library can use ILI9163C/ST7735 TFT.
From left to right.
2.2 inch 240x320 ILI9340
1.44 inch 128x128 ST7735
1.44 inch 128x128 ILI9163C
1.8 inch 128x160 ST7735
Wirering
TFT | Rpi | |
---|---|---|
T_IRQ | -- | Pin#22(*) |
T_OUT | -- | Pin#21(SPI MISO) |
T_DIN | -- | Pin#19(SPI MOSI) |
T_CS | -- | Pin#26(SPI CE1) |
T_CLK | -- | Pin#23(SPI SCLK) |
MISO | -- | N/C |
LED | -- | 3.3V |
SCK | -- | Pin#23(SPI SCLK) |
MOSI | -- | Pin#19(SPI MOSI) |
D/C | -- | Pin#3(*) |
RES | -- | Pin#5(*) |
CS | -- | Pin#24(SPI CE0) |
GND | -- | GND |
VCC | -- | 3.3V |
(*) You can change any pin.
cc -o xpt xpt.c xpt2046.c -lbcm2835
If you touch screen, point will show.
cc -o touch touch.c fontx.c ili9340.c xpt2046.c -lbcm2835 -lm -DBCM
If you touch area, number will show.