Upload Image C array file from SD Card

@Marian_M Ok, so far I’ve gotten this far, where I’m using binary files for image on sd card. I have made necessary configuration on the lv_conf.h and enabled custom memory:

#define LV_MEM_CUSTOM 1

for custom memory as mentioned. also I’ve enabled PNG:

#define LV_USE_PNG 1

and also enabled the FATFS as well:

/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
#define LV_USE_FS_FATFS 1
#if LV_USE_FS_FATFS
    #define LV_FS_FATFS_LETTER 'S'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_FATFS_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif

and I’ve called the lv_fs_fatfs_init() in my main.cpp file:

  lv_fs_fatfs_init(); // abstraction call from lvgl/src/extra/libs/fsdrv/lv_fsdrv.h

I also want to add that my SD Card initialziation is happening inside my main.cpp file and the function is like this:

bool initSD() {
  // Initialize custom SPI bus
  mySPI.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS);

  // Initialize SD card with custom SPI bus and chip select pin
  if (!SD.begin(SD_CS, mySPI)) {
    Serial.println("SD card initialization failed!");
    return false;
  }

  Serial.println("SD card initialized successfully!");
  return true;
}

which I basically call in my setup function. My main question is how will I let lvgl know that to use SD card as the mount device in my main.cpp file which is calling the main lv_fs_fatfs_init() function which is inside the lvgl library dependencies. I am lost at this point. What should I do over here. Documentation isn’t so clear on the implementation at this point.

Would appreciate your help.

Thanks,
Dian