Question
How to read .bin file for Touchgfx
Normally I can display all projects of touchgfx (which can be stored in internal memory) on my touchscreen without any problem.
For a larger project I needed to use a SD card. For this purpose, I compiled all the images into a .bin file and then saved it to SD card. I try to use blockcopy function as shown below but all I get is just a black screen.
To sum up, I dont know how to call the images. it will be appreciated if someone correct the mistakes or shift me to the the correct way.
bool TouchGFXHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes)
{
uint32_t dataOffset = (uint32_t)src;
if (dataOffset >= 0x9A000000 && dataOffset < 0xA0000000)
{
int fd;
if(f_mount(&myFatFs,SDPath,1) == FR_OK)
{
if (f_open(&myFile,"images.bin",FA_OPEN_EXISTING | FA_READ) == FR_OK)
{
fd = open("images.bin", O_RDONLY, 0);
dataOffset = dataOffset - 0x9A000000;
lseek(fd, dataOffset, SEEK_SET);
read(fd, (uint8_t *)dest, numBytes);
close(fd);
}
return true;
}
else { return false;}
}
else
{ return HAL::blockCopy(dest, src, numBytes); }
}for initialization ;
void TouchGFXHAL::initialize()
{
uint16_t* cacheStartAddr = (uint16_t *) malloc(0x3000000);
uint32_t cacheSize = 0x3000000;
Bitmap::removeCache();
Bitmap::setCache(cacheStartAddr,cacheSize,1024);
Bitmap::cacheAll();
}