Skip to main content
SPate.4
Associate II
December 20, 2020
Question

I have tried to create a thread from a member function. Is there a proper way to do this? I attached the source and header files for the class I was doing this in.

  • December 20, 2020
  • 1 reply
  • 1076 views

I am trying to assign a member function to a thread, but when I do, I get an error saying "invalid use of non-static member function 'void AudioPlayer::AudioThread(const void*)'".

This topic has been closed for replies.

1 reply

MM..1
Chief III
December 20, 2020

You mix C and C++

i mean your h file is better name hpp.

And for start as thread you need C wrapper function inspire here

extern "C" void touchgfx_init();
extern "C" void touchgfx_taskEntry();
 
static STM32TouchController tc;
static STM32F4DMA dma;
static LCD24bpp display;
static ApplicationFontProvider fontProvider;
static Texts texts;
static TouchGFXHAL hal(dma, display, tc, 480, 1280);
 
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();
}
 
void touchgfx_taskEntry()
{
 /*
 * Main event loop. Will wait for VSYNC signal, and then process next frame. Call
 * this function from your GUI task.
 *
 * Note This function never returns
 */
 hal.taskEntry();
}