gptcallback_t as non-static method of class

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Alex
Posts: 33
Joined: Sat Feb 22, 2014 2:40 pm
Been thanked: 3 times

gptcallback_t as non-static method of class

Postby Alex » Wed Sep 20, 2017 9:24 am

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*)}'

Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 9 guests