Hello Everyone, in this blog post, I will show you the step by step instructions to display a simple bitmap image on the display. I hope you guys have already read the first tutorial of this series, if not click here to read that post.
There are three steps which we need to follow:
* Select the bitmap images based on the display type.
* Convert the bitmap images into *.c source code using emWin Bitmap converter tool.
* Use emWin API's to display Bitmap images on the Graphical displays.
Please have a look at the following video.
Once the images are selected, use the "Bitmap Converter Tool" provided by Segger (available with emWin simulation for free), to load the image, and then save the file with extension as *.c filetype.
Add these generated *.c files into the Code::Blocks project, as shown below.
Now, use the emWin API "GUI_DrawBitmap", to display the bitmaps on the Graphical Display. In our example we have generate the *.c code for three images and there names are "bmimage01", "bmimage04" and "bmSTLogo".
Use the following piece of code to update the display.
Thanks for reading this blog post, in case you have some question please post your comment here. This is just a starting and my target is to use the STM32F7 display and emWin to do some cool projects.
![]() |
Bitmap Displayed on emWin simulation |
* Select the bitmap images based on the display type.
* Convert the bitmap images into *.c source code using emWin Bitmap converter tool.
* Use emWin API's to display Bitmap images on the Graphical displays.
Please have a look at the following video.
Once the images are selected, use the "Bitmap Converter Tool" provided by Segger (available with emWin simulation for free), to load the image, and then save the file with extension as *.c filetype.
![]() |
Bitmap Converter Tool |
![]() |
Add image files into the Code::Block Projects |
Use the following piece of code to update the display.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include "GUI.h" | |
#define RECOMMENDED_MEMORY (1024L * 5) | |
extern GUI_CONST_STORAGE GUI_BITMAP bmimage01; | |
extern GUI_CONST_STORAGE GUI_BITMAP bmimage04; | |
extern GUI_CONST_STORAGE GUI_BITMAP bmSTLogo; | |
void MainTask(void) | |
{ | |
GUI_Init(); | |
if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) | |
{ | |
GUI_ErrorOut("Not enough memory available."); | |
return; | |
} | |
GUI_DrawBitmap( &bmimage01, 0, 0); | |
GUI_Delay(2000); | |
GUI_Clear(); | |
GUI_DrawBitmap( &bmimage04, 0, 0); | |
GUI_Delay(2000); | |
GUI_Clear(); | |
GUI_DrawBitmap( &bmSTLogo, 0, 0); | |
while(1); | |
} |
Thanks for reading this blog post, in case you have some question please post your comment here. This is just a starting and my target is to use the STM32F7 display and emWin to do some cool projects.
No comments:
Post a Comment