Highly optimized ILI9341 (320x240 TFT color display) library

Glad it worked :) Good learning for me - I have my display (also ILI9341 based) but just waiting on a 2x20 header I ordered that will span the gap in the middle of the breadboard...
 
Hi all,
I've updated my google-fonts repository. I had to delete the old one and create a new - I hope this does not cause too much trouble. My git-tool crashed repatedly when it tried to update - i think, it was because of the size.

The apache-directory and ufl-directoy now contain converted files, too.

Some statistics:

- Apache : 51 Fonts
- ofl : 934 Fonts
- ufl : 3 Fonts
- 2554 Font files (*.ttf) total
~3 GB total
- It took about 1 hour to convert all fonts

I have added my script to convert the archive, so, I hope, I don' have to write a new one next time :) If you want to use it, update the paths in "googlefonts.sh" (frank.tar.gz).
 
Last edited:
I'm having some issues with the Library. It wont left me do a draw round rect? I can draw a rect just fine can somebody show me a line of code to do this if it's possible with this library.
 
Hi FrankB -

I'm having trouble getting the ILI9341_t3DMA library to work.
When I try Paul's original ILI9341_t3 library, it works out of the box, as does Kurt's ILI9341_t3n.
When I attempt to run the tests using the latest version of ILI9341_t3DMA I get compile errors relating to "glcdfont".
I've had a search and note another user has had a similar issue with the library in the past. Did you ever find out what it was?

Code:
C:\Users\peter\AppData\Local\Temp\arduino_build_118287\libraries\ILI9341_t3DMA\ILI9341_t3DMA.cpp.o: In function `ILI9341_t3DMA::drawChar(short, short, unsigned char, unsigned short, unsigned short, unsigned char)':

D:\Users\peter\Documents\Arduino\libraries\ILI9341_t3DMA/ILI9341_t3DMA.cpp:984: [COLOR="#FF0000"]undefined reference to `glcdfont'[/COLOR]

D:\Users\peter\Documents\Arduino\libraries\ILI9341_t3DMA/ILI9341_t3DMA.cpp:947: [COLOR="#FF0000"]undefined reference to `glcdfont'[/COLOR]

collect2.exe: error: ld returned 1 exit status

Cheers,
Peter

Edit: Test results using _t3 and _t3n. Both on T_3.6 @180MHz
Basically identical, apart from the obvious framebuffer (FB) results being miles quicker.
Code:
				_t3		_t3n		_t3n (FB)
Screen fill              	224906		224954
Text                     	11223		11400
Lines                    	58387		58377
Horiz/Vert Lines         	18382		18398
Rectangles (outline)    	11683		11695
Rectangles (filled)      	462091		462246		63073
Circles (filled)         	69017		70225
Circles (outline)        	53691		55378
Triangles (outline)      	14104		14115
Triangles (filled)       	153623		154156
Rounded rects (outline)  	24579		25029
Rounded rects (filled)   	504445		504954		73661
 
Last edited:
Sorry if this is the wrong thread. I'm no programmer and a relative newbie to the PJRC forum.

I just purchased the little "purple board" Color touch Screen tester that uses a Teensy 3.2. I have the board built, and one of the 2.8" displays. I am desperately looking for a Teensy 3.2 complete sketch to use with this test board to exercise these displays and the resistive touch screen.

I'm a good electronic technician with no programming background. I do know how to use the Arduino IDE and the "Teensyduino" add-on to upload programs to the Teensy series so that's not a problem and I can install whatever recommended libraries are needed. I just need to find a usable sketch to make this thing work.

Any help would certainly be appreciated.

Jim Sheldon (Amateur Radio Operator W0EB)
 
ILI9341 touch test program with or without Ethernet also on the SPI net

Jim, there's a good demo here: https://github.com/systronix/W5500_Test and look for ILI9341_Test. It draws a screen with stats about the x,y,z values of your touch. Useful for a thorough test of the touchscreen and comparing finger to styli. It supports a modified version of the adapter board you are using to allow WizNET W5500 chip based Ethernet to share SPI. It works with BuyDisplay or the eBay red TJCTM24028-SPI boards. The example has TFT_CS and TFT_DC pins moved to not clash with Ethernet but you will see comments there to let you change back to the defaults. Hope that is useful.
 
I've having a problem with the ILI9341_t3 library.
Everything seems to work fine except the background when printing text.
Here's an example
I'm drawing a picture on the screen, then I'm drawing text on top of it.
Code:
tft.setFont(Arial_32_Bold);
tft.setTextColor(ILI9341_RED, ILI9341_BLACK);
tft.print("Test");
I can still see the image through the text.
I've tried multiple font sizes as well as several combinations of colors.
The first color is always the color of the text and the second color is ignored.
 
AFAIK - writes are transparent - only the pixels specified by the font are written for the given character.

To 'clear' space calculate and draw a filled rectangle of desired color first.

To update that space faster than rectangle redraw - re-write the prior chars in background color - then relocate and then in the new in foreground color.
 
I've having a problem with the ILI9341_t3 library.
Everything seems to work fine except the background when printing text.
Here's an example
I'm drawing a picture on the screen, then I'm drawing text on top of it.
Code:
tft.setFont(Arial_32_Bold);
tft.setTextColor(ILI9341_RED, ILI9341_BLACK);
tft.print("Test");
I can still see the image through the text.
I've tried multiple font sizes as well as several combinations of colors.
The first color is always the color of the text and the second color is ignored.

AFAIK - writes are transparent - only the pixels specified by the font are written for the given character.

To 'clear' space calculate and draw a filled rectangle of desired color first.

To update that space faster than rectangle redraw - re-write the prior chars in background color - then relocate and then in the new in foreground color.

You might try my version of the library: ili931_t3n - https://github.com/KurtE/ILI9341_t3n

I added code to support this. Warning though, there are interesting issues with this. That is, it will fill in, in the background color such that if you continued to a new row of text, the areas between will be filled (full spacing). Which is sometimes not what you want. This version of library also has the ability to turn on a clip rectangle, which is helpful in these cases.
 
Hi Paul,

I added my support for anti-aliased fonts to the ILI9341_t3 library. It simply uses the textbgcolor to work out "anti-aliased" pixel values (so doesn't read from the display first).
The code branches within drawFontChar based on whether your font support AA or not, but those are the only real changes to the code.
Just wanted to let you know so that when you see the pull request (from "projectitis") you'll know what it's about!

I've added a set of anti-aliased fonts to the library (OpenSans).
I also added a new example which adds the original ILI9341_t3_font_t (BDF) drawing to "graphics test", as well as ILI9341_t3_font_t using anti-aliasing.
The speed is not great, I suspect because of the use of Pixel to plot each individual pixel, but I welcome any improvements!
LCD fonts: 11238
BDF fonts: 14979
Anti-aliased BDF fonts: 67120

Cheers.
 
Just wanted to let you know so that when you see the pull request (from "projectitis") you'll know what it's about!

Please remind me of this a few weeks after we start shipping Teensy 4.0.

Until then, I'm probably not going to merge most pull requests. Sorry, I'm just one guy and T4 is already *way* behind schedule!
 
Hi Paul,

I added my support for anti-aliased fonts to the ILI9341_t3 library. It simply uses the textbgcolor to work out "anti-aliased" pixel values (so doesn't read from the display first).
The code branches within drawFontChar based on whether your font support AA or not, but those are the only real changes to the code.
Just wanted to let you know so that when you see the pull request (from "projectitis") you'll know what it's about!

I've added a set of anti-aliased fonts to the library (OpenSans).
I also added a new example which adds the original ILI9341_t3_font_t (BDF) drawing to "graphics test", as well as ILI9341_t3_font_t using anti-aliasing.
The speed is not great, I suspect because of the use of Pixel to plot each individual pixel, but I welcome any improvements!
LCD fonts: 11238
BDF fonts: 14979
Anti-aliased BDF fonts: 67120

Cheers.
In the mean time, for the fun of it, you might try integrating it with my version (github.com/kurte/ili9341_t3n) :D
Note the code in my version is a bit different as it also works with Frame buffer support, plus some other stuff.

If it works there we may also integrate it into our WIP ILI9488 version...
 
ok KurtE, you should see a pull request to support anti-alias fonts.

I've tested both with and without framebuffer, and both seem to be ok (using graphicstest_aafonts example).
I've noticed that my anti-alias routines run marginally FASTER than your solid pixel versions. I'll take a look at your routines and see if I can optimise further.
 
@KurtE and @Projectitis

I incorporated the changes into my copy of the ILI9341_t3 library and the fonts do look nice - but as you said does take a bit longer but the quality is nicer especially for the larger fonts. I did test with the scrolltest.ino sketch but the fonts didn't seem to work as well but I don't have time to debug right now maybe later. But it does work.
 
@KurtE and @Projectitis

I incorporated the changes into my copy of the ILI9341_t3 library and the fonts do look nice - but as you said does take a bit longer but the quality is nicer especially for the larger fonts. I did test with the scrolltest.ino sketch but the fonts didn't seem to work as well but I don't have time to debug right now maybe later. But it does work.

It is now pulled in to the ili9341_t3n library

Thanks
Kurt
 
Back
Top