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 20:996ea2fc8d2d, committed 2014-02-21
- Comitter:
- kandangath
- Date:
- Fri Feb 21 16:50:56 2014 +0000
- Parent:
- 19:d12a5b89ac3a
- Child:
- 21:34b95e1b2bf3
- Commit message:
- Updated Documentation
Changed in this revision
DebouncedInterrupt.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DebouncedInterrupt.h Wed Feb 19 03:30:52 2014 +0000 +++ b/DebouncedInterrupt.h Fri Feb 21 16:50:56 2014 +0000 @@ -1,7 +1,21 @@ + +#ifndef DEBOUNCED_INTERRUPT_H +#define DEBOUNCED_INTERRUPT_H + +#include <stdint.h> +#include "mbed.h" + +/** +typedef enum { + IRQ_NONE, + IRQ_RISE, + IRQ_FALL +} gpio_irq_event; +**/ /** A replacement for InterruptIn that debounces the interrupt - * Anil Kandangath * + * Example: * @code * * #include "DebouncedInterrupt.h" @@ -22,21 +36,6 @@ * } * @endcode */ - -#ifndef DEBOUNCED_INTERRUPT_H -#define DEBOUNCED_INTERRUPT_H - -#include <stdint.h> -#include "mbed.h" - -/** -typedef enum { - IRQ_NONE, - IRQ_RISE, - IRQ_FALL -} gpio_irq_event; -**/ - class DebouncedInterrupt { private: unsigned int _debounce_us;