LCOV - code coverage report
Current view: top level - AP_Airspeed - AP_Airspeed_MS4525.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 3 0.0 %
Date: 2026-09-09 11:02:08 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :    This program is free software: you can redistribute it and/or modify
       3             :    it under the terms of the GNU General Public License as published by
       4             :    the Free Software Foundation, either version 3 of the License, or
       5             :    (at your option) any later version.
       6             : 
       7             :    This program is distributed in the hope that it will be useful,
       8             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10             :    GNU General Public License for more details.
      11             : 
      12             :    You should have received a copy of the GNU General Public License
      13             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      14             :  */
      15             : #pragma once
      16             : 
      17             : #include "AP_Airspeed_config.h"
      18             : 
      19             : #if AP_AIRSPEED_MS4525_ENABLED
      20             : 
      21             : /*
      22             :   backend driver for airspeed from I2C
      23             :  */
      24             : 
      25             : #include <AP_HAL/AP_HAL.h>
      26             : #include <AP_HAL/I2CDevice.h>
      27             : #include <utility>
      28             : 
      29             : #include "AP_Airspeed_Backend.h"
      30             : 
      31             : class AP_Airspeed_MS4525 : public AP_Airspeed_Backend
      32             : {
      33             : public:
      34             :     using AP_Airspeed_Backend::AP_Airspeed_Backend;
      35             : 
      36           0 :     ~AP_Airspeed_MS4525(void) {
      37           0 :         delete _dev;
      38           0 :     }
      39             : 
      40             :     // probe and initialise the sensor
      41             :     bool init() override;
      42             : 
      43             :     // return the current differential_pressure in Pascal
      44             :     bool get_differential_pressure(float &pressure) override;
      45             : 
      46             :     // return the current temperature in degrees C, if available
      47             :     bool get_temperature(float &temperature) override;
      48             : 
      49             : private:
      50             :     void _measure();
      51             :     void _collect();
      52             :     void _timer();
      53             :     void _voltage_correction(float &diff_press_pa, float &temperature);
      54             :     float _get_pressure(int16_t dp_raw) const;
      55             :     float _get_temperature(int16_t dT_raw) const;
      56             : 
      57             :     float _temp_sum;
      58             :     float _press_sum;
      59             :     uint32_t _temp_count;
      60             :     uint32_t _press_count;
      61             :     float _temperature;
      62             :     float _pressure;
      63             :     uint32_t _last_sample_time_ms;
      64             :     uint32_t _measurement_started_ms;
      65             :     AP_HAL::I2CDevice *_dev;
      66             : 
      67             :     bool probe(uint8_t bus, uint8_t address);
      68             : };
      69             : 
      70             : #endif  // AP_AIRSPEED_MS4525_ENABLED

Generated by: LCOV version 1.14