loadBitmap function with SdFat

Hello, I am using Henning Karlsen’s UTFT lib to display maps on a 280x224 px surface. The function loadBitmap uses his tinyFAT to draw these maps. However, tinyFAT can only use the root dir on an SD card, and I have hundreds of map files to choose from (only one is open at a time). SdFat works with the card shield I’m using, and I’d like to adapt loadBitmap to use SdFat for its source. I’ve attached UTFT_tinyFAT .cpp and .h files, but to start, I could include loadBitmap in my sketch. Arguments passed to the function are the X and Y starting and stopping point, and the path file name. It needs to:

  1. open a binary file, read only, using SdFat
  2. read it into a buffer 512 bytes at a time
  3. use LCD_Write_DATA to draw the buffer on the screen
  4. close the file

Can anyone point me in the right direction? Thanks.

UTFT_tinyFAT.cpp (2.63 KB)

UTFT_tinyFAT.h (1.21 KB)

UTFT_tinyFAT.pdf (96.8 KB)