vanvught / ili9340spi_rpi

ILI9340 SPI TFT Library & XPT2046 Touch Screen Library for Raspberry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ili9340spi_rpi

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


Wirering

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.


Build using bcm2835 library

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_gpio_write.

cd $HOME
git clone https://github.com/nopnop2002/ili9340spi_rpi
cd ili9340spi_rpi
cc -o demo demo.c fontx.c ili9340.c -lbcm2835 -lm -DBCM


Build using WiringPi/WiringOp library

Both of RPi/OPi, But slow

git clone https://github.com/nopnop2002/ili9340spi_rpi
cd ili9340spi_rpi
cc -o demo demo.c fontx.c ili9340.c -lwiringPi -lm -DWPI


ili9340-1

ili9340-2

ili9340-3

ili9340-4

ili9340-5

ili9340-6

ili9340-7

ili9340-8


This library can use ILI9341 TFT.

From left 2.8" ILI9341,2.4" ILI9341, 2.2" ILI9340.

ili9341-a

ili9341-b

ili9341-c


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

ili9163-1


A library of XPT2046 Touch Screen is included in this library

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.

touch-11

cc -o touch touch.c fontx.c ili9340.c xpt2046.c -lbcm2835 -lm -DBCM

If you touch area, number will show.

touch-12

About

ILI9340 SPI TFT Library & XPT2046 Touch Screen Library for Raspberry


Languages

Language:C 100.0%