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) {} }
Diff: DebouncedInterrupt.cpp
- Revision:
- 24:4e095ebbcfad
- Parent:
- 23:cd4042093f85
- Child:
- 25:2163ebb21aef
--- a/DebouncedInterrupt.cpp Thu Nov 19 15:37:39 2015 +0000 +++ b/DebouncedInterrupt.cpp Thu Nov 19 17:43:15 2015 +0000 @@ -2,7 +2,6 @@ * DebouncedInterrupt.cpp **/ #include "DebouncedInterrupt.h" -#include "dbg.h" DebouncedInterrupt::DebouncedInterrupt(PinName pin)