Used to read incoming PWM signals from RC channels
PulseIn.h@2:4abac72addb7, 2013-01-08 (annotated)
- Committer:
- KarimAzzouz
- Date:
- Tue Jan 08 15:01:22 2013 +0000
- Revision:
- 2:4abac72addb7
- Parent:
- 1:eaf70ff4df07
Reduced ISR functions to a minimum
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 | |
KarimAzzouz | 1:eaf70ff4df07 | 12 | private: |
KarimAzzouz | 1:eaf70ff4df07 | 13 | InterruptIn _k; |
KarimAzzouz | 1:eaf70ff4df07 | 14 | void rise(void); |
KarimAzzouz | 1:eaf70ff4df07 | 15 | void fall(void); |
KarimAzzouz | 1:eaf70ff4df07 | 16 | Timer t; |
KarimAzzouz | 2:4abac72addb7 | 17 | uint16_t _duration; |
KarimAzzouz | 1:eaf70ff4df07 | 18 | }; |
KarimAzzouz | 1:eaf70ff4df07 | 19 | |
KarimAzzouz | 1:eaf70ff4df07 | 20 | #endif |
KarimAzzouz | 1:eaf70ff4df07 | 21 |