Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Baro/AP_Baro_AUAV.h
4182 views
1
#pragma once
2
3
#include "AP_Baro_Backend.h"
4
5
#if AP_BARO_AUAV_ENABLED
6
7
#include <AP_HAL/AP_HAL.h>
8
#include <AP_HAL/Device.h>
9
#include <AP_HAL/utility/OwnPtr.h>
10
11
// Baro uses the airspeed AUAV Pressure sensor class from airspeed, airspeed must be enabled
12
#include <AP_Airspeed/AP_Airspeed_config.h>
13
#if !AP_AIRSPEED_AUAV_ENABLED
14
#error AUAV Baro requires AUAV Airspeed
15
#endif
16
17
#include <AP_Airspeed/AP_Airspeed_AUAV.h>
18
19
20
#ifndef HAL_BARO_AUAV_I2C_ADDR
21
#define HAL_BARO_AUAV_I2C_ADDR 0x27
22
#endif
23
24
class AP_Baro_AUAV : public AP_Baro_Backend {
25
public:
26
AP_Baro_AUAV(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
27
28
void update() override;
29
30
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
31
32
protected:
33
bool init();
34
35
void timer();
36
37
AP_HAL::OwnPtr<AP_HAL::Device> dev;
38
AP_HAL::I2CDevice *i2c_dev;
39
40
AUAV_Pressure_sensor sensor { i2c_dev, AUAV_Pressure_sensor::Type::Absolute };
41
42
uint8_t instance;
43
44
uint32_t count;
45
float pressure_sum;
46
float temperature_sum;
47
48
bool measurement_requested;
49
};
50
51
#endif // AP_BARO_AUAV_ENABLED
52
53