TFT display and pushing RGB565 RAW data in special way

Hi Guys!

The goal i'm planning to achieve is to create a nice, fluent animation on 2.2" 320x240 TFT display (ILI9341 driver with SD card slot on the back). The animation will take place in couple of places on the screen only - not full screen. Do you know how to do it? I was thinking about the following approach:

  1. create the graphic in i.e. Paint of the size like 32x400
  2. convert it to RGB565 format (using i.e. UTFT??) in Top Down arrangment
  3. write it onto the SD card
  4. in Arduino sketch create time efficient draw "32x40" function to pull 32x40 pixels size part of the 32x400 array starting at any row. Thus by passing any row number from "row 0" to "row last" to the "draw 32x40" function i should achieve nice and fluent animation on the screen and just repeating the draw32x40 function in loop, changing row number only i can chould see nice animation in the loop on the display - like the one in old style milage counters in cars. This is the effect i want to achieve.

the function arguments should be like:

draw32x40(Location_on_TFT_X, Location_on_TFT_Y, row_number)

Do you guys know if something similar already exist in some graphics libraries for Arduino in order to not reinvent the wheel?
if no, any thought on how to do such function - in terms of data array preparation, writing to SD and pulling those data form SD in time efficient way? I'm not Ph.D. in programming:)

Pls see attached files for reference.

milage.JPG

Yes you can animate each digit separately.

Do you really want to see a small lag between units, tens, hundreds, ... when they go from 999 to 1000?

Personally, I would put the digits into PROGMEM. A small rectangle can fit even if full-colour. Monochrome rectangles are trivial.

Explain how realistic you want the effect. e.g. shadows, reflections, glare, ...

Yes, most libraries can render images colour or monochrome.

David.

Edit. The 32x400 image would be 25.6kB of PROGMEM as 565 format pixels. Or 1.6kB monochrome. i.e. colour image is not practical for Uno.

Thank you for reply. I'd like to render it as realistic as possible. I was thinking about shadows as overlay on the top and bottom of each 'digits drum'. I still need to asses the digit size - the screen is 320px wide and it should accommodate 6 digits though they will not fit the full display screen. Assuming 70% of the display width then one digit should have 36 pixels in width and let's say 50 pixels in height - 1800 pixels. If i understand it right, in 565 format one 16-bits byte can store full color information for one pixel. If yes, one digit will take 3600 8-bit bytes:/ Times 10 for 10 digits i 36000 8-bit bytes. Way too much for for a ATmega168 i plan to use:(

A mega168 has not got enough Flash or SRAM for SD and TFT.

David.

hmmm, isn't it depends on the buffer size i use for data transfer between SD card and TFT?

Yes, it would be possible to work with a SPI Flash chip.
I doubt if a fully fledged FAT filesystem on a SD will fit on a mega168. Especially if the mega168 has a bootloader too.

is there any way just to put RAW bitmap on the SD card and make a small buffer in arduino nano, then download part of the RAW bitmap image to the buffer and then switch CS (chip select) to TFT and put the buffer from Nano to TFT controller and update the screen?
If i create one RAW image which contain all digits from 0 to 9, one stack on the other then i could just use some pointer to point to SD card address where to start pulling data to the buffer. By changing pointer i can scroll the content.