Library for the LidarLite, gets distance in cm using the pwm output
Fork of MaxbotixDriver by
Diff: LidarLitePwm.h
- Revision:
- 2:be66a4cd86c0
- Parent:
- 1:32f0a592b9e5
- Child:
- 3:0b1f4404cb21
--- a/LidarLitePwm.h Wed Mar 18 08:55:54 2015 +0000 +++ b/LidarLitePwm.h Wed Mar 18 09:17:13 2015 +0000 @@ -6,7 +6,8 @@ class LidarLitePwm { public: - LidarLitePwm(PinName input, Timer& timer); + LidarLitePwm(PinName input); + ~LidarLitePwm(); /// Returns range in cm as int int read(); @@ -15,6 +16,7 @@ operator int(); private: + /// Inturrupt at start of pulse void pulseStart(); /// Interrupt at end of pulse @@ -22,8 +24,8 @@ /// Interrupt driver for the input pin InterruptIn _interrupt; - /// Reference to global timer instance - Timer& _timer; + /// Timer + Timer _timer; /// Time of the start of the current pulse int _pulseStartTime; /// The most recent sample