-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need .on('rise') and .on('fall') events for pins #69
Comments
I'm going to take a crack it this :) |
Adding some details from @kevinmehall on Slack, in case they're useful:
|
That's definitely helpful—thanks! |
@johnnyman727 @kevinmehall when you say
Do you specifically mean in t2-firmware/node/tessel.js? I'm trying to understand how that plays with the documented capabilities: http://asf.atmel.com/docs/3.17.0/samd21/html/group__asfdoc__sam0__extint__group.html |
I believe what @kevinmehall was saying is that the SAMD21 has no notion of |
The latter is clear, but regarding the former—I'm confused, because the docs appear to contradict. |
The hardware can give you an interrupt on one of rise, fall or change, but it can't give you an interrupt for both rise and fall separately. Firmware could read the pin on the |
Got it, thanks for the clarification |
I take it the t1 could do both rise and fall at the same time? Did the t1 have a change event? So what's the way forward? I see two fighting concerns.
With two different solutions
I'd lean towards 1 because it's more friendly to most users but I don't know how frustrating it would be people who wouldn't want the behavior |
This is a good summary, and I'd lean towards solution 1 for the same reasons. Thanks for looking into this! |
Rereading @kevinmehall's comments. I'm scared about missed events. If the change interrupt was pending and it changed again, would we get one or two change interrupts from the socket? |
checking back on this - do we have .rise and .fall events now? Lots of people asking for PIR support |
It looks like we do. I believe @dudleyjosh has already been using them. |
There are It is my understanding that there is a limitation of one interrupt allowed per pin and only one of the events can be used at a time so most end use cases would probably call for an pin.on('change', function() {
this.rawRead(function(err, val) {
if ( val === 0 ) {
console.log('fall', val);
}
else {
console.log('rise', val);
}
});
}); There is also still an issue with doing a regular Starting with firmware v0.0.12 (thanks to @rwaldron), the pin pin.on('change', function(val) {
if ( val === 0 ) {
console.log('fall', val);
}
else {
console.log('rise', val);
}
}); Question: Even though there is a hardware limitation of one interrupt per pin, once the |
I think that's a totally reasonable idea. @dudleyjosh want to give a go at implementing it? |
@johnnyman727 I will give it a shot over the weekend :) |
New to hardware hacking and just got a Tessel 2. Would love to figure out how to attach a button to it! Commenting here to say hello beautiful community hackers and so I can follow along in conversation. I got one of these: https://www.sparkfun.com/products/11274 |
@yesplease I'd take a look at http://johnny-five.io/api/button/ as it's works well with the tessel and gives you a lot of examples and circuit diagrams to follow. |
To maintain back-compatibility.
Relevant to tessel/hardware-modules#5
Is this best solved with a state variable?
The text was updated successfully, but these errors were encountered: