Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Baro/AP_Baro_Backend.h
Views: 1798
#pragma once12#include "AP_Baro.h"34class AP_Baro_Backend5{6public:7AP_Baro_Backend(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 = 0x12,53DEVTYPE_BARO_MS5637 = 0x13,54DEVTYPE_BARO_BMP390 = 0x14,55DEVTYPE_BARO_BMP581 = 0x15,56};5758protected:59// reference to frontend object60AP_Baro &_frontend;6162void _copy_to_frontend(uint8_t instance, float pressure, float temperature);6364// semaphore for access to shared frontend data65HAL_Semaphore _sem;6667virtual void update_healthy_flag(uint8_t instance);6869// mean pressure for range filter70float _mean_pressure;71// number of dropped samples. Not used for now, but can be usable to choose more reliable sensor72uint32_t _error_count;7374// set bus ID of this instance, for BARO_DEVID parameters75void set_bus_id(uint8_t instance, uint32_t id) {76_frontend.sensors[instance].bus_id.set(int32_t(id));77}78};798081