20 #include "thunderboard/bmp.h"
38 static int8_t i2cBusRead ( uint8_t devAddr, uint8_t regAddr, uint8_t *regData, uint8_t count );
39 static int8_t i2cBusWrite ( uint8_t devAddr, uint8_t regAddr, uint8_t *regData, uint8_t count );
40 static uint8_t readRegister ( uint8_t addr );
46 static uint8_t bmpDeviceId;
47 static uint8_t bmp280PowerMode;
86 bmp280.bus_write = i2cBusWrite;
87 bmp280.bus_read = i2cBusRead;
109 bmp280PowerMode = BMP280_FORCED_MODE;
111 *deviceId = bmpDeviceId;
172 int32_t uncompPressure;
175 if( bmp280PowerMode == BMP280_NORMAL_MODE ) {
182 if( result != SUCCESS ) {
183 return (uint32_t) result;
187 *temperature = (float) compTemp;
188 *temperature /= 100.0f;
210 int32_t uncompPressure;
211 uint32_t compPressure;
213 if( bmp280PowerMode == BMP280_NORMAL_MODE ) {
215 if( result == SUCCESS ){
223 if( result != SUCCESS ) {
224 return (uint32_t) result;
230 *pressure = (float) compPressure;
251 static uint8_t readRegister( uint8_t addr )
295 static int8_t i2cBusWrite( uint8_t devAddr, uint8_t regAddr, uint8_t *regData, uint8_t count )
301 seq.
addr = devAddr << 1;
338 static int8_t i2cBusRead( uint8_t devAddr, uint8_t regAddr, uint8_t *regData, uint8_t count )
344 seq.
addr = devAddr << 1;
BMP280_RETURN_FUNCTION_TYPE bmp280_init(struct bmp280_t *bmp280)
This function is used for initialize the bus read and bus write functions and assign the chip id and ...
I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
Perform I2C transfer.
void BMP_deInit(void)
De-initializes the barometric pressure module.
uint32_t BMP_getPressure(float *pressure)
Initiates pressure measurement on the barometric pressure sensor and reads pressure from it...
uint32_t BMP_getTemperature(float *temperature)
Initiates temperature measurement on the barometric pressure sensor and reads pressure from it...
BMP280_RETURN_FUNCTION_TYPE bmp280_set_power_mode(u8 v_power_mode_u8)
This API used to set the Operational Mode from the sensor in the register 0xF4 bit 0 and 1...
void UTIL_delay(uint32_t ms)
Delays number of msTick Systicks (1 ms)
u32 bmp280_compensate_pressure_int64(s32 v_uncomp_pressure_s32)
This API used to read actual pressure from uncompensated pressure.
BMP280 Sensor Driver Support Header File.
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_temperature(s32 *v_uncomp_temperature_s32)
This API is used to read uncompensated temperature in the registers 0xFA, 0xFB and 0xFC...
void(* delay_msec)(BMP280_MDELAY_DATA_TYPE)
I2C_TransferReturn_TypeDef
BMP280_RETURN_FUNCTION_TYPE bmp280_read_uncomp_pressure(s32 *v_uncomp_pressure_s32)
This API is used to read uncompensated pressure. in the registers 0xF7, 0xF8 and 0xF9.
uint32_t BOARD_envSensEnable(bool enable)
Enables or disables the environmental sensor group (Pressure, RH/Temp, UV/Ambient light and Hall sens...
Structure to configure the BMP280 device.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_work_mode(u8 v_work_mode_u8)
This API is used to write the working mode of the sensor.
I2C simple poll-based master mode driver for the DK/STK.
#define BMP_ERROR_I2C_TRANSACTION_FAILED
Utility Functions for the Thunderboard Sense.
struct I2C_TransferSeq_TypeDef::@0 buf[2]
#define BMP_DEVICE_ID_BMP280
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to...
s32 bmp280_compensate_temperature_int32(s32 v_uncomp_temperature_s32)
Reads actual temperature from uncompensated temperature.
BMP280_RETURN_FUNCTION_TYPE bmp280_get_forced_uncomp_pressure_temperature(s32 *v_uncomp_pressure_s32, s32 *v_uncomp_temperature_s32)
This API used to read both uncompensated pressure and temperature in forced mode. ...
#define I2C_FLAG_WRITE_WRITE
Indicate write sequence using two buffers: S+ADDR(W)+DATA0+DATA1+P.
EMSTATUS BMP_init(uint8_t *palette, uint32_t paletteSize, EMSTATUS(*fp)(uint8_t buffer[], uint32_t bufLength, uint32_t bytesToRead))
Initializes BMP Module.
#define I2C_FLAG_WRITE_READ
Indicate combined write/read sequence: S+ADDR(W)+DATA0+Sr+ADDR(R)+DATA1+P.
uint16_t addr
Address to use after (repeated) start.
BMP280_RETURN_FUNCTION_TYPE bmp280_set_standby_durn(u8 v_standby_durn_u8)
This API used to Read the standby duration time from the sensor in the register 0xF5 bit 5 to 7...
BOARD module header file.
#define BMP_ERROR_DEVICE_ID_MISMATCH
#define BMP_I2C_BUS_ADDRESS
This structure holds BMP280 initialization parameters.
uint32_t BMP_config(BMP_Config *cfg)
Configure the barometric pressure sensor.