Skip to main content
DJin.3
Associate
September 30, 2019
Question

Dynamic create bitmap

  • September 30, 2019
  • 2 replies
  • 1133 views

I want to create bitmap dynamically. I called bmpId = Bitmap::dynamicBitmapCreate(800, 480, Bitmap::RGB565); I found bmpId is 0xffff.

and then call Bitmap::cacheGetAddress(bmpId);

system will dead loop in Bitmap::cacheGetAddress(bmpId);

This topic has been closed for replies.

2 replies

Martin KJELDSEN
Principal III
September 30, 2019

Hi @DJin.3​,

You haven't defined a bitmap cache in touchgfx_generic_init() - Without it, you'll get 0xFFFF as your BitmapID (Could not allocate).

/Martin

Martin KJELDSEN
Principal III
September 30, 2019
uint32_t cache[/*size in words*/];
 
void touchgfx_init()
{
 HAL& hal = touchgfx_generic_init<STM32F7HAL>(dma, display, tc, 480, 272, (uint16_t*)cache, sizeof(cache), 1 /*nr of images*/);
...
}

DJin.3
DJin.3Author
Associate
October 2, 2019

Thanks for your reply.

But in my code

/* SRE 25/07/2019 Add define to enable or disable TouchScreen */

/* Touchscreen will impact overall performances as it's scanned by Corelib every X frame hal.setTouchSampleRate(X) */

/* Update init to pass parameter related to dynamic Bitmap */

#ifdef NOTOUCH

HAL& hal = touchgfx_generic_init<STA1095HAL_EVB>(dma, display, tcnotouch, dispWidth, dispHeight, bitmapCache , bitmapcache_size , nbcachedbitmap);

    printf("touchgfx HAL Init TouchScreen Disabled \r\n");

#else

  HAL& hal = touchgfx_generic_init<STA1095HAL_EVB>(dma, display, tc, dispWidth, dispHeight, bitmapCache, bitmapcache_size, nbcachedbitmap);

//uint8_t* canvasBuffer = NULL;

hal.setTouchSampleRate(2);

   hal.setFingerSize(1);

printf("touchgfx HAL Init TouchScreen Enabled : Sample rate every 2 frames \r\n");

#endif

It already declare the cache.