cancel
Showing results for 
Search instead for 
Did you mean: 

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.

SPate.4
Associate II

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*)'".

1 REPLY 1
MM..1
Chief II

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();
}