Authorised Reseller
Authorised Reseller
Posts: 225
Joined: Tue Feb 26, 2013 6:59 am

wiringPi- exporting pins from within app + some suggestions

Fri Apr 26, 2013 4:55 pm

Hi. First of all, thanks to Gordon for the great wiringPi lib. I´ve just began working on the "inputs" side of my application, using the interrupts feature of the lib, and everything is working as expected. But I have one small question:

The library´s documentation for the wiringPiISR(...) function states this:

"This function registers a function to received interrupts on the specified pin. The edgeType parameter is either INT_EDGE_FALLING, INT_EDGE_RISING, INT_EDGE_BOTH or INT_EDGE_SETUP. If it is INT_EDGE_SETUP then no initialisation of the pin will happen – it’s assumed that you have already setup the pin elsewhere (e.g. with the gpio program)..."

Is there a way to setup the pins to any of the edgeType values from within a c++ application, without having to call the external gpio program, in such away that if I call wiringPiISR with the INT_EDGE_SETUP parameter it just works?

Now a couple of suggestions (some of them I´ve already seem elsewhere):

1. It would be nice if the callback function could include the calling pin number. That would save having one function for each input pin.

2. It would be nice if the callback function could also include some time information, so we can know with a certain degree of accuracy when (in microseconds since epoch/start of the system/etc) the interrupt was requested. I know I can just call gettimeofday(...) in my callback, but it would be nice to get that information automatically from the lib.

Thanks again for this great lib!

Return to “C/C++”