Used to read incoming PWM signals from RC channels
PulseIn.h@1:eaf70ff4df07, 2012-12-23 (annotated)
- Committer:
- KarimAzzouz
- Date:
- Sun Dec 23 23:49:18 2012 +0000
- Revision:
- 1:eaf70ff4df07
- Parent:
- 0:1a57c7f88422
- Child:
- 2:4abac72addb7
No problems Here
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KarimAzzouz | 1:eaf70ff4df07 | 1 | #ifndef PULSEIN_H |
KarimAzzouz | 1:eaf70ff4df07 | 2 | #define PULSEIN_H |
KarimAzzouz | 1:eaf70ff4df07 | 3 | |
KarimAzzouz | 1:eaf70ff4df07 | 4 | #include "mbed.h" |
KarimAzzouz | 1:eaf70ff4df07 | 5 | |
KarimAzzouz | 1:eaf70ff4df07 | 6 | class PulseIn |
KarimAzzouz | 1:eaf70ff4df07 | 7 | { |
KarimAzzouz | 1:eaf70ff4df07 | 8 | public: |
KarimAzzouz | 1:eaf70ff4df07 | 9 | PulseIn(PinName p); |
KarimAzzouz | 1:eaf70ff4df07 | 10 | int read(void); |
KarimAzzouz | 1:eaf70ff4df07 | 11 | int getAngle(void); |
KarimAzzouz | 1:eaf70ff4df07 | 12 | |
KarimAzzouz | 1:eaf70ff4df07 | 13 | private: |
KarimAzzouz | 1:eaf70ff4df07 | 14 | InterruptIn _k; |
KarimAzzouz | 1:eaf70ff4df07 | 15 | void rise(void); |
KarimAzzouz | 1:eaf70ff4df07 | 16 | void fall(void); |
KarimAzzouz | 1:eaf70ff4df07 | 17 | Timer t; |
KarimAzzouz | 1:eaf70ff4df07 | 18 | uint16_t _duration,_prev; |
KarimAzzouz | 1:eaf70ff4df07 | 19 | }; |
KarimAzzouz | 1:eaf70ff4df07 | 20 | |
KarimAzzouz | 1:eaf70ff4df07 | 21 | #endif |
KarimAzzouz | 1:eaf70ff4df07 | 22 |