EBC Exercise 12a 2.4 TFT LCD display via SPI

From eLinux.org
Revision as of 15:00, 12 September 2018 by Yoder (talk | contribs) (Generate Text: Added contents of text.sh)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


2.4" TFT LCD

This is an exercise in interfacing the 2.4" TFT LCD display (ili9341) via a SPI bus.

The Hardware

Wire the LCD display as shown in the table.

LCD Bone
MISO P9_21
LED P9_16
SCK P9_22
MOSI P9_18
D/C P9_19
RESET P9_20
CS P9_17
GND P9_2
VCC P9_4

The Software

Clone the course repo.

bone$ git clone https://github.com/MarkAYoder/BeagleBoard-exercises.git exercises

and then

bone$ cd exercises/display/ili9341/fb
bone$ git pull
bone$ ./on.sh

After a moment the display should turn dark. Look in on.sh to see what it did.

Displaying Images

Follow the instructions in install.sh to download fbi and some images.

bone$ sudo apt install fbi

Display them with:

bone$ fbi -noverbose -T 1 -a boris.png

You should now see Boris the Beagle on your display.

Playing Movies

Install mplayer and load a movie on the Bone (see install.sh).

bone$ sudo apt install mplayer

Play the movie. Rotate the movie.

Generate Text

Install imagemagick.

bone$ sudo apt install imagemagick

See text.sh for an example of using imagemagick to write text to the LCD display. Write your name on the LCD. Display an image and write some text on it.

# Here's how to use imagemagick to display text
# Make a blank image
SIZE=320x240
TMP_FILE=/tmp/frame.png

# From: http://www.imagemagick.org/Usage/text/
convert -background lightblue -fill blue -font Times-Roman -pointsize 24 \
     -size $SIZE \
     label:'ImageMagick\nExamples\nby Anthony' \
     -draw "text 0,200 'Bottom of Display'" \
     $TMP_FILE

sudo fbi -noverbose -T 1 $TMP_FILE




thumb‎ Embedded Linux Class by Mark A. Yoder