Library for the LidarLite, gets distance in cm using the pwm output

Dependents:   LidarLite_test

Fork of MaxbotixDriver by Daniel Casner

Committer:
joe4465
Date:
Wed Mar 18 09:17:13 2015 +0000
Revision:
2:be66a4cd86c0
Parent:
1:32f0a592b9e5
Child:
3:0b1f4404cb21
V1.1 Internal timer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joe4465 1:32f0a592b9e5 1 #include "mbed.h"
joe4465 1:32f0a592b9e5 2
joe4465 1:32f0a592b9e5 3 #ifndef LidarLitePwm_H
joe4465 1:32f0a592b9e5 4 #define LidarLitePwm_H
joe4465 1:32f0a592b9e5 5
joe4465 1:32f0a592b9e5 6 class LidarLitePwm
joe4465 1:32f0a592b9e5 7 {
joe4465 1:32f0a592b9e5 8 public:
joe4465 2:be66a4cd86c0 9 LidarLitePwm(PinName input);
joe4465 2:be66a4cd86c0 10 ~LidarLitePwm();
joe4465 1:32f0a592b9e5 11
joe4465 1:32f0a592b9e5 12 /// Returns range in cm as int
joe4465 1:32f0a592b9e5 13 int read();
joe4465 1:32f0a592b9e5 14
joe4465 1:32f0a592b9e5 15 /// Returns the range in CM as an int
joe4465 1:32f0a592b9e5 16 operator int();
joe4465 1:32f0a592b9e5 17
joe4465 1:32f0a592b9e5 18 private:
joe4465 2:be66a4cd86c0 19
joe4465 1:32f0a592b9e5 20 /// Inturrupt at start of pulse
joe4465 1:32f0a592b9e5 21 void pulseStart();
joe4465 1:32f0a592b9e5 22 /// Interrupt at end of pulse
joe4465 1:32f0a592b9e5 23 void pulseStop();
joe4465 1:32f0a592b9e5 24
joe4465 1:32f0a592b9e5 25 /// Interrupt driver for the input pin
joe4465 1:32f0a592b9e5 26 InterruptIn _interrupt;
joe4465 2:be66a4cd86c0 27 /// Timer
joe4465 2:be66a4cd86c0 28 Timer _timer;
joe4465 1:32f0a592b9e5 29 /// Time of the start of the current pulse
joe4465 1:32f0a592b9e5 30 int _pulseStartTime;
joe4465 1:32f0a592b9e5 31 /// The most recent sample
joe4465 1:32f0a592b9e5 32 int _range;
joe4465 1:32f0a592b9e5 33 };
joe4465 1:32f0a592b9e5 34
joe4465 1:32f0a592b9e5 35 #endif