You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
928 B
40 lines
928 B
8 years ago
|
#pragma once
|
||
|
|
||
5 years ago
|
#include "AP_RangeFinder.h"
|
||
|
#include "AP_RangeFinder_Backend_Serial.h"
|
||
8 years ago
|
|
||
3 years ago
|
class AP_RangeFinder_USD1_Serial : public AP_RangeFinder_Backend_Serial
|
||
8 years ago
|
{
|
||
|
|
||
|
public:
|
||
|
|
||
5 years ago
|
using AP_RangeFinder_Backend_Serial::AP_RangeFinder_Backend_Serial;
|
||
8 years ago
|
|
||
8 years ago
|
protected:
|
||
|
|
||
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
||
|
return MAV_DISTANCE_SENSOR_RADAR;
|
||
|
}
|
||
|
|
||
5 years ago
|
// baudrate used during object construction:
|
||
|
uint32_t initial_baudrate(uint8_t serial_instance) const override {
|
||
|
return 115200;
|
||
|
}
|
||
|
|
||
|
uint16_t rx_bufsize() const override { return 128; }
|
||
|
uint16_t tx_bufsize() const override { return 128; }
|
||
|
|
||
8 years ago
|
private:
|
||
3 years ago
|
// detect USD1_Serial Firmware Version
|
||
8 years ago
|
bool detect_version(void);
|
||
|
|
||
8 years ago
|
// get a reading
|
||
3 years ago
|
bool get_reading(float &reading_m) override;
|
||
8 years ago
|
|
||
8 years ago
|
uint8_t _linebuf[6];
|
||
|
uint8_t _linebuf_len;
|
||
|
bool _version_known;
|
||
|
uint8_t _header;
|
||
|
uint8_t _version;
|
||
8 years ago
|
};
|