A replacement for InterruptIn that debounces the interrupt.

Dependents:   D7A_Demo-Get-started CVtoOSCConverter EE3501keypad D7A_Localisation ... more

Fork of DebouncedInterrupt by Anil Kandangath

Embed: (wiki syntax)

« Back to documentation index

DebouncedInterrupt Class Reference

DebouncedInterrupt Class Reference

typedef enum { IRQ_NONE, IRQ_RISE, IRQ_FALL } gpio_irq_event; More...

#include <DebouncedInterrupt.h>

Public Member Functions

 DebouncedInterrupt (PinName pin)
 DebouncedInterrupt.cpp.

Detailed Description

typedef enum { IRQ_NONE, IRQ_RISE, IRQ_FALL } gpio_irq_event;

A replacement for InterruptIn that debounces the interrupt

Example:

 #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) {
         ...
     }
 }

Definition at line 44 of file DebouncedInterrupt.h.


Constructor & Destructor Documentation

DebouncedInterrupt ( PinName  pin )

DebouncedInterrupt.cpp.

Definition at line 7 of file DebouncedInterrupt.cpp.