BAP - Barometric Pressure SensorBSP > Thunderboard Sense BSP

Detailed Description

Driver for the Bosch Sensortec BMP280 pressure sensor.

Data Structures

struct  __BAP_Config
 Structure to configure the BMP280 device.
 

Typedefs

typedef struct __BAP_Config BAP_Config
 Structure to configure the BMP280 device.
 

Functions

uint32_t BAP_config (BAP_Config *cfg)
 Configure the barometric pressure sensor.
 
void BAP_deInit (void)
 De-initializes the barometric pressure module.
 
uint32_t BAP_getPressure (float *pressure)
 Initiates pressure measurement on the barometric pressure sensor and reads pressure from it.
 
uint32_t BAP_getTemperature (float *temperature)
 Initiates temperature measurement on the barometric pressure sensor and reads pressure from it.
 
uint32_t BAP_init (uint8_t *deviceId)
 Initializes the barometric pressure sensor chip.
 

Error Codes

#define BAP_OK   0x0000
 
#define BAP_ERROR_DRIVER_NOT_INITIALIZED   0x0001
 
#define BAP_ERROR_I2C_TRANSACTION_FAILED   0x0002
 
#define BAP_ERROR_DEVICE_ID_MISMATCH   0x0003
 

Macro Definition Documentation

#define BAP_ERROR_DEVICE_ID_MISMATCH   0x0003

The device ID does not match the expected value

Definition at line 48 of file bap.h.

Referenced by BAP_init().

#define BAP_ERROR_DRIVER_NOT_INITIALIZED   0x0001

The driver is not initialized

Definition at line 46 of file bap.h.

#define BAP_ERROR_I2C_TRANSACTION_FAILED   0x0002

I2C transaction failed

Definition at line 47 of file bap.h.

#define BAP_OK   0x0000

No errors

Definition at line 45 of file bap.h.

Referenced by BAP_getPressure(), BAP_getTemperature(), and BAP_init().

Function Documentation

uint32_t BAP_config ( BAP_Config cfg)

Configure the barometric pressure sensor.

Parameters
[in]cfgStructure, which holds the configuration parameters
Returns
Returns zero on OK, non-zero otherwise

Definition at line 158 of file bap.c.

References bmp280_set_power_mode(), bmp280_set_standby_durn(), bmp280_set_work_mode(), __BAP_Config::oversampling, __BAP_Config::powerMode, and __BAP_Config::standbyTime.

void BAP_deInit ( void  )

De-initializes the barometric pressure module.

Returns
None

Definition at line 138 of file bap.c.

References bmp280_set_power_mode(), and BOARD_bapEnable().

uint32_t BAP_getPressure ( float *  pressure)

Initiates pressure measurement on the barometric pressure sensor and reads pressure from it.

Parameters
[out]pressureThe measured pressure in millibars
Returns
Returns zero on OK, non-zero otherwise

Definition at line 218 of file bap.c.

References BAP_OK, bmp280_compensate_pressure_int64(), bmp280_compensate_temperature_int32(), bmp280_get_forced_uncomp_pressure_temperature(), bmp280_read_uncomp_pressure(), and bmp280_read_uncomp_temperature().

uint32_t BAP_getTemperature ( float *  temperature)

Initiates temperature measurement on the barometric pressure sensor and reads pressure from it.

Parameters
[out]temperatureThe measured temperature in degrees Celsius
Returns
Returns zero on OK, non-zero otherwise

Definition at line 183 of file bap.c.

References BAP_OK, bmp280_compensate_temperature_int32(), bmp280_get_forced_uncomp_pressure_temperature(), and bmp280_read_uncomp_temperature().

uint32_t BAP_init ( uint8_t *  deviceId)

Initializes the barometric pressure sensor chip.

Parameters
[out]deviceIdThe device ID of the connected chip
Returns
Returns zero on OK, non-zero otherwise

Definition at line 84 of file bap.c.

References BAP_ERROR_DEVICE_ID_MISMATCH, BAP_OK, bmp280_init(), bmp280_set_power_mode(), bmp280_set_work_mode(), BOARD_bapEnable(), bmp280_t::delay_msec, bmp280_t::dev_addr, and UTIL_delay().