Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
bmp280.h File Reference

Sensor driver for BMP280 sensor. More...

+ Include dependency graph for bmp280.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bmp280_i2c_t
 
struct  bmp280_spi_t
 
struct  bmp280_reg_calib_data_t
 
struct  bmp280_t
 
union  bmp280_t.__unnamed315__
 

Enumerations

enum  bmp280_bus_t { BMP280_SPI , BMP280_I2C }
 
enum  bmp_device_t { BMP_UNKOWN , BMP_280 }
 
enum  bmp280_status_t {
  BMP280_STATUS_UNINIT , BMP280_STATUS_IDLE , BMP280_STATUS_GET_CALIB , BMP280_STATUS_CONFIGURE ,
  BMP280_STATUS_READ_STATUS_REG , BMP280_STATUS_READ_DATA_REGS
}
 

Functions

void bmp280_read_eeprom_calib (struct bmp280_t *bmp)
 
void bmp280_init (struct bmp280_t *bmp)
 Initialize the bmp280 sensor instance. More...
 
void bmp280_periodic (struct bmp280_t *bmp)
 Should be called periodically to request sensor readings. More...
 
void bmp280_event (struct bmp280_t *bmp)
 Should be called in the event thread. More...
 

Detailed Description

Sensor driver for BMP280 sensor.

Definition in file bmp280.h.


Data Structure Documentation

◆ bmp280_i2c_t

struct bmp280_i2c_t

Definition at line 36 of file bmp280.h.

+ Collaboration diagram for bmp280_i2c_t:
Data Fields
struct i2c_periph * p Peripheral device for communication.
uint8_t slave_addr The I2C slave address on the bus.
struct i2c_transaction trans Transaction used during configuration and measurements.

◆ bmp280_spi_t

struct bmp280_spi_t

Definition at line 42 of file bmp280.h.

+ Collaboration diagram for bmp280_spi_t:
Data Fields
struct spi_periph * p Peripheral device for communication.
uint8_t rx_buf[50]
uint8_t slave_idx Slave index used for Slave Select.
struct spi_transaction trans Transaction used during configuration and measurements.
uint8_t tx_buf[50] Transmit buffer.

◆ bmp280_reg_calib_data_t

struct bmp280_reg_calib_data_t

Definition at line 73 of file bmp280.h.

Data Fields
uint16_t dig_p1
int16_t dig_p2
int16_t dig_p3
int16_t dig_p4
int16_t dig_p5
int16_t dig_p6
int16_t dig_p7
int16_t dig_p8
int16_t dig_p9
uint16_t dig_t1
int16_t dig_t2
int16_t dig_t3
int64_t t_fine

◆ bmp280_t

struct bmp280_t

Definition at line 90 of file bmp280.h.

+ Collaboration diagram for bmp280_t:
Data Fields
union bmp280_t __unnamed__
enum bmp280_bus_t bus The communication bus used to connect the device SPI/I2C.
struct bmp280_reg_calib_data_t calib calibration data
uint8_t config_idx The current configuration index.
volatile bool data_available data ready flag
enum bmp_device_t device The device type detected.
bool initialized config done flag
float pressure pressure in Pascal
uint32_t raw_pressure uncompensated pressure
uint32_t raw_temperature uncompensated temperature
uint8_t * rx_buffer
uint16_t * rx_length
enum bmp280_status_t status state machine status
float temperature temperature in deg Celcius
uint8_t * tx_buffer

◆ bmp280_t.__unnamed315__

union bmp280_t.__unnamed315__

Definition at line 101 of file bmp280.h.

Data Fields
struct bmp280_i2c_t i2c I2C specific configuration.
struct bmp280_spi_t spi SPI specific configuration.

Enumeration Type Documentation

◆ bmp280_bus_t

Enumerator
BMP280_SPI 
BMP280_I2C 

Definition at line 52 of file bmp280.h.

◆ bmp280_status_t

Enumerator
BMP280_STATUS_UNINIT 
BMP280_STATUS_IDLE 
BMP280_STATUS_GET_CALIB 
BMP280_STATUS_CONFIGURE 
BMP280_STATUS_READ_STATUS_REG 
BMP280_STATUS_READ_DATA_REGS 

Definition at line 63 of file bmp280.h.

◆ bmp_device_t

Enumerator
BMP_UNKOWN 
BMP_280 

Definition at line 57 of file bmp280.h.

Function Documentation

◆ bmp280_event()

void bmp280_event ( struct bmp280_t bmp)

Should be called in the event thread.

  • Configures the sensor and reads the responses
  • Parse and request the sensor data
Parameters
bmpThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bmp280_init()

void bmp280_init ( struct bmp280_t bmp)

Initialize the bmp280 sensor instance.

Parameters
bmpThe structure containing the configuration of the bmp280 instance

Definition at line 48 of file bmp280.c.

References BMP280_SPI, BMP280_STATUS_UNINIT, I2CTransDone, SPICphaEdge2, SPICpolIdleHigh, SPIDiv16, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, and SPITransDone.

Referenced by baro_bmp280_init().

+ Here is the caller graph for this function:

◆ bmp280_periodic()

void bmp280_periodic ( struct bmp280_t bmp)

Should be called periodically to request sensor readings.

  • First detects the sensor using WHO_AM_I reading
  • Configures the sensor according the users requested configuration
  • Requests a sensor reading
Parameters
bmpThe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bmp280_read_eeprom_calib()

void bmp280_read_eeprom_calib ( struct bmp280_t bmp)