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: Microwave_MBED MicrowaveSimulation_LPC1768 RTOS_Alarm_Clock USB_Project_Host ... more
Diff: DebouncedInterrupt.cpp
- Revision:
- 14:da09706b92f5
- Parent:
- 13:09b53a088a9c
- Child:
- 17:96a51b236ba0
diff -r 09b53a088a9c -r da09706b92f5 DebouncedInterrupt.cpp
--- a/DebouncedInterrupt.cpp Tue Feb 18 16:51:44 2014 +0000
+++ b/DebouncedInterrupt.cpp Tue Feb 18 17:26:42 2014 +0000
@@ -8,10 +8,13 @@
DebouncedInterrupt::DebouncedInterrupt(PinName pin)
{
_in = new InterruptIn(pin);
+ _din = new DigitalIn(pin);
}
DebouncedInterrupt::~DebouncedInterrupt()
{
+ delete _in;
+ delete _din;
}
void DebouncedInterrupt::attach(void (*fptr)(void),
@@ -51,7 +54,9 @@
{
_last_bounce_count = _bounce_count;
_bounce_count = 0;
- fCallback();
+ if(_din) {
+ fCallback();
+ }
}
void DebouncedInterrupt::_onInterrupt()