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.
 
 
 
 
 
 

42 lines
1.1 KiB

#ifndef __AIRMAR_P66__
#define __AIRMAR_P66__
#include <AP_HAL/AP_HAL.h>
#include <AP_SerialManager/AP_SerialManager.h>
#include <GCS_MAVLink/GCS.h>
#include <GCS_MAVLink/GCS_MAVLink.h>
class Underwater_Sonar
{
public:
Underwater_Sonar();
// get singleton instance
static Underwater_Sonar *get_singleton() { return _singleton; }
bool init(const AP_SerialManager& serial_manager);
bool read(void);
void update(const AP_SerialManager& serial_manager, const struct Location &_loc);
void write(const uint8_t *data, uint16_t len);
bool _decode(char c);
float radar_data[8];
private:
static Underwater_Sonar *_singleton;
AP_HAL::UARTDriver *_uart;
uint8_t ucCRCHi;
uint8_t ucCRCLo;
int iIndex;
uint8_t sonar_data[25];
char _term[8][6]; ///< buffer for the current term within the current sentence
uint8_t _term_offset; ///< character offset with the term being received
uint8_t _term_num;
uint32_t data_index;
};
namespace AP {
Underwater_Sonar &underwater_sonar();
};
#endif