Dear emWin-users,
I am trying to draw a Bitmap picture (abc.bmp) from an external sd-card on the LCD with the GUI_BMP_DrawEx()-function.
So I have stored a .bmp file on my external sd-card and do the following: here is my code:
/////////////////
FATFS FatFs;
FRESULT res;
FIL fil;
static char _acBuffer[400];
int APP_GetData(void * p, const U8 * * ppData, unsigned NumBytesReq, U32 Off) {
FILE *phfile;
DWORD NumBytesRead;
phfile = (FILE *)p;
//
// Set file pointer to the offset location
//
fseek(phfile, Off, SEEK_SET);
//
// Read data into buffer
//
NumBytesRead = fread(_acBuffer, sizeof(char), NumBytesReq, phfile);
//
// Set data pointer to the beginning of the buffer
//
*ppData = _acBuffer;
//
// Return number of available bytes
//
return NumBytesRead;
}
int main (void)
{
res = f_mount(&FatFs, " ", 1) // it passes, it is successfully mounted (FR_OK after debugging);
res = f_open(&fil, "abc.bmp", FA_CREATE_ALWAYS | FA_WRITE); // it passes, it is successfully opened (FR_OK after debugging)
GUI_BMP_DrawEx(APP_GetData, fil, 0, 0);
}
But somehow nothing happens ..... it is not visualized on the screen....
Can you help me or provide a small example.....
Thanks
Ivo
I am trying to draw a Bitmap picture (abc.bmp) from an external sd-card on the LCD with the GUI_BMP_DrawEx()-function.
So I have stored a .bmp file on my external sd-card and do the following: here is my code:
/////////////////
FATFS FatFs;
FRESULT res;
FIL fil;
static char _acBuffer[400];
int APP_GetData(void * p, const U8 * * ppData, unsigned NumBytesReq, U32 Off) {
FILE *phfile;
DWORD NumBytesRead;
phfile = (FILE *)p;
//
// Set file pointer to the offset location
//
fseek(phfile, Off, SEEK_SET);
//
// Read data into buffer
//
NumBytesRead = fread(_acBuffer, sizeof(char), NumBytesReq, phfile);
//
// Set data pointer to the beginning of the buffer
//
*ppData = _acBuffer;
//
// Return number of available bytes
//
return NumBytesRead;
}
int main (void)
{
res = f_mount(&FatFs, " ", 1) // it passes, it is successfully mounted (FR_OK after debugging);
res = f_open(&fil, "abc.bmp", FA_CREATE_ALWAYS | FA_WRITE); // it passes, it is successfully opened (FR_OK after debugging)
GUI_BMP_DrawEx(APP_GetData, fil, 0, 0);
}
But somehow nothing happens ..... it is not visualized on the screen....
Can you help me or provide a small example.....
Thanks
Ivo