#ifndef __AIRMAR_P66__ #define __AIRMAR_P66__ #include #include #include #include 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