positive or negative pulse width counter
PulseWidthCounter.h@1:d37d6388c179, 2013-07-11 (annotated)
- Committer:
- komaida424
- Date:
- Thu Jul 11 19:15:42 2013 +0000
- Revision:
- 1:d37d6388c179
- Parent:
- PulseCounter.h@0:89bd4ad6027d
namechange from PulseCounter to PulseWidthCounter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
komaida424 | 1:d37d6388c179 | 1 | #ifndef PULSEWIDTHCOUNTER_H |
komaida424 | 1:d37d6388c179 | 2 | #define PULSEWIDTHCOUNTER_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 | 1:d37d6388c179 | 8 | class PulseWidthCounter |
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 | 1:d37d6388c179 | 18 | PulseWidthCounter(PinName,bool); |
komaida424 | 0:89bd4ad6027d | 19 | |
komaida424 | 0:89bd4ad6027d | 20 | int count; |
komaida424 | 0:89bd4ad6027d | 21 | }; |
komaida424 | 0:89bd4ad6027d | 22 | #endif |