Path: blob/master/libraries/AP_Airspeed/AP_Airspeed_Backend.cpp
9532 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*/1415/*16backend driver class for airspeed17*/1819#include "AP_Airspeed_config.h"2021#if AP_AIRSPEED_ENABLED2223#include <AP_Common/AP_Common.h>24#include <AP_HAL/AP_HAL.h>25#include "AP_Airspeed.h"26#include "AP_Airspeed_Backend.h"2728extern const AP_HAL::HAL &hal;2930AP_Airspeed_Backend::AP_Airspeed_Backend(AP_Airspeed &_frontend, uint8_t _instance) :31frontend(_frontend),32instance(_instance)33{34}3536int8_t AP_Airspeed_Backend::get_pin(void) const37{38#ifndef HAL_BUILD_AP_PERIPH39return frontend.param[instance].pin;40#else41return 0;42#endif43}4445float AP_Airspeed_Backend::get_psi_range(void) const46{47return frontend.param[instance].psi_range;48}4950uint8_t AP_Airspeed_Backend::get_bus(void) const51{52return frontend.param[instance].bus;53}5455bool AP_Airspeed_Backend::bus_is_configured(void) const56{57return frontend.param[instance].bus.configured();58}5960void AP_Airspeed_Backend::set_bus_id(uint32_t id)61{62frontend.param[instance].bus_id.set_and_save(int32_t(id));63}6465#endif // AP_AIRSPEED_ENABLED666768