Line data Source code
1 : /* 2 : MSP airspeed backend 3 : */ 4 : #pragma once 5 : 6 : #include "AP_Airspeed_config.h" 7 : 8 : #if AP_AIRSPEED_MSP_ENABLED 9 : 10 : #include "AP_Airspeed_Backend.h" 11 : 12 : #include <AP_MSP/msp.h> 13 : 14 : class AP_Airspeed_MSP : public AP_Airspeed_Backend 15 : { 16 : public: 17 : AP_Airspeed_MSP(AP_Airspeed &airspeed, uint8_t instance, uint8_t msp_instance); 18 : 19 0 : bool init(void) override { 20 0 : return true; 21 : } 22 : 23 : void handle_msp(const MSP::msp_airspeed_data_message_t &pkt) override; 24 : 25 : // return the current differential_pressure in Pascal 26 : bool get_differential_pressure(float &pressure) override; 27 : 28 : // temperature not available via analog backend 29 : bool get_temperature(float &temperature) override; 30 : 31 : private: 32 : const uint8_t msp_instance; 33 : float sum_pressure; 34 : uint8_t press_count; 35 : float sum_temp; 36 : uint8_t temp_count; 37 : }; 38 : 39 : #endif // AP_AIRSPEED_MSP_ENABLED