jj

Dependencies:   mbed

Fork of VOLTIMETRO1 by d.a. santana

Committer:
Christianh
Date:
Fri Dec 01 14:36:25 2017 +0000
Revision:
4:ebe7948a209e
Parent:
0:4676a90107ca
2input

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tony63 0:4676a90107ca 1 #include "mbed.h"
tony63 0:4676a90107ca 2
tony63 0:4676a90107ca 3 class DebouncedIn {
tony63 0:4676a90107ca 4 public:
tony63 0:4676a90107ca 5 DebouncedIn(PinName in);
tony63 0:4676a90107ca 6
tony63 0:4676a90107ca 7 int read (void);
tony63 0:4676a90107ca 8 operator int();
tony63 0:4676a90107ca 9
tony63 0:4676a90107ca 10 int rising(void);
tony63 0:4676a90107ca 11 int falling(void);
tony63 0:4676a90107ca 12 int steady(void);
tony63 0:4676a90107ca 13
tony63 0:4676a90107ca 14 private :
tony63 0:4676a90107ca 15 // objects
tony63 0:4676a90107ca 16 DigitalIn _in;
tony63 0:4676a90107ca 17 Ticker _ticker;
tony63 0:4676a90107ca 18
tony63 0:4676a90107ca 19 // function to take a sample, and update flags
tony63 0:4676a90107ca 20 void _sample(void);
tony63 0:4676a90107ca 21
tony63 0:4676a90107ca 22 // counters and flags
tony63 0:4676a90107ca 23 int _samples;
tony63 0:4676a90107ca 24 int _output;
tony63 0:4676a90107ca 25 int _output_last;
tony63 0:4676a90107ca 26 int _rising_flag;
tony63 0:4676a90107ca 27 int _falling_flag;
tony63 0:4676a90107ca 28 int _state_counter;
tony63 0:4676a90107ca 29
tony63 0:4676a90107ca 30 };
tony63 0:4676a90107ca 31