Library for debouncing inputs, originally by Andres Mora Bedoya. Updated to include PinMode capability and class documentation.
Fork of DebouncedIn by
Diff: DebouncedIn.h
- Revision:
- 0:dc1131de43e8
- Child:
- 1:7b8a80c09b8c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DebouncedIn.h Tue Nov 05 19:29:03 2013 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" + + class DebouncedIn { + public: + DebouncedIn(PinName in); + + int read (void); + operator int(); + + int rising(void); + int falling(void); + int steady(void); + + private : + // objects + DigitalIn _in; + Ticker _ticker; + + // function to take a sample, and update flags + void _sample(void); + + // counters and flags + int _samples; + int _output; + int _output_last; + int _rising_flag; + int _falling_flag; + int _state_counter; + + }; \ No newline at end of file