CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Baro/AP_Baro_FBM320.h
Views: 1798
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
#include <AP_HAL/utility/OwnPtr.h>
10
11
#ifndef HAL_BARO_FBM320_I2C_ADDR
12
#define HAL_BARO_FBM320_I2C_ADDR 0x6C
13
#endif
14
#ifndef HAL_BARO_FBM320_I2C_ADDR2
15
#define HAL_BARO_FBM320_I2C_ADDR2 0x6D
16
#endif
17
18
19
class AP_Baro_FBM320 : public AP_Baro_Backend {
20
public:
21
AP_Baro_FBM320(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
22
23
/* AP_Baro public interface: */
24
void update() override;
25
26
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev);
27
28
private:
29
bool init(void);
30
bool read_calibration(void);
31
void timer(void);
32
void calculate_PT(int32_t UT, int32_t UP, int32_t &pressure, int32_t &temperature);
33
34
AP_HAL::OwnPtr<AP_HAL::Device> dev;
35
36
uint8_t instance;
37
38
uint32_t count;
39
float pressure_sum;
40
float temperature_sum;
41
uint8_t step;
42
43
int32_t value_T;
44
45
// Internal calibration registers
46
struct fbm320_calibration {
47
uint16_t C0, C1, C2, C3, C6, C8, C9, C10, C11, C12;
48
uint32_t C4, C5, C7;
49
} calibration;
50
};
51
52
#endif // AP_BARO_FBM320_ENABLED
53
54