To this end, I am writing APL cover functions that allow direct access to these functions from APL without the need of writing any C code. I already have the I2C interface working well.
This library contains a function (called gpioSetAlertFunc) that triggers a call-back function when a GPIO pin changes "level" (switches form 0 to 1 or 1 to 0).
From Dyalog HELP on Name Association:
Callbacks (∇)
Currently, support for a ⎕NA function to call an APL function is limited to the use of the NAG (National Algorithms Group) library of functions. This library is a FORTRAN library and FORTRAN passes arguments by reference (address) rather than by value. The expression:
∇f8←(P P P P)
declares a callback function that returns a double and takes 4 pointer arguments. The result can be any of the normal results. It is not possible to return a pointer. The arguments can be from 0 to 16 P values.
The argument when passed can be the name of an APL function or the ⎕OR of a function.
This appears to be saying that I can't ⎕NA call gpioSetAlertFunc with a callback to an APL function, because it (gpioSetAlertFunc) is not in the NAG library.
Use of callback functions is desirable when accurate timings are required, (such as when timing ultrasound "sonar" echos to measure distances to sub-centimeter accuracy).
Can anyone suggest a work around?
Thanks