h
Dependencies: QEI RTC-DS1307 TextLCD mbed
DebouncedIn.h@0:448768f23e05, 2017-11-29 (annotated)
- Committer:
- Gambetica
- Date:
- Wed Nov 29 01:30:37 2017 +0000
- Revision:
- 0:448768f23e05
h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gambetica | 0:448768f23e05 | 1 | #include "mbed.h" |
Gambetica | 0:448768f23e05 | 2 | |
Gambetica | 0:448768f23e05 | 3 | class DebouncedIn { |
Gambetica | 0:448768f23e05 | 4 | public: |
Gambetica | 0:448768f23e05 | 5 | DebouncedIn(PinName in); |
Gambetica | 0:448768f23e05 | 6 | |
Gambetica | 0:448768f23e05 | 7 | int read (void); |
Gambetica | 0:448768f23e05 | 8 | operator int(); |
Gambetica | 0:448768f23e05 | 9 | |
Gambetica | 0:448768f23e05 | 10 | int rising(void); |
Gambetica | 0:448768f23e05 | 11 | int falling(void); |
Gambetica | 0:448768f23e05 | 12 | int steady(void); |
Gambetica | 0:448768f23e05 | 13 | |
Gambetica | 0:448768f23e05 | 14 | private : |
Gambetica | 0:448768f23e05 | 15 | // objects |
Gambetica | 0:448768f23e05 | 16 | DigitalIn _in; |
Gambetica | 0:448768f23e05 | 17 | Ticker _ticker; |
Gambetica | 0:448768f23e05 | 18 | |
Gambetica | 0:448768f23e05 | 19 | // function to take a sample, and update flags |
Gambetica | 0:448768f23e05 | 20 | void _sample(void); |
Gambetica | 0:448768f23e05 | 21 | |
Gambetica | 0:448768f23e05 | 22 | // counters and flags |
Gambetica | 0:448768f23e05 | 23 | int _samples; |
Gambetica | 0:448768f23e05 | 24 | int _output; |
Gambetica | 0:448768f23e05 | 25 | int _output_last; |
Gambetica | 0:448768f23e05 | 26 | int _rising_flag; |
Gambetica | 0:448768f23e05 | 27 | int _falling_flag; |
Gambetica | 0:448768f23e05 | 28 | int _state_counter; |
Gambetica | 0:448768f23e05 | 29 | |
Gambetica | 0:448768f23e05 | 30 | }; |
Gambetica | 0:448768f23e05 | 31 |