Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Baro/AP_Baro_FBM320.h
9871 views
1
#pragma once
2
3
#include "AP_Baro_Backend.h"
4
5
#if AP_BARO_FBM320_ENABLED
6
7
#include <AP_HAL/AP_HAL.h>
8
#include <AP_HAL/Device.h>
9
10
#ifndef HAL_BARO_FBM320_I2C_ADDR
11
#define HAL_BARO_FBM320_I2C_ADDR 0x6C
12
#endif
13
#ifndef HAL_BARO_FBM320_I2C_ADDR2
14
#define HAL_BARO_FBM320_I2C_ADDR2 0x6D
15
#endif
16
17
18
class AP_Baro_FBM320 : public AP_Baro_Backend {
19
public:
20
AP_Baro_FBM320(AP_Baro &baro, AP_HAL::Device &dev);
21
22
/* AP_Baro public interface: */
23
void update() override;
24
25
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::Device &dev);
26
27
private:
28
bool init(void);
29
bool read_calibration(void);
30
void timer(void);
31
void calculate_PT(int32_t UT, int32_t UP, int32_t &pressure, int32_t &temperature);
32
33
AP_HAL::Device *dev;
34
35
uint8_t instance;
36
37
uint32_t count;
38
float pressure_sum;
39
float temperature_sum;
40
uint8_t step;
41
42
int32_t value_T;
43
44
// Internal calibration registers
45
struct fbm320_calibration {
46
uint16_t C0, C1, C2, C3, C6, C8, C9, C10, C11, C12;
47
uint32_t C4, C5, C7;
48
} calibration;
49
};
50
51
#endif // AP_BARO_FBM320_ENABLED
52
53