Page 1 of 1

gptcallback_t as non-static method of class

Posted: Wed Sep 20, 2017 9:24 am
by Alex
How to use spicallback_t and gptcallback_t as non-static method of class?

Code: Select all

private:
   gptcnt_t interval;
   void gpt_cb(GPTDriver *gptp);
   void spi_cb(SPIDriver *spip);
   SPIConfig spi_cfg = {spi_cb, 0, 4, SPI_CR1_BR_0  | SPI_CR1_BR_1   };
   GPTConfig gpt_cfg = {1000000, gpt_cb, 0, 0};


in my case compiler say:

Code: Select all

TBaseChannel.h:32:44: error: cannot convert 'TBaseChannel::gpt_cb' from type 'void (TBaseChannel::)(GPTDriver*)' to type 'gptcallback_t {aka void (*)(GPTDriver*)}'