positive or negative pulse width counter
PulseCounter.h@0:89bd4ad6027d, 2013-07-10 (annotated)
- Committer:
- komaida424
- Date:
- Wed Jul 10 15:24:37 2013 +0000
- Revision:
- 0:89bd4ad6027d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
komaida424 | 0:89bd4ad6027d | 1 | #ifndef PULSECOUNTER_H |
komaida424 | 0:89bd4ad6027d | 2 | #define PULSECOUNTER_H |
komaida424 | 0:89bd4ad6027d | 3 | #define POSITIVE true |
komaida424 | 0:89bd4ad6027d | 4 | #define NEGATIVE false |
komaida424 | 0:89bd4ad6027d | 5 | |
komaida424 | 0:89bd4ad6027d | 6 | #include "mbed.h" |
komaida424 | 0:89bd4ad6027d | 7 | |
komaida424 | 0:89bd4ad6027d | 8 | class PulseCounter |
komaida424 | 0:89bd4ad6027d | 9 | { |
komaida424 | 0:89bd4ad6027d | 10 | private: |
komaida424 | 0:89bd4ad6027d | 11 | Timer _time; |
komaida424 | 0:89bd4ad6027d | 12 | void start(); |
komaida424 | 0:89bd4ad6027d | 13 | void stop(); |
komaida424 | 0:89bd4ad6027d | 14 | InterruptIn interrupt; |
komaida424 | 0:89bd4ad6027d | 15 | |
komaida424 | 0:89bd4ad6027d | 16 | public: |
komaida424 | 0:89bd4ad6027d | 17 | // Timer time; |
komaida424 | 0:89bd4ad6027d | 18 | PulseCounter(PinName,bool); |
komaida424 | 0:89bd4ad6027d | 19 | |
komaida424 | 0:89bd4ad6027d | 20 | int count; |
komaida424 | 0:89bd4ad6027d | 21 | }; |
komaida424 | 0:89bd4ad6027d | 22 | #endif |