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