Open n9 opened 9 years ago
Hi, it sound's interesting. I will have a look at epoll.
@n9
you could share your code using node-ffi and fs.whatch ?
Yes:
async void EnsureInputWatcher()
{
if (inputWatcher != null)
return;
while (lib.pifacedigital_enable_interrupts() != 0)
{
await Task.Delay(100);
}
if (inputWatcher != null)
return;
var lastValue = lib.pifacedigital_read_reg(INPUT, hwAddress);
inputWatcher = FS.Watch(GPIO_INTERRUPT_PIN_VALUE, (e, f) =>
{
var currentValue = lib.pifacedigital_read_reg(INPUT, hwAddress);
if (currentValue != lastValue)
{
HandleWatchInput(currentValue, lastValue);
lastValue = currentValue;
}
});
}
(It is not in plain JavaScript. It's written in C#.)
Are you going to use interrupts in the watch function? (Maybe using epoll for nodejs.)