Code: Select all
void displayPicture(){
fatInitDefault();
FILE *pFile=fopen("/t.bmp","rb");
if (pFile!=NULL) {
//file size
fseek (pFile, 0 , SEEK_END);
long lSize = ftell (pFile);
u8 *buffer= (u8*) malloc (sizeof(u8)*lSize);
rewind (pFile);
if (fread (buffer,1,lSize,pFile) != lSize)
printf("\n File could not be read\n"); //
//copy from buffer
dmaCopy(buffer, BG_GFX_SUB, lSize);
printf("%u",buffer);
decompress(buffer, BG_GFX_SUB, LZ77Vram);
//close file and clean buffer
fclose (pFile);
free (buffer);
}
else printf("\n FileNotFound!\n");
}