![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Tarea #4 encoder con sonido al utilizar el pulsador
Dependencies: QEI TextLCD-modificada mbed
Fork of Tarea4 by
DebouncedIn.h@0:d7388a87aeb7, 2013-11-15 (annotated)
- Committer:
- salondonog
- Date:
- Fri Nov 15 17:45:21 2013 +0000
- Revision:
- 0:d7388a87aeb7
encoder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
salondonog | 0:d7388a87aeb7 | 1 | #include "mbed.h" |
salondonog | 0:d7388a87aeb7 | 2 | |
salondonog | 0:d7388a87aeb7 | 3 | class DebouncedIn { |
salondonog | 0:d7388a87aeb7 | 4 | public: |
salondonog | 0:d7388a87aeb7 | 5 | DebouncedIn(PinName in); |
salondonog | 0:d7388a87aeb7 | 6 | |
salondonog | 0:d7388a87aeb7 | 7 | int read (void); |
salondonog | 0:d7388a87aeb7 | 8 | operator int(); |
salondonog | 0:d7388a87aeb7 | 9 | |
salondonog | 0:d7388a87aeb7 | 10 | int rising(void); |
salondonog | 0:d7388a87aeb7 | 11 | int falling(void); |
salondonog | 0:d7388a87aeb7 | 12 | int steady(void); |
salondonog | 0:d7388a87aeb7 | 13 | |
salondonog | 0:d7388a87aeb7 | 14 | private : |
salondonog | 0:d7388a87aeb7 | 15 | // objects |
salondonog | 0:d7388a87aeb7 | 16 | DigitalIn _in; |
salondonog | 0:d7388a87aeb7 | 17 | Ticker _ticker; |
salondonog | 0:d7388a87aeb7 | 18 | |
salondonog | 0:d7388a87aeb7 | 19 | // function to take a sample, and update flags |
salondonog | 0:d7388a87aeb7 | 20 | void _sample(void); |
salondonog | 0:d7388a87aeb7 | 21 | |
salondonog | 0:d7388a87aeb7 | 22 | // counters and flags |
salondonog | 0:d7388a87aeb7 | 23 | int _samples; |
salondonog | 0:d7388a87aeb7 | 24 | int _output; |
salondonog | 0:d7388a87aeb7 | 25 | int _output_last; |
salondonog | 0:d7388a87aeb7 | 26 | int _rising_flag; |
salondonog | 0:d7388a87aeb7 | 27 | int _falling_flag; |
salondonog | 0:d7388a87aeb7 | 28 | int _state_counter; |
salondonog | 0:d7388a87aeb7 | 29 | |
salondonog | 0:d7388a87aeb7 | 30 | }; |
salondonog | 0:d7388a87aeb7 | 31 |