I moved most of my code to a library but one particular function call gives me an error when compiling.
This is the function needed for the timerAttachInterrupt():
Code: Select all
void IRAM_ATTR TriggerTimer::cdInterrupt(){
//some codes
}
This is how I used the attachTimerInterrupt() function:
Code: Select all
void TriggerTimer::startTimer(){
timer = timerBegin(0, 80, true);
timerAttachInterrupt(timer, &cdInterrupt, true);
timerAlarmWrite(timer, 1000000, true);
timerAlarmEnable(timer);
}
The compiler forbids me taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. It suggests me to use &TriggerTimer::cdInterrupt as a parameters which also gives me an error because the timerAttachInterrupt expects void(*)() and not void(TriggerTimer*)(). How do I solve this problem?