Path: blob/master/libraries/AP_Baro/AP_Baro_Backend.h
9701 views
#pragma once12#include "AP_Baro.h"34class AP_Baro_Backend5{6public:7AP_Baro_Backend(class AP_Baro &baro);8virtual ~AP_Baro_Backend(void) {};910// each driver must provide an update method to copy accumulated11// data to the frontend12virtual void update() = 0;1314void backend_update(uint8_t instance);1516// Check that the baro valid by using a mean filter.17// If the value further that filter_range from mean value, it is rejected.18bool pressure_ok(float press);19uint32_t get_error_count() const { return _error_count; }2021#if AP_BARO_MSP_ENABLED22virtual void handle_msp(const MSP::msp_baro_data_message_t &pkt) {}23#endif2425#if AP_BARO_EXTERNALAHRS_ENABLED26virtual void handle_external(const AP_ExternalAHRS::baro_data_message_t &pkt) {}27#endif2829/*30device driver IDs. These are used to fill in the devtype field31of the device ID, which shows up as BARO_DEVID* parameters to32users.33*/34enum DevTypes {35DEVTYPE_BARO_SITL = 0x01,36DEVTYPE_BARO_BMP085 = 0x02,37DEVTYPE_BARO_BMP280 = 0x03,38DEVTYPE_BARO_BMP388 = 0x04,39DEVTYPE_BARO_DPS280 = 0x05,40DEVTYPE_BARO_DPS310 = 0x06,41DEVTYPE_BARO_FBM320 = 0x07,42DEVTYPE_BARO_ICM20789 = 0x08,43DEVTYPE_BARO_KELLERLD = 0x09,44DEVTYPE_BARO_LPS2XH = 0x0A,45DEVTYPE_BARO_MS5611 = 0x0B,46DEVTYPE_BARO_SPL06 = 0x0C,47DEVTYPE_BARO_UAVCAN = 0x0D,48DEVTYPE_BARO_MSP = 0x0E,49DEVTYPE_BARO_ICP101XX = 0x0F,50DEVTYPE_BARO_ICP201XX = 0x10,51DEVTYPE_BARO_MS5607 = 0x11,52DEVTYPE_BARO_MS5837_30BA = 0x12,53DEVTYPE_BARO_MS5637 = 0x13,54DEVTYPE_BARO_BMP390 = 0x14,55DEVTYPE_BARO_BMP581 = 0x15,56DEVTYPE_BARO_SPA06 = 0x16,57DEVTYPE_BARO_AUAV = 0x17,58DEVTYPE_BARO_MS5837_02BA = 0x18,59};6061protected:62// reference to frontend object63AP_Baro &_frontend;6465void _copy_to_frontend(uint8_t instance, float pressure, float temperature);6667// semaphore for access to shared frontend data68HAL_Semaphore _sem;6970virtual void update_healthy_flag(uint8_t instance);7172// mean pressure for range filter73float _mean_pressure;74// number of dropped samples. Not used for now, but can be usable to choose more reliable sensor75uint32_t _error_count;7677// set bus ID of this instance, for BARO_DEVID parameters78void set_bus_id(uint8_t instance, uint32_t id);79};808182