2016-02-17 21:25:44 -04:00
|
|
|
#pragma once
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2019-11-10 22:47:38 -04:00
|
|
|
#include "AP_RangeFinder.h"
|
|
|
|
#include "AP_RangeFinder_Backend.h"
|
2018-07-04 11:22:17 -03:00
|
|
|
#include "AP_RangeFinder_Params.h"
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2022-03-12 06:37:29 -04:00
|
|
|
#ifndef AP_RANGEFINDER_ANALOG_ENABLED
|
|
|
|
#define AP_RANGEFINDER_ANALOG_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if AP_RANGEFINDER_ANALOG_ENABLED
|
|
|
|
|
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
|
2018-07-04 11:22:17 -03:00
|
|
|
AP_RangeFinder_analog(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params);
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
// static detection function
|
2018-07-04 11:22:17 -03:00
|
|
|
static bool detect(AP_RangeFinder_Params &_params);
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2014-06-26 23:57:28 -03:00
|
|
|
// update state
|
2018-11-07 07:01:51 -04:00
|
|
|
void update(void) override;
|
2013-02-28 20:19:02 -04:00
|
|
|
|
2017-08-08 04:32:53 -03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
};
|
2022-03-12 06:37:29 -04:00
|
|
|
|
|
|
|
#endif
|