Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to connect a C function into a class ( int wiringPiISR (int pin, int mode, void (*function)(void)) )
Forum Updated to NodeBB v4.3 + New Features

How to connect a C function into a class ( int wiringPiISR (int pin, int mode, void (*function)(void)) )

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JPannetier
    wrote on 5 Mar 2017, 09:35 last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 5 Mar 2017, 09:39 last edited by mrjj 3 May 2017, 09:40
      #2

      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 )

      1 Reply Last reply
      2
      • J Offline
        J Offline
        JPannetier
        wrote on 5 Mar 2017, 10:20 last edited by
        #3

        Hello MRJJ,
        You are fast;)

        It's working , top :)

        1 Reply Last reply
        0

        1/3

        5 Mar 2017, 09:35

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved