You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1003 B
44 lines
1003 B
#pragma once |
|
|
|
#include <AP_HAL/AP_HAL.h> |
|
#include <AP_HAL/Device.h> |
|
#include <AP_HAL/utility/OwnPtr.h> |
|
|
|
#include "AP_Baro_Backend.h" |
|
|
|
#ifndef HAL_BARO_BMP280_I2C_ADDR |
|
#define HAL_BARO_BMP280_I2C_ADDR (0x76) |
|
#endif |
|
#ifndef HAL_BARO_BMP280_I2C_ADDR2 |
|
#define HAL_BARO_BMP280_I2C_ADDR2 (0x77) |
|
#endif |
|
|
|
class AP_Baro_BMP280 : public AP_Baro_Backend |
|
{ |
|
public: |
|
AP_Baro_BMP280(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev); |
|
|
|
/* AP_Baro public interface: */ |
|
void update() override; |
|
|
|
static AP_Baro_Backend *probe(AP_Baro &baro, AP_HAL::OwnPtr<AP_HAL::Device> dev); |
|
|
|
private: |
|
|
|
bool _init(void); |
|
void _timer(void); |
|
void _update_temperature(int32_t); |
|
void _update_pressure(int32_t); |
|
|
|
AP_HAL::OwnPtr<AP_HAL::Device> _dev; |
|
|
|
uint8_t _instance; |
|
int32_t _t_fine; |
|
float _pressure_sum; |
|
uint32_t _pressure_count; |
|
float _temperature; |
|
|
|
// Internal calibration registers |
|
int16_t _t2, _t3, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9; |
|
uint16_t _t1, _p1; |
|
};
|
|
|