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 Apr 01 11:18:45 2015 +0000
Revision:
3:0b1f4404cb21
Parent:
2:be66a4cd86c0
...

Who changed what in which revision?

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