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