Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Baro/AP_Baro_BMP280.h
9885 views
1
#pragma once
2
3
#include "AP_Baro_Backend.h"
4
5
#if AP_BARO_BMP280_ENABLED
6
7
#include <AP_HAL/AP_HAL.h>
8
#include <AP_HAL/Device.h>
9
10
#ifndef HAL_BARO_BMP280_I2C_ADDR
11
#define HAL_BARO_BMP280_I2C_ADDR (0x76)
12
#endif
13
#ifndef HAL_BARO_BMP280_I2C_ADDR2
14
#define HAL_BARO_BMP280_I2C_ADDR2 (0x77)
15
#endif
16
17
class AP_Baro_BMP280 : public AP_Baro_Backend
18
{
19
public:
20
AP_Baro_BMP280(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
29
bool _init(void);
30
void _timer(void);
31
void _update_temperature(int32_t);
32
void _update_pressure(int32_t);
33
34
AP_HAL::Device *_dev;
35
36
uint8_t _instance;
37
int32_t _t_fine;
38
float _pressure_sum;
39
uint32_t _pressure_count;
40
float _temperature;
41
42
// Internal calibration registers
43
int16_t _t2, _t3, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9;
44
uint16_t _t1, _p1;
45
};
46
47
#endif // AP_BARO_BMP280_ENABLED
48
49