Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: D7A_Demo-Get-started CVtoOSCConverter EE3501keypad D7A_Localisation ... more
Fork of DebouncedInterrupt by
DebounceInterrupts.cpp
- Committer:
- kandangath
- Date:
- 2014-02-18
- Revision:
- 3:e4b7033508d1
- Parent:
- 0:ca5a0fee9f52
- Child:
- 4:19689187352e
File content as of revision 3:e4b7033508d1:
#include "DebounceInterrupts.h"
Timeout timeout;
DebounceInterrupts::DebounceInterrupts(void (*fptr)(void),
InterruptIn *interruptIn,
const bool& rise,
const unsigned int& debounce_ms)
{
fCallback = fptr;
if (rise) {
interruptIn->rise(this, &DebounceInterrupts::_onInterrupt);
} else {
interruptIn->fall(this, &DebounceInterrupts::_onInterrupt);
}
fDebounce_us = 1000*debounce_ms;
}
DebounceInterrupts::~DebounceInterrupts()
{
}
void DebounceInterrupts::_onInterrupt()
{
timeout.detach();
timeout.attach_us(fCallback,fDebounce_us);
}
