LI9341 TDF Display
This is a 3.2" $10 240X320 color display that is easy to set up on the Raspberry Pi Pico using the SPI interface. The hardware supports a touch screen and an SD card, but we could not locate drivers for these components.
Sample $10 part on Amazon or ebay
The TFT uses a 16-bit representation of the color of each pixel:
- 5-bits for red
- 6-bits for green
- 5-bits for blue
This requires us to include the color565
library for doing color operations. So for example, to get the color yellow, you would need to do the following:
1 |
|
Sample SPI Hello World Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Draw Random Rectangles
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
Draw Color Lists
One of the best ways to study the color values is to display a rectangle and list the color name and values under the rectangle.
Here is a sample program that will do this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
Screen Update Speed
One large disadvantage of this display is the very slow refresh rate. Transmitting the entire screen of 240X320 with two bytes per pixel takes a long time over SPI. This makes this setup difficult to use for animation.
Ball Bounce Animation
Here is a very slow "ball bounce" animation that is slow and has a lot of flicker.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
References
-
Jeffmer's GitHub library which includes four fonts - the sizes are 8, 14, 24 and 32 pixels.
-
Amazon HiLetgo ILI9341 2.8" SPI TFT LCD Display Touch Panel 240X320 with PCB 5V/3.3V STM32