libreria para el manejo de entradas
Dependents: Prueba_Ascensor Ascensor NewAscensor
DebouncedIn.h@0:1ad8929cc2b4, 2017-06-06 (annotated)
- Committer:
- jclondonol
- Date:
- Tue Jun 06 15:24:02 2017 +0000
- Revision:
- 0:1ad8929cc2b4
listo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jclondonol | 0:1ad8929cc2b4 | 1 | #include "mbed.h" |
jclondonol | 0:1ad8929cc2b4 | 2 | |
jclondonol | 0:1ad8929cc2b4 | 3 | class DebouncedIn { |
jclondonol | 0:1ad8929cc2b4 | 4 | public: |
jclondonol | 0:1ad8929cc2b4 | 5 | DebouncedIn(PinName in); |
jclondonol | 0:1ad8929cc2b4 | 6 | |
jclondonol | 0:1ad8929cc2b4 | 7 | int read (void); |
jclondonol | 0:1ad8929cc2b4 | 8 | operator int(); |
jclondonol | 0:1ad8929cc2b4 | 9 | |
jclondonol | 0:1ad8929cc2b4 | 10 | int rising(void); |
jclondonol | 0:1ad8929cc2b4 | 11 | int falling(void); |
jclondonol | 0:1ad8929cc2b4 | 12 | int steady(void); |
jclondonol | 0:1ad8929cc2b4 | 13 | |
jclondonol | 0:1ad8929cc2b4 | 14 | private : |
jclondonol | 0:1ad8929cc2b4 | 15 | // objects |
jclondonol | 0:1ad8929cc2b4 | 16 | DigitalIn _in; |
jclondonol | 0:1ad8929cc2b4 | 17 | Ticker _ticker; |
jclondonol | 0:1ad8929cc2b4 | 18 | |
jclondonol | 0:1ad8929cc2b4 | 19 | // function to take a sample, and update flags |
jclondonol | 0:1ad8929cc2b4 | 20 | void _sample(void); |
jclondonol | 0:1ad8929cc2b4 | 21 | |
jclondonol | 0:1ad8929cc2b4 | 22 | // counters and flags |
jclondonol | 0:1ad8929cc2b4 | 23 | int _samples; |
jclondonol | 0:1ad8929cc2b4 | 24 | int _output; |
jclondonol | 0:1ad8929cc2b4 | 25 | int _output_last; |
jclondonol | 0:1ad8929cc2b4 | 26 | int _rising_flag; |
jclondonol | 0:1ad8929cc2b4 | 27 | int _falling_flag; |
jclondonol | 0:1ad8929cc2b4 | 28 | int _state_counter; |
jclondonol | 0:1ad8929cc2b4 | 29 | |
jclondonol | 0:1ad8929cc2b4 | 30 | }; |