A replacement for InterruptIn that debounces the interrupt.

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

Fork of DebouncedInterrupt by Anil Kandangath

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

Changes

RevisionDateWhoCommit message
26:2df374d23986 2017-04-27 Jeej Updated deprecated callback. default tip
25:2163ebb21aef 2017-04-26 Jeej Use mbed callback
24:4e095ebbcfad 2015-11-19 Jeej Cleanup.
23:cd4042093f85 2015-11-19 Jeej Fixed Timeout bug that appeared on NUCLEO-L152RE (don't know about other platforms) after mbed update.; Added the possibility to trigger the callback immediately at the interrupt.
22:9733f886810a 2014-02-25 kandangath Modifications to template version for member functions
21:34b95e1b2bf3 2014-02-25 kandangath Added option to attach to a class member
20:996ea2fc8d2d 2014-02-21 kandangath Updated Documentation
19:d12a5b89ac3a 2014-02-19 kandangath A bit more code cleanup
18:e6e9bc6402b7 2014-02-19 kandangath Support checking rise and fall of signals
17:96a51b236ba0 2014-02-18 kandangath Monitor both rising and falling edges
16:7eaa188de0f9 2014-02-18 kandangath Default value for interrupt trigger
15:948e85b22efe 2014-02-18 kandangath Updates
14:da09706b92f5 2014-02-18 kandangath Also poll pin value at the end of the debounce period
13:09b53a088a9c 2014-02-18 kandangath Change member function
12:7022ffaa74f5 2014-02-18 kandangath Voila! volatile!
11:af6d7dc34062 2014-02-18 kandangath Add documentation
10:cb16d2957f8d 2014-02-18 kandangath Allow DebouncedInterrupt to be set with just the PinName
9:970b74eb0407 2014-02-18 kandangath Oops, uninitialized variable! Not good news.
8:4b3ff16d5f91 2014-02-18 kandangath lock debounce count
7:2d73e219dadf 2014-02-18 kandangath Add counter for debounced interrupts
6:e1461ccdf3c0 2014-02-18 kandangath Remove unnecessary detach
5:3c0f741fb448 2014-02-18 kandangath Added example usage
4:19689187352e 2014-02-18 kandangath Add enum for interrupt trigger
3:e4b7033508d1 2014-02-18 kandangath Cleanup
2:a50151994483 2014-02-18 kandangath Readability changes
1:ffacad1b455a 2014-02-18 kandangath Comment cleanup
0:ca5a0fee9f52 2014-02-18 kandangath Init version of class to debounce InterruptIn