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 : 16 : /* 17 : backend driver class for airspeed 18 : */ 19 : 20 : #include "AP_Airspeed_config.h" 21 : 22 : #if AP_AIRSPEED_ENABLED 23 : 24 : #include <AP_Common/AP_Common.h> 25 : #include <AP_HAL/AP_HAL.h> 26 : #include "AP_Airspeed.h" 27 : #include "AP_Airspeed_Backend.h" 28 : 29 : extern const AP_HAL::HAL &hal; 30 : 31 710 : AP_Airspeed_Backend::AP_Airspeed_Backend(AP_Airspeed &_frontend, uint8_t _instance) : 32 710 : frontend(_frontend), 33 710 : instance(_instance) 34 : { 35 710 : } 36 : 37 552762 : int8_t AP_Airspeed_Backend::get_pin(void) const 38 : { 39 : #ifndef HAL_BUILD_AP_PERIPH 40 552762 : return frontend.param[instance].pin; 41 : #else 42 : return 0; 43 : #endif 44 : } 45 : 46 552072 : float AP_Airspeed_Backend::get_psi_range(void) const 47 : { 48 552072 : return frontend.param[instance].psi_range; 49 : } 50 : 51 16 : uint8_t AP_Airspeed_Backend::get_bus(void) const 52 : { 53 16 : return frontend.param[instance].bus; 54 : } 55 : 56 0 : bool AP_Airspeed_Backend::bus_is_configured(void) const 57 : { 58 0 : return frontend.param[instance].bus.configured(); 59 : } 60 : 61 710 : void AP_Airspeed_Backend::set_bus_id(uint32_t id) 62 : { 63 710 : frontend.param[instance].bus_id.set_and_save(int32_t(id)); 64 710 : } 65 : 66 : #endif // AP_AIRSPEED_ENABLED