[Gambas-user] Shared WiringPi library for RasPi

Benoît Minisini gambas at ...1...
Mon Feb 18 10:35:23 CET 2013


Le 18/02/2013 10:12, Christer Johansson a écrit :
> Now a question to all the C pro's... I'm hoping to be able to get HW
> interrupts working on the GPIO with Gambas 3. Declaring delay() above
> was easy enough but the interrupt function looks like...
>
>    int wiringPiISR (int pin, int edgeType, void (*function)(void));
>
> So how do you declare the above in Gambas 3? I.e register a function that
> will be called to handle the interrupt? Any pointers appreciated...
>

Extern wiringPiIsr(iPin As Integer, iEdgeType As Integer, pFunction As 
Pointer) In "lib..."

...

And then you use the name of a static function as 'pFunction' argument 
when calling wiringPiIsr.

Gambas will automatically create a internal callback that will execute 
the Gambas function through the interpreter as if it would be called 
directly like a C function.

Regards,

-- 
Benoît Minisini




More information about the User mailing list