2013-02-28 20:19:02 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
#ifndef __AP_RANGEFINDER_ANALOG_H__
|
|
|
|
#define __AP_RANGEFINDER_ANALOG_H__
|
2013-02-28 20:19:02 -04:00
|
|
|
|
|
|
|
#include "RangeFinder.h"
|
2014-06-26 23:57:28 -03:00
|
|
|
#include "RangeFinder_Backend.h"
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
class AP_RangeFinder_analog : public AP_RangeFinder_Backend
|
2013-02-28 20:19:02 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
2014-06-26 23:57:28 -03:00
|
|
|
AP_RangeFinder_analog(RangeFinder &ranger, uint8_t instance, RangeFinder::RangeFinder_State &_state);
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
// static detection function
|
|
|
|
static bool detect(RangeFinder &ranger, uint8_t instance);
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
// update state
|
|
|
|
void update(void);
|
2013-02-28 20:19:02 -04:00
|
|
|
|
|
|
|
private:
|
2014-06-26 23:57:28 -03:00
|
|
|
// update raw voltage
|
|
|
|
void update_voltage(void);
|
|
|
|
|
|
|
|
AP_HAL::AnalogSource *source;
|
2013-02-28 20:19:02 -04:00
|
|
|
};
|
2014-06-26 23:57:28 -03:00
|
|
|
#endif // __AP_RANGEFINDER_ANALOG_H__
|
2013-02-28 20:19:02 -04:00
|
|
|
|