我想为 Galileo 使用 node.js mraa 库。我需要设置一个中断。我通过以下方式实现这一目标:
var param=1;
var myLed = new mraa.Gpio(2);
myLed.dir(mraa.DIR_IN); //set the gpio direction to input
myLed.isr(mraa.EDGE_BOTH,function f(x){},param );
我得到这个错误
in method 'Gpio_isr', argument 3 of type 'void (*)(void *)'
此功能的文档说明
mraa_result_t isr ( Edge mode,
void(*)(void *) fptr,
void * args
)
Sets a callback to be called when pin value changes
Parameters
mode The edge mode to set
fptr Function pointer to function to be called when interupt is triggered
args Arguments passed to the interrupt handler (fptr)
Returns
Result of operation
我不知道如何设置函数的参数...