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_Airspeed/AP_Airspeed_DLVR.h
Views: 1798
/*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/utility/OwnPtr.h>25#include <AP_HAL/I2CDevice.h>26#include <utility>2728#include "AP_Airspeed_Backend.h"2930class AP_Airspeed_DLVR : public AP_Airspeed_Backend31{32public:3334AP_Airspeed_DLVR(AP_Airspeed &frontend, uint8_t _instance, const float _range_inH2O);35static AP_Airspeed_Backend *probe(AP_Airspeed &frontend, uint8_t _instance, AP_HAL::OwnPtr<AP_HAL::I2CDevice> _dev, const float _range_inH2O);3637~AP_Airspeed_DLVR(void) {}3839// probe and initialise the sensor40bool init() override;4142// return the current differential_pressure in Pascal43bool get_differential_pressure(float &pressure) override;4445// return the current temperature in degrees C, if available46bool get_temperature(float &temperature) override;4748private:49void timer();5051float pressure;52float temperature;53float temperature_sum;54float pressure_sum;55uint32_t temp_count;56uint32_t press_count;5758uint32_t last_sample_time_ms;59const float range_inH2O;6061// initialise the sensor62void setup();6364AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev;65};6667#endif // AP_AIRSPEED_DLVR_ENABLED686970