|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Sensor driver for BMP280 sensor. More...
#include "peripherals/bmp280.h"Go to the source code of this file.
Functions | |
| static void | parse_sensor_data (struct bmp280_t *bmp, uint8_t *data) |
| local function to extract raw data from i2c buffer and compute compensation with selected precision | |
| static void | parse_calib_data (struct bmp280_t *bmp, uint8_t *data) |
| This internal API is used to parse the calibration data, compensates it and store it in device structure (float version). | |
| static double | compensate_pressure (struct bmp280_t *bmp) |
| This internal API is used to compensate the raw pressure data and return the compensated pressure data in integer data type. | |
| static double | compensate_temperature (struct bmp280_t *bmp) |
| This internal API is used to compensate the raw temperature data and return the compensated temperature data in float data type. | |
| static bool | bmp280_config (struct bmp280_t *bmp) |
| Configure the BMP280 device register by register. | |
| static void | bmp280_register_write (struct bmp280_t *bmp, uint8_t reg, uint8_t value) |
| Write a register with a value. | |
| static void | bmp280_register_read (struct bmp280_t *bmp, uint8_t reg, uint16_t size) |
| Read a register. | |
| void | bmp280_init (struct bmp280_t *bmp) |
| Initialize the bmp280 sensor instance. | |
| void | bmp280_periodic (struct bmp280_t *bmp) |
| Should be called periodically to request sensor readings. | |
| void | bmp280_event (struct bmp280_t *bmp) |
| Should be called in the event thread. | |
Sensor driver for BMP280 sensor.
Definition in file bmp280.c.
|
static |
Configure the BMP280 device register by register.
| bmp | The bmp280 instance |
Definition at line 329 of file bmp280.c.
References BMP280_CONFIG_REG_ADDR, BMP280_CTRL_MEAS_REG_ADDR, BMP280_IIR_FILTER_COEFF_16, BMP280_INACTIVITY_HALF_MS, BMP280_OVERSAMPLING_16X_P, BMP280_OVERSAMPLING_2X_T, BMP280_POWER_NORMAL_MODE, bmp280_register_write(), and bmp280_t::config_idx.
Referenced by bmp280_event(), and bmp280_periodic().
| void bmp280_event | ( | struct bmp280_t * | bmp | ) |
Should be called in the event thread.
| bmp | The bmp280 instance |
Definition at line 157 of file bmp280.c.
References bmp280_config(), BMP280_EOC_BIT, BMP280_I2C, BMP280_ID_NB, BMP280_NVRAM_COPY_BIT, BMP280_SPI, BMP280_STATUS_CONFIGURE, BMP280_STATUS_GET_CALIB, BMP280_STATUS_IDLE, BMP280_STATUS_READ_DATA_REGS, BMP280_STATUS_READ_STATUS_REG, BMP280_STATUS_UNINIT, BMP_280, bmp280_t::bus, compensate_pressure(), compensate_temperature(), bmp280_t::data_available, bmp280_t::device, I2CTransDone, I2CTransFailed, I2CTransSuccess, bmp280_t::initialized, parse_calib_data(), parse_sensor_data(), bmp280_t::rx_buffer, SPITransDone, SPITransFailed, SPITransSuccess, and bmp280_t::status.
Referenced by baro_bmp280_event().
| void bmp280_init | ( | struct bmp280_t * | bmp | ) |
Initialize the bmp280 sensor instance.
| bmp | The structure containing the configuration of the bmp280 instance |
Definition at line 48 of file bmp280.c.
References bmp280_init(), BMP280_SPI, and BMP280_STATUS_UNINIT.
Referenced by baro_bmp280_init(), and bmp280_init().
| void bmp280_periodic | ( | struct bmp280_t * | bmp | ) |
Should be called periodically to request sensor readings.
| bmp | The bmp280 instance |
Definition at line 101 of file bmp280.c.
References BMP280_CALIB_DATA_LEN, BMP280_CALIB_LSB_DATA_ADDR, BMP280_CHIP_ID_REG_ADDR, bmp280_config(), BMP280_DATA_START_REG_ADDR, BMP280_I2C, BMP280_P_T_DATA_LEN, bmp280_register_read(), BMP280_SPI, BMP280_STATUS_CONFIGURE, BMP280_STATUS_GET_CALIB, BMP280_STATUS_IDLE, BMP280_STATUS_READ_DATA_REGS, BMP280_STATUS_READ_STATUS_REG, BMP280_STATUS_REG_ADDR, BMP280_STATUS_UNINIT, bmp280_t::bus, bmp280_t::data_available, I2CTransDone, bmp280_t::initialized, SPITransDone, and bmp280_t::status.
Referenced by baro_bmp280_periodic().
Read a register.
| bmp | The bmp280 instance |
| reg | The register address |
| size | The size to read (already 1 is added for the transmission of the register to read) |
Definition at line 384 of file bmp280.c.
References BMP280_READ_FLAG, BMP280_SPI, bmp280_t::bus, i2c_transceive(), spi_submit(), and bmp280_t::tx_buffer.
Referenced by bmp280_periodic().
Write a register with a value.
| bmp | The bmp280 instance |
| reg | The register address |
| value | The value to write to the register |
Definition at line 359 of file bmp280.c.
References BMP280_SPI, bmp280_t::bus, i2c_transmit(), spi_submit(), and bmp280_t::tx_buffer.
Referenced by bmp280_config().
|
static |
This internal API is used to compensate the raw pressure data and return the compensated pressure data in integer data type.
Definition at line 300 of file bmp280.c.
References bmp280_t::calib, bmp280_reg_calib_data_t::dig_p1, bmp280_reg_calib_data_t::dig_p2, bmp280_reg_calib_data_t::dig_p3, bmp280_reg_calib_data_t::dig_p4, bmp280_reg_calib_data_t::dig_p5, bmp280_reg_calib_data_t::dig_p7, bmp280_reg_calib_data_t::dig_p8, bmp280_reg_calib_data_t::dig_p9, p, bmp280_t::pressure, bmp280_t::raw_pressure, and bmp280_reg_calib_data_t::t_fine.
Referenced by bmp280_event().
|
static |
This internal API is used to compensate the raw temperature data and return the compensated temperature data in float data type.
Definition at line 281 of file bmp280.c.
References bmp280_t::calib, bmp280_reg_calib_data_t::dig_t1, bmp280_reg_calib_data_t::dig_t2, bmp280_reg_calib_data_t::dig_t3, bmp280_t::raw_temperature, bmp280_reg_calib_data_t::t_fine, and bmp280_t::temperature.
Referenced by bmp280_event().
This internal API is used to parse the calibration data, compensates it and store it in device structure (float version).
Definition at line 258 of file bmp280.c.
References BMP280_CONCAT_BYTES, bmp280_t::calib, bmp280_reg_calib_data_t::dig_p1, bmp280_reg_calib_data_t::dig_p2, bmp280_reg_calib_data_t::dig_p3, bmp280_reg_calib_data_t::dig_p4, bmp280_reg_calib_data_t::dig_p5, bmp280_reg_calib_data_t::dig_p6, bmp280_reg_calib_data_t::dig_p7, bmp280_reg_calib_data_t::dig_p8, bmp280_reg_calib_data_t::dig_p9, bmp280_reg_calib_data_t::dig_t1, bmp280_reg_calib_data_t::dig_t2, and bmp280_reg_calib_data_t::dig_t3.
Referenced by bmp280_event().
local function to extract raw data from i2c buffer and compute compensation with selected precision
Definition at line 231 of file bmp280.c.
References bmp280_t::raw_pressure, and bmp280_t::raw_temperature.
Referenced by bmp280_event().