A replacement for InterruptIn that debounces the interrupt.
Dependents: D7A_Demo-Get-started CVtoOSCConverter EE3501keypad D7A_Localisation ... more
Fork of DebouncedInterrupt by
Example code:
#include "DebouncedInterrupt.h" DebouncedInterrupt up_button(USER_BUTTON); void onUp() { // Do Something } int main() { // Will immediatly call function and ignore other interrupts until timeout up_button.attach(&onUp, IRQ_FALL, 1000, true); // Will call function only if button has been held for the specified time //up_button.attach(&onUp, IRQ_FALL, 500, false); while(1) {} }
Revision 16:7eaa188de0f9, committed 2014-02-18
- Comitter:
- kandangath
- Date:
- Tue Feb 18 20:22:31 2014 +0000
- Parent:
- 15:948e85b22efe
- Child:
- 17:96a51b236ba0
- Commit message:
- Default value for interrupt trigger
Changed in this revision
DebouncedInterrupt.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DebouncedInterrupt.h Tue Feb 18 20:18:12 2014 +0000 +++ b/DebouncedInterrupt.h Tue Feb 18 20:22:31 2014 +0000 @@ -52,7 +52,7 @@ ~DebouncedInterrupt(); // Start monitoring the interupt and attach a callback - void attach(void (*fptr)(void), const interruptTrigger& trigger, const uint32_t& debounce_ms=10); + void attach(void (*fptr)(void), const interruptTrigger& trigger=INT_FALL, const uint32_t& debounce_ms=10); // Stop monitoring the interrupt void reset();