ILI9225 Optimized Library

jayjayuk

Member
Here we have a library for the ILI9225 2.2" 176x220 display commonly found on ebay (which is where i purchased mine). But let me start with a thank you to the creator of the teensy boards and also to the creators of the original libraries which i put this one together with. It uses Paul's fast SPI code to talk to the display... it also has all the functions that are in the ILI9341_t3 library (which this one is mainly based on) are the same in this library so there will be compatibility which should only require changing library #includes and display and initializers ... the rest of the functions should be the same. I also added some more functions and other small changes as well (which took me quite some time) like width() height() functions do NOT return 176x220 ... they return 175x219 which is usuable values without taking one away for the zero index in writing code... all the subtractions in the library for all functions where also removed. Another change was i had to take/borrow a part of the SPI library, the chip select function, as i could not get the SPI registers to toggle the _rs line on the display... it did toggle clock select but not the _rs line, so i started looking into the datasheet and found a lot of configuration options for SPI. One option i did find was the SRE bit for SPI... once i enabled it the _rs line was being toggled properly by the the SPI register... i modified the chip select function from the SPI library and included it in this library to manually add the SRE bit.

Most of this code is not my own and has been used from other libraries which really... in my opinion... should take the credit for it... as i just modified some of the code so the pixels where correct spending alot of time looking through a magnifying glass to ensure the correct pixels was on (i actually only test to the corners and then again -1 from all edges so there was a row of pixels not lit and a row next to it that was lit, and basic checking like that). All rotations can also be inverted/flipped so text/draws are displayed right->left and text is written backwards so the screen can be turned any way round.

For the most part, it is identical to the functioning of the Highly optimized ILI9341_t3 library, i also named this one ILI9225_t3 as it used the same transmission functions and the public functions was the same, so a library and initializer could be changed and a change of display will still run on the same main code that was written.

Here is the Adafruit timings from the demo... also a demo of UTFT and a bitmap demo ... although i did not include the UTFT demo as of the copyright in the library... the timings are quite a lot faster than the ILI9341 screen but this display does not have as many pixels to write so that is where the speed mainly is... the SRE bit helped aswell.

Heres is a pic of the Adafruit demo timings....
Capture.PNG

Here is a video of the Adafruit demo....
https://www.dropbox.com/s/5j8hsbdfu5mfksf/ILI9225_t3_ADAFRUIT_DEMO.mp4?dl=0

Here is a video of the UTFT demo....
https://www.dropbox.com/s/hmps5xr3ekl1n86/ILI9225_t3_UTFT_DEMO.mp4?dl=0

Here is a video of the bitmap drawing which just changes the colours of lots of small Adafruit logos.....
https://www.dropbox.com/s/gk2xoa31jll8cbs/ILI9225_t3_BITMAP_DEMO.mp4?dl=0

And finally here is the library.... i hope it can be of use to someone for their project.
View attachment ILI9225_t3.zip
 
Last edited:
Hi jayjayuk,

your library seems to be great, thanks for the work!

Just one question:
You use SPI_MODE_0 for communication with ili9225.
According to the diagram in it's data sheet it looks like SPI_MODE_3 (capture on rising edge of CLK and IDLE-High of CLK).

Am I missing something?
 
any idea about how hard would it be to adapt this to T4?

I've seen this other option but it does not compile for T4:
https://www.arduino.cc/reference/en/libraries/tft_22_ili9225/
You can probably just look at the changes that I added to ili9341_t3 to support the T4...
Note: I extracted the code from my version ili9341_t3n. Although I did not integrate all of the support in ILI9341_t3n, in particular I did not add in the support to allow different SPI busses and the like.
 
Back
Top