New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Sensors/LidarLitePwm/LidarLitePwm.h@4:9ffbf9101992, 2015-05-08 (annotated)
- Committer:
- joe4465
- Date:
- Fri May 08 09:07:38 2015 +0000
- Revision:
- 4:9ffbf9101992
End of FYP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joe4465 | 4:9ffbf9101992 | 1 | #include "mbed.h" |
joe4465 | 4:9ffbf9101992 | 2 | #include "filter.h" |
joe4465 | 4:9ffbf9101992 | 3 | |
joe4465 | 4:9ffbf9101992 | 4 | #ifndef LidarLitePwm_H |
joe4465 | 4:9ffbf9101992 | 5 | #define LidarLitePwm_H |
joe4465 | 4:9ffbf9101992 | 6 | |
joe4465 | 4:9ffbf9101992 | 7 | class LidarLitePwm |
joe4465 | 4:9ffbf9101992 | 8 | { |
joe4465 | 4:9ffbf9101992 | 9 | public: |
joe4465 | 4:9ffbf9101992 | 10 | LidarLitePwm(PinName input); |
joe4465 | 4:9ffbf9101992 | 11 | ~LidarLitePwm(); |
joe4465 | 4:9ffbf9101992 | 12 | |
joe4465 | 4:9ffbf9101992 | 13 | /// Returns range in cm as int |
joe4465 | 4:9ffbf9101992 | 14 | int read(); |
joe4465 | 4:9ffbf9101992 | 15 | |
joe4465 | 4:9ffbf9101992 | 16 | |
joe4465 | 4:9ffbf9101992 | 17 | /// Returns the range in CM as an int |
joe4465 | 4:9ffbf9101992 | 18 | operator int(); |
joe4465 | 4:9ffbf9101992 | 19 | |
joe4465 | 4:9ffbf9101992 | 20 | private: |
joe4465 | 4:9ffbf9101992 | 21 | |
joe4465 | 4:9ffbf9101992 | 22 | /// Inturrupt at start of pulse |
joe4465 | 4:9ffbf9101992 | 23 | void pulseStart(); |
joe4465 | 4:9ffbf9101992 | 24 | /// Interrupt at end of pulse |
joe4465 | 4:9ffbf9101992 | 25 | void pulseStop(); |
joe4465 | 4:9ffbf9101992 | 26 | |
joe4465 | 4:9ffbf9101992 | 27 | /// Interrupt driver for the input pin |
joe4465 | 4:9ffbf9101992 | 28 | InterruptIn _interrupt; |
joe4465 | 4:9ffbf9101992 | 29 | /// Timer |
joe4465 | 4:9ffbf9101992 | 30 | Timer _timer; |
joe4465 | 4:9ffbf9101992 | 31 | /// Time of the start of the current pulse |
joe4465 | 4:9ffbf9101992 | 32 | int _pulseStartTime; |
joe4465 | 4:9ffbf9101992 | 33 | /// The most recent sample |
joe4465 | 4:9ffbf9101992 | 34 | int _range; |
joe4465 | 4:9ffbf9101992 | 35 | |
joe4465 | 4:9ffbf9101992 | 36 | filter* _lidarFilter; |
joe4465 | 4:9ffbf9101992 | 37 | }; |
joe4465 | 4:9ffbf9101992 | 38 | |
joe4465 | 4:9ffbf9101992 | 39 | #endif |