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

Dependents:   LidarLite_test

Fork of MaxbotixDriver by Daniel Casner

LidarLitePwm.h

Committer:
joe4465
Date:
2015-04-01
Revision:
3:0b1f4404cb21
Parent:
2:be66a4cd86c0

File content as of revision 3:0b1f4404cb21:

#include "mbed.h"
#include "filter.h"

#ifndef LidarLitePwm_H
#define LidarLitePwm_H
 
class LidarLitePwm
{
  public:
    LidarLitePwm(PinName input);
    ~LidarLitePwm();
    
    /// Returns range in cm as int
    int read();
    
    
    /// Returns the range in CM as an int
    operator int();
    
  private:

    /// Inturrupt at start of pulse
    void pulseStart();
    /// Interrupt at end of pulse
    void pulseStop();
    
    /// Interrupt driver for the input pin
    InterruptIn _interrupt;
    /// Timer
    Timer _timer;
    /// Time of the start of the current pulse
    int _pulseStartTime;
    /// The most recent sample
    int _range;
    
    filter* _lidarFilter;
};
 
#endif