@amina
I posted this in an other forum because it has been a while that I am stuck and it has to be fixed .. I am going to share the solution it may help someone https://stackoverflow.com/questions/66869600/timer-couldnt-work-with-wiringpiisr-qtquick-application/66873812?noredirect=1#comment118230663_66873812
static instances of QObject are also not supported
so the instance vitesse should be created after QApplication.
this will fix the problem :
static void isrInput_vitesse();
static Capteur_Input *vitesse = nullptr;
static void isrInput_vitesse()
{
if(!vitesse) //not initialized yet
return;
QMetaObject::invokeMethod( vitesse, "isrCallback", Qt::QueuedConnection ); //or blockingQueue if you need to handle it directly in Qt way.
}
and in the main fucntion int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//..... your main application body
vitesse = new Capteur_Input(Pin_vitesse,PUD_OFF,INT_EDGE_RISING,isrInput_vitesse);
ctx->setContextProperty("vitesse", vitesse);
//...
}
the function isrCallback should be a slot