cancel
Showing results for 
Search instead for 
Did you mean: 

how can i use touchgfx_generic_init in cubemxide STM32F429I_DISC1

DLee.4
Associate

Hi all.

I used STM32CubeIDE 1.3.0 with TouchGFX 4.13.0 Designer on STM32F429I_DISC1.

I am testing load bmp file from USB disk. project is made from cubeide.

I followed below doc.

touchgfx-engine-features/caching-bitmaps

and i added touchgfx_generic_init into TouchGFXConfiguration.cpp.

uint16_t* cacheStartAddr = (uint16_t*)0xD0030000;
uint32_t cacheSize = 0x300000; //3 MB, as example
 
void touchgfx_init()
{
  Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(), BitmapDatabase::getInstanceSize());
  TypedText::registerTexts(&texts);
  Texts::setLanguage(0);
 
  FontManager::setFontProvider(&fontProvider);
 
  FrontendHeap& heap = FrontendHeap::getInstance();
  (void)heap; // we need to obtain the reference above to initialize the frontend heap.
 
 hal.initialize();
HAL& hal = touchgfx_generic_init<TouchGFXHAL>(dma, display, tc, 240, 320, cacheStartAddr, cacheSize, 1);
}

but it makes some errors and memory full, anyway i tried but could not.

so i founded function Bitmap::setCache.

Bitmap::setCache((uint16_t*)cacheStartAddr, cacheSize, 30);
bmpId = Bitmap::dynamicBitmapCreate(240, 320, Bitmap::RGB565);

it is working well..

but i want to know how to use touchgfx_generic_init function.

and now i want to know that Bitmap::setCache is correct way or not.

source code is attached. 

actually i have used just c language for a long time. i have not used c++ language.

and this code is test code. so source code is not good for sharing to others.

please consider that

but let me know how to add touchgfx_generic_init function into source code.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

touchgfx_generic_init() will call registerBitmapDataBase() will call setCache() - So you're doing it right :) You can use Bitmap::setCache() to update your configuration.

/Martin

View solution in original post

2 REPLIES 2
Martin KJELDSEN
Chief III

touchgfx_generic_init() will call registerBitmapDataBase() will call setCache() - So you're doing it right :) You can use Bitmap::setCache() to update your configuration.

/Martin

Thanks Martin for your reply.

Yes .touchgfx_gerenic_init() will call registerBitmapDataBase(). but registerBitmapDataBase looks like to be packed as libaray.

Ok. i will use setCache(). it is ok.

i think. it does not matter to use touchgfx_generic_init(). becuase I just want to draw BMP file. Ok..

Thanks very much for your kindly.