Well this is an old question of course, I have read a bitmap from sd, but using a big bitmap(480x272 in my case) my ram gets stock, I know that there is a way drawing an image with GUI_BMP_DrawEx() as user and reference manual says, it do not have to be read into the memory but it use a variable as buffer. The problem is the same. Some examples of emWin use window library and I cannot found it. I have check some questions made before and I have downloaded some examples of them. I´m using MCUXpresso IDE, I would like to share my way to read an image from sd, I was wondering if someone has an example without using window library or telling me how to include it in my project. I would like to draw BMP, JPG, PNG and GIF image I have read reference manual UM03001.pdf but I´m stock in How to read file without GUI_BMP_Draw() function. I mean; I have modified some examples in old question like this one, these are my functions:
static void _ShowBMP(const TCHAR* sFilename)
{
int XSize, YSize, XPos, YPos;
FIL hFile;
FRESULT error;
error = f_open(&hFile, sFilename, (FA_READ | FA_OPEN_EXISTING));
if (error == FR_OK)
{
GUI_ClearRect(0, 0, 480, 272);
XSize = GUI_BMP_GetXSizeEx(_GetData, &hFile);
YSize = GUI_BMP_GetYSizeEx(_GetData, &hFile);
XPos = (XSize > 480) ? 0 : 160 - (XSize / 2);
YPos = (YSize > 272) ? 60 : 150 - (YSize / 2);
if (!GUI_BMP_DrawEx(_GetData, &hFile, XPos, YPos))
{
GUI_Delay(2000);
}
f_close(&hFile);
}
}
and my getdata function
Hi
I cannot resolved the problema about draw bitmap with GUI_BMP_DrawEx() function, so I had to read about bitmap files and I resolved in this way, I would like to share this metod. If someone has a way to avoid the sweep image(showing pixel per pixel) I would apreciated it
first:
6.10 Ejemplo: leer información de un fichero BMP - AprendeAProgramar.com
INFORMATION TYPE BYTE POSITION
File Type (BM) 0-1
File Size 2-5
Reserved 6-7
Reserved 8-9
Offset (start image) 10-13
Header Size 14-17
Xsize(píxels) 18-21
Ysize(píxels) 22-25
Number of layers 26-27
Bits per pixel 28-29
Compression 30-33
Image Size 34-37
Horizontal resolution 38-41
Vertical resolution 42-45
Table color size 46-49
Importan colors counter 50-53
So based on this:
Hi Oscar Nino,
Do you have tried the small bin picture, whether it works OK on your side? Just make sure your problem is the RAM problem or the emwin using problem.
You mentioned :window library , could you give me more information about it, where you find these library information. Is it from NXP or Segger emwin?
About the emwin problem, I think you also can post the question in segger, because it is the segger's product, their engineer will be more familiar with it. The link is:
Technical Support | SEGGER - The Embedded Experts
About the RAM size problem, I think you can consider to add an external SRAM which can connected to the EMC module, just like this:
Then the external RAM will have the according address in the LPC54608, you can call that memory directly.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Kerry Zhou
Thanks for reply, about BIN picture I haven´t , I have tried small picture using GUI_BMP_Draw() function. About problema I think it is both, SDRAM I can´t use it, I have seen and debug examples of this but when I implement it in my code it doesn´t work.
This is how I use SDRAM:
First way.-
void *g_bufferRead = (void *)SDRAM_BASE_ADDR; /*SDRAM starting address*/
then:
sizeImage = g_fileObject.obj.objsize - g_fileObject.fptr;
g_bufferRead = malloc(sizeImage);
to reserve memory
and finally
error = f_read(&g_fileObject, g_bufferRead, sizeof(sizeImage), &bytesRead);
Second way.-
uint8_t (*g_bufferRead)[0x80000] = (uint8_t(*)[0x80000])SDRAM_BASE_ADDR; /*SDRAM starting address*/
then:
sizeImage = g_fileObject.obj.objsize - g_fileObject.fptr;
error = f_read(&g_fileObject, g_bufferRead, sizeof(sizeImage), &bytesRead);
Third way.-
UINT *g_bufferRead[g_fileObject.obj.objsize - g_fileObject.fptr] = (UINT*)SDRAM_BASE_ADDR[g_fileObject.obj.objsize - g_fileObject.fptr];
error = f_read(&g_fileObject, g_bufferRead, (g_fileObject.obj.objsize - g_fileObject.fptr), &bytesRead);
but any of them work
About Windows library, I have check some examples from emwin: "2DGL_DrawBMP.c" in this example appears windows library (I attached this file)
Finally aboud SRAM or SDRAM Im using LPCXpresso54608 board, I suppose it has SDRAM because examples lcd_accel_tft16bpp and emc_sdram use it.
I attach some examples uploaded by someone else here(DRAW_BMP_JPG_PNG_0.c).
To correspond to my request I would like to share an emwin project that works on the LPCXpresso54608 board Space Evader, you just have to créate an emwin example project in MCUXpreso and copy this files into rar file over source folder in the mentioned example.
Could any body help me?
I would like to see an example of doing this with GUI_BMP_DrawEx() function
Hi Oscar Nino,
Thanks for your updated information!
Please also provide the original BMP picture,I also need to check whether the data is correct.
Then I will test it on my LPC54608 board.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------