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_BMP280.h
Views: 1798
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
#include <AP_HAL/utility/OwnPtr.h>
10
11
#ifndef HAL_BARO_BMP280_I2C_ADDR
12
#define HAL_BARO_BMP280_I2C_ADDR (0x76)
13
#endif
14
#ifndef HAL_BARO_BMP280_I2C_ADDR2
15
#define HAL_BARO_BMP280_I2C_ADDR2 (0x77)
16
#endif
17
18
class AP_Baro_BMP280 : public AP_Baro_Backend
19
{
20
public:
21
AP_Baro_BMP280(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
30
bool _init(void);
31
void _timer(void);
32
void _update_temperature(int32_t);
33
void _update_pressure(int32_t);
34
35
AP_HAL::OwnPtr<AP_HAL::Device> _dev;
36
37
uint8_t _instance;
38
int32_t _t_fine;
39
float _pressure_sum;
40
uint32_t _pressure_count;
41
float _temperature;
42
43
// Internal calibration registers
44
int16_t _t2, _t3, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9;
45
uint16_t _t1, _p1;
46
};
47
48
#endif // AP_BARO_BMP280_ENABLED
49
50