47 bmp->i2c_trans.slave_addr = addr;
51 bmp->data_available =
false;
52 bmp->initialized =
false;
214 t_fine = (int64_t)(var1 + var2);
219 bmp->
temperature = (((var1 + var2) / 5120.f) * 100);
234 var1 = ((double)
t_fine / 2) - 64000.0;
235 var2 = (var1 * var1 * (double)bmp->
calib.
dig_p5) / 32768.0;
236 var2 = var2 + (var1 * (double)bmp->
calib.
dig_p5 * 2.0);
237 var2 = (var2 / 4.0) + ((
double)bmp->
calib.
dig_p4 * 65536.0);
238 var1 = (((double)bmp->
calib.
dig_p3 * var1 * (var1 / 524288.0)) + ((
double)bmp->
calib.
dig_p2 * var1)) / 524288.0;
239 var1 = (1 + (var1 / 32768.0)) * (double)bmp->
calib.
dig_p1;
241 p = (
p - (var2 / 4096.0)) * (6250.0 / var1);
void bmp280_i2c_event(struct Bmp280_I2c *bmp)
void bmp280_i2c_periodic(struct Bmp280_I2c *bmp)
static void parse_calib_data(struct Bmp280_I2c *bmp)
This internal API is used to parse the calibration data, compensates it and store it in device struct...
static double compensate_temperature(struct Bmp280_I2c *bmp)
This internal API is used to compensate the raw temperature data and return the compensated temperatu...
void bmp280_i2c_init(struct Bmp280_I2c *bmp, struct i2c_periph *i2c_p, uint8_t addr)
static void parse_sensor_data(struct Bmp280_I2c *bmp)
local function to extract raw data from i2c buffer and compute compensation with selected precision
static double compensate_pressure(struct Bmp280_I2c *bmp)
This internal API is used to compensate the raw pressure data and return the compensated pressure dat...
Sensor driver for BMP280 sensor via I2C.
bool initialized
config done flag
uint32_t raw_temperature
uncompensated temperature
float pressure
pressure in Pascal
float temperature
temperature in deg Celcius
volatile bool data_available
data ready flag
struct i2c_transaction i2c_trans
struct bmp280_reg_calib_data calib
calibration data
enum Bmp280Status status
state machine status
uint32_t raw_pressure
uncompensated pressure
struct i2c_periph * i2c_p
#define BMP280_OVERSAMPLING_1X_T
#define BMP280_DATA_START_REG_ADDR
#define BMP280_CONFIG_LEN
#define BMP280_CTRL_MEAS_REG_ADDR
#define BMP280_CALIB_LSB_DATA_ADDR
#define BMP280_OVERSAMPLING_8X_P
#define BMP280_INACTIVITY_62_5_MS
#define BMP280_CONFIG_REG_ADDR
#define BMP280_CALIB_DATA_LEN
#define BMP280_NVRAM_COPY_BIT
#define BMP280_P_T_DATA_LEN
#define BMP280_CONCAT_BYTES(msb, lsb)
#define BMP280_IIR_FILTER_COEFF_2
@ BMP280_STATUS_READ_DATA_REGS
@ BMP280_STATUS_READ_STATUS_REG
@ BMP280_STATUS_GET_CALIB
@ BMP280_STATUS_CONFIGURE
#define BMP280_STATUS_REG_ADDR
#define BMP280_POWER_NORMAL_MODE
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
uint8_t slave_addr
Slave address.
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
@ I2CTransSuccess
transaction successfully finished by I2C driver
@ I2CTransFailed
transaction failed
@ I2CTransDone
transaction set to done by user level
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.