How to write attachInterrupt in BoneScript in details.

Hi, forks!!

I have some questions about attachInterrupt.

I saw the topic
attachInterrupt contents called on startup and stop without event triggered

https://groups.google.com/forum/#!topic/beagleboard/bhacfUnNJYM

Q1:
I think one of solution is check actual button has pushed or not.

b.attachInterrupt(inputPin, true, b.FALLING, interruptCallback);
function interruptCallback() {
if (b.digitalRead(inputPin)===1) return; // Is the real button pushed? or not?

But in this case, the function interruptCallback tightly depend on hardware ,so I can’t reuse it call from another functions (for example WEB interrupt logic).
It seems not good solution.

Is there any solution more smart?

Q2:
http://beagleboard.org/Support/BoneScript/attachInterrupt/

I guess the result of handler can determine to interruptCallback execute or not.
But when my function myhandler always return true, interruptCallback never called…

b.attachInterrupt(inputPin, myhandler, b.FALLING, interruptCallback);

function myhandler(){
return true;
}

Could you tell me what is wrong, Please!

Thanks.

You could use button.watch() in onoff in place of attachInterrrupt. See https://www.npmjs.org/package/onoff.