Display Bmp file from Sd_card

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Hello,

    Please try using the function GUI_BMP_DrawEx(). emWin requires a GetData()-function which fetches the data when using external memory.

    Details on how to create a GetData()-function can be found in the chapter "Displaying bitmap files" in the emWin user manual.

    Best regards,
    Adrian
  • Thank you

    can you help to implement it with keil compiler and fs library .
    here is code that i can open file :
    FILE *f;
    f = fopen ("Test.Bmp","r");
    now how should i write "GetData" ?

    i cant use Getdata Function in the sample code "2DGL_DrawBMP.C"



    Best regards,
  • I have tried this code but i can't display

    FILE *f;
    f = fopen ("ed.bmp","r");
    GUI_BMP_DrawEx( APP_GetData,&f, 0, 0);
    while(1){
    GUI_Exec();


    };


    int APP_GetData(void * p, const U8 ** ppData, unsigned NumBytesReq, U32 Off)
    {

    unsigned int NumBytesRead;
    FILE * phFile;

    phFile = (FILE *)p;

    /* Check buffer size */
    if (NumBytesReq > sizeof(_acBuffer)) {
    NumBytesReq = sizeof(_acBuffer);
    }

    /* Set file pointer to the required position */
    //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 =(unsigned char *) _acBuffer;

    /* Return number of available bytes */
    return NumBytesRead;
    }

    The post was edited 1 time, last by mori64 ().

  • Hello,

    Please understand that I can not provide you a ready-to-use GetData()-function for your hardware / file system. In order to implement your GetData()-function properly I would recommend following the instructions in the section 8.5 "Getting data with the ...Ex() functions" and following the instructions in your file system's user manual.

    Best regards,
    Adrian