Experimental project to drive a TFT LCD with an AVR MCU and avr-libc
| cats | 1 year ago | ||
| emojis | 1 year ago | ||
| nbproject | 1 year ago | ||
| scripts | 1 year ago | ||
| .gitignore | 2 years ago | ||
| CODE_OF_CONDUCT.md | 2 years ago | ||
| LICENSE | 2 years ago | ||
| Makefile | 1 year ago | ||
| README.md | 1 year ago | ||
| avrtft.c | 1 year ago | ||
| bitmaps.c | 1 year ago | ||
| bitmaps.h | 1 year ago | ||
| bmp.c | 1 year ago | ||
| bmp.h | 1 year ago | ||
| cmd.c | 1 year ago | ||
| cmd.h | 1 year ago | ||
| colorspace.c | 1 year ago | ||
| colorspace.h | 1 year ago | ||
| display.c | 1 year ago | ||
| display.h | 1 year ago | ||
| emojis.c | 1 year ago | ||
| emojis.h | 1 year ago | ||
| font.c | 2 years ago | ||
| font.h | 2 years ago | ||
| hack.c | 1 year ago | ||
| hack.h | 1 year ago | ||
| i2c.c | 2 years ago | ||
| i2c.h | 2 years ago | ||
| paint.c | 1 year ago | ||
| paint.h | 1 year ago | ||
| pins.h | 1 year ago | ||
| ra8875.c | 1 year ago | ||
| ra8875.h | 1 year ago | ||
| sdcard.c | 1 year ago | ||
| sdcard.h | 1 year ago | ||
| spi.c | 1 year ago | ||
| spi.h | 1 year ago | ||
| tft.c | 1 year ago | ||
| tft.h | 1 year ago | ||
| touch.c | 1 year ago | ||
| touch.h | 1 year ago | ||
| types.h | 1 year ago | ||
| usart.c | 1 year ago | ||
| usart.h | 1 year ago | ||
| utils.h | 2 years ago | ||
Experimental project to drive a TFT LCD with an AVR MCU (ATmega328P) and avr-libc.
Currently supported displays/drivers:
Additionally, there is some support for larger (up to 800x480) TTL displays, for example the
Adadruit 7.0" 40-pin TFT Display - 800x480 with Touchscreen,
with the RA8875 controller like the
RA8875 Driver Board for 40-pin TFT Touch Displays
including touch support.
Currently implemented features:
Ideas:
Connect to the controller with for example GTKTerm (38400 Baud).
Write some text and a bitmap, and upload a BMP image:
c 0xffff // clear displayd // display the demot 0 0 Just some text // write text in Hack to row 0 column 0b 0 0 1 // write bitmap with index 1 (tiny Linus cat) to row 0 column 0p 0 0 // prepare to "stream" a 16-Bit (5/6/5) RGB BMP image to row 0 column 0cat Bali160x128.bmp > /dev/ttyUSB0 // upload a BMP images 0 // read BMP image from SD card starting at address 0 (to row 0 column 0)a // start paint application
Emojis are entered with a tabulation char + their "code", i.e. Smile!<TAB>s for a smiling emoji.
Without any file system, to write any number of pictures with a specific
resolution as 16-Bit (5/6/5) RGB BMP image files:
Convert pictures with ImageMagick 'convert' and pad them to a multiple of
512 bytes
for i in *.jpg; do convert $i -scale 320x240 -define bmp:subtype=RGB565 $i.bmp; truncate -s 154112 $i.bmp; echo $i; done
Concatenate the images to a single file
for i in *.bmp; do cat $i >> sdcard.img; echo $i; done
Write the images raw to SD card (danger zone!)
sudo dd if=sdcard.img of=/dev/mmcblk0 bs=512
Now the images can be read one by one from SD card with an address offset of 301.
A super basic paint application created to learn about processing touch events
and draw something on the screen.
The FT6206 based touch screen of the
Adafruit 2.8" Color TFT LCD with Cap Touch 320x240 ILI9341
works quite well but at least for me the coordinates of touches close to the
long edges of the screen are a bit off (too close to the edge) and there seems
to be no calibration capability - the data sheet mentions "auto calibration".
But still it is fun and it should be possible to create an application
supporting touch with reliable usability.
If at all possible, it probably is quite a challenge to drive such a 40-pin display with a 28-pin
MCU like the ATmega238P, but it is easy with the RA8875 driver, offering support for a touch screen
as well. Here it is combined with the SparkFun Level Shifting microSD Breakout
to read images from an SD card, advancing to the next image by touching the screen.