Skip to main content
Senior
May 8, 2025
Question

Using Bitmap::dynamicBitmapCreateExternal

  • May 8, 2025
  • 3 replies
  • 725 views

Hi, I am trying to create an external dynamic bitmap to display an image already loaded into Memory Mapped External Flash. 

uint16_t FrontendApplication::getLogoBitmapId()
{
 if (bitmapId == touchgfx::BITMAP_INVALID)
 {
 	bitmapId = Bitmap::dynamicBitmapCreateExternal(185, 43,(void const*)0x90FC0000, Bitmap::RGB565);
 }
 return bitmapId;
}

 

void LandingView::setupScreen()
{
 LandingViewBase::setupScreen();
 auto app = static_cast<FrontendApplication*>(Application::getInstance());
 uint16_t bmpId = app->getLogoBitmapId();
 logo.setBitmap(Bitmap(bmpId));
 add(logo);
 logo.invalidate();
}

 I keep getting the bitmapId as BITMAP_INVALID. I've tried the external bitmap function with L8 as well.  

3 replies

ST Employee
May 9, 2025

Hello @Priyank ,

Did you set up your bitmap cache ?
BR,

PriyankAuthor
Senior
May 12, 2025

The description of the function says that is allows the user to create a dynamic bitmap without needing to use the cache so I did not.

"Create a dynamic bitmap without reserving memory in the dynamic
* bitmap cache. The pixels must be already available in the
* memory, e.g. in flash. No copying is performed."

ST Employee
May 13, 2025

You still need the setCache, it's use to store your image adress/size.

BR,

PriyankAuthor
Senior
May 13, 2025

Gotcha, I set the cache, but for RGB565 images, the image shows up faded. For L8 Images, they don't appear at all?

ST Employee
May 30, 2025

Hello @Priyank,

As said here DynamicBitmapCreateExternal() RGB - STMicroelectronics Community, there's a known bug with 565 that will be solved in a next released.
Since your question was about using dynamicBitmapCreateExternal, please select a best answer so others can find the solution easier.

BR,