Solved How to connect a C function into a class ( int wiringPiISR (int pin, int mode, void (*function)(void)) )
-
Hello ,
I'm using WiringPi librairy with my Raspberry Pi 3
I have a class Form_Trigger_Laser
My function to connect my interrupt from WiringPi
void Form_Trigger_Laser::InitWiringPiLaser()
{wiringPiISR(1,INT_EDGE_FALLING,&Edge_Falling_Laser());
}
void Form_Trigger_Laser::Edge_Falling_Laser()
{
B_StatusLed=false;
ui->Widget_Led_Laser_Status->setStyleSheet("border-image:url(:/Ressource/red-led-off-md.png)");
SendLaserTrigger();
}Nevertheless, the prototype of wiringPiISR is :
int wiringPiISR (int pin, int mode, void (*function)(void))I can't connect at my function Class ...
How to connect : int wiringPiISR (int pin, int mode, void (*function)(void)) at Form_Trigger_Laser::Edge_Falling_Laser() ?Thank you
Best regard -
Hi
From Very fast look it seems like it wants a good old plain c call back?void (*function)(void)
So you must use a global function or a static class function for it to like it.
The function must be
void FuncName(void)
So no return or parameter.
so void Form_Trigger_Laser::InitWiringPiLaser()
cannot be part of class. ( or must be static ) -
Hello MRJJ,
You are fast;)It's working , top :)