[beagleboard] How to write attachInterrupt in BoneScript in details.

2014-03-05 Thread masterplays555
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 my*handler  *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.

 

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [beagleboard] How to write attachInterrupt in BoneScript in details.

2014-03-05 Thread George Lu
You could use button.watch() in onoff in place of attachInterrrupt.  See
https://www.npmjs.org/package/onoff.


On Wed, Mar 5, 2014 at 2:00 PM,  wrote:

> 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 my*handler  *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.
>
>
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.