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
DebounceInterrupts.h@2:a50151994483, 2014-02-18 (annotated)
- Committer:
- kandangath
- Date:
- Tue Feb 18 02:59:41 2014 +0000
- Revision:
- 2:a50151994483
- Parent:
- 1:ffacad1b455a
- Child:
- 3:e4b7033508d1
Readability changes
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kandangath | 0:ca5a0fee9f52 | 1 | |
| kandangath | 0:ca5a0fee9f52 | 2 | /** |
| kandangath | 1:ffacad1b455a | 3 | * Debounces an InterruptIn |
| kandangath | 0:ca5a0fee9f52 | 4 | */ |
| kandangath | 0:ca5a0fee9f52 | 5 | |
| kandangath | 0:ca5a0fee9f52 | 6 | #ifndef DEBOUNCE_INTERRUPTS_H |
| kandangath | 0:ca5a0fee9f52 | 7 | #define DEBOUNCE_INTERRUPTS_H |
| kandangath | 0:ca5a0fee9f52 | 8 | |
| kandangath | 0:ca5a0fee9f52 | 9 | #include <stdint.h> |
| kandangath | 0:ca5a0fee9f52 | 10 | #include "mbed.h" |
| kandangath | 0:ca5a0fee9f52 | 11 | |
| kandangath | 0:ca5a0fee9f52 | 12 | class DebounceInterrupts { |
| kandangath | 0:ca5a0fee9f52 | 13 | private: |
| kandangath | 0:ca5a0fee9f52 | 14 | unsigned int fDebounce_us; |
| kandangath | 0:ca5a0fee9f52 | 15 | void (*fCallback)(void); |
| kandangath | 0:ca5a0fee9f52 | 16 | void onInterrupt(void); |
| kandangath | 0:ca5a0fee9f52 | 17 | public: |
| kandangath | 2:a50151994483 | 18 | DebounceInterrupts(void (*fptr)(void), /* function to be called after debounced InterruptIn */ |
| kandangath | 2:a50151994483 | 19 | InterruptIn *interrupt, /* InterruptIn to monitor */ |
| kandangath | 2:a50151994483 | 20 | const bool& rise=true, /* true: rise, false: fall */ |
| kandangath | 2:a50151994483 | 21 | const uint32_t& debounce_ms=10); /* stability duration required */ |
| kandangath | 0:ca5a0fee9f52 | 22 | ~DebounceInterrupts(); |
| kandangath | 0:ca5a0fee9f52 | 23 | }; |
| kandangath | 0:ca5a0fee9f52 | 24 | #endif |