APM:Libraries
AP_Airspeed_Backend.cpp
Go to the documentation of this file.
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_Common/AP_Common.h>
21 #include <AP_HAL/AP_HAL.h>
22 #include "AP_Airspeed.h"
23 #include "AP_Airspeed_Backend.h"
24 
25 extern const AP_HAL::HAL &hal;
26 
27 AP_Airspeed_Backend::AP_Airspeed_Backend(AP_Airspeed &_frontend, uint8_t _instance) :
28  frontend(_frontend),
29  instance(_instance)
30 {
31  sem = hal.util->new_semaphore();
32 }
33 
35 {
36  delete sem;
37 }
38 
39 
40 int8_t AP_Airspeed_Backend::get_pin(void) const
41 {
42  return frontend.param[instance].pin;
43 }
44 
46 {
48 }
49 
50 uint8_t AP_Airspeed_Backend::get_bus(void) const
51 {
52  return frontend.param[instance].bus;
53 }
float get_psi_range(void) const
int8_t get_pin(void) const
AP_Float psi_range
Definition: AP_Airspeed.h:180
AP_HAL::Util * util
Definition: HAL.h:115
virtual Semaphore * new_semaphore(void)
Definition: Util.h:108
AP_Int8 pin
Definition: AP_Airspeed.h:183
AP_HAL::Semaphore * sem
AP_Airspeed_Backend(AP_Airspeed &frontend, uint8_t instance)
Common definitions and utility routines for the ArduPilot libraries.
uint8_t get_bus(void) const
AP_Int8 bus
Definition: AP_Airspeed.h:184
struct AP_Airspeed::@5 param[AIRSPEED_MAX_SENSORS]
const AP_HAL::HAL & hal
Definition: AC_PID_test.cpp:14