Path: blob/master/libraries/AP_Airspeed/AP_Airspeed_DLVR.h
9872 views
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/14#pragma once1516// backend driver for AllSensors DLVR differential airspeed sensor17// currently assumes a 5" of water, noise reduced, sensor1819#include "AP_Airspeed_config.h"2021#if AP_AIRSPEED_DLVR_ENABLED2223#include <AP_HAL/AP_HAL.h>24#include <AP_HAL/I2CDevice.h>25#include <utility>2627#include "AP_Airspeed_Backend.h"2829class AP_Airspeed_DLVR : public AP_Airspeed_Backend30{31public:3233AP_Airspeed_DLVR(AP_Airspeed &frontend, uint8_t _instance, const float _range_inH2O);34static AP_Airspeed_Backend *probe(AP_Airspeed &frontend, uint8_t _instance, AP_HAL::I2CDevice *_dev, const float _range_inH2O);3536~AP_Airspeed_DLVR(void) {37delete dev;38}3940// probe and initialise the sensor41bool init() override;4243// return the current differential_pressure in Pascal44bool get_differential_pressure(float &pressure) override;4546// return the current temperature in degrees C, if available47bool get_temperature(float &temperature) override;4849private:50void timer();5152float pressure;53float temperature;54float temperature_sum;55float pressure_sum;56uint32_t temp_count;57uint32_t press_count;5859uint32_t last_sample_time_ms;60const float range_inH2O;6162// initialise the sensor63void setup();6465AP_HAL::I2CDevice *dev;66};6768#endif // AP_AIRSPEED_DLVR_ENABLED697071