Debounce InterruptIn

Dependents:   led_sigfox Allumag_lampe_sigfox Case_study_02_Turnstile B18_MP3_PLAYER ... more

DebounceInterrupts.h

Committer:
kandangath
Date:
2014-02-18
Revision:
2:a50151994483
Parent:
1:ffacad1b455a
Child:
3:e4b7033508d1

File content as of revision 2:a50151994483:


/**
 * Debounces an InterruptIn
 */
 
#ifndef DEBOUNCE_INTERRUPTS_H
#define DEBOUNCE_INTERRUPTS_H

#include <stdint.h>
#include "mbed.h"

class DebounceInterrupts {
private:
    unsigned int fDebounce_us;
    void (*fCallback)(void);
    void onInterrupt(void);
public:
    DebounceInterrupts(void (*fptr)(void),              /* function to be called after debounced InterruptIn */
                       InterruptIn *interrupt,          /* InterruptIn to monitor */
                       const bool& rise=true,           /* true: rise, false: fall */
                       const uint32_t& debounce_ms=10); /* stability duration required */
    ~DebounceInterrupts();
};
#endif