BME280 Driver 2.0.x
Driver for BME280 sensor
Loading...
Searching...
No Matches
BME280_Driver

BME280 Driver. More...

Collaboration diagram for BME280_Driver:

Modules

 Private Resources
 only for internal library purposes
 
 Library Configuration
 Set library options here.
 
 Public functions
 Use these functions only.
 
 BME280 Returnd Values
 Values that can be returned by the driver's functions.
 
 BME280 I2C Address
 Address on I2C bus.
 
 BME280 Registers
 Definition of register addresses and lenghts.
 
 BME280 Settings
 Inernal sensor's settings that can be changed.
 
 Function pointers
 Platform speicific functions.
 
 Public typedefs
 Typedefs for internal calculations.
 

Data Structures

struct  BME280_calibration_data
 Keeps calibration data that were read from sensor. More...
 
struct  BME280_Driver_t
 Keeps all data specific for used platform. More...
 
struct  BME280_t
 Keeps all data related to a single sensor. More...
 
struct  BME280_Config_t
 Contains all sensor's settings. More...
 
struct  BME280_Data_t
 Contains result of measure (no floating points variables) More...
 
struct  BME280_DataF_t
 Contains result of measure (with floating points variables) More...
 

Functions

int8_t BME280_Init (BME280_t *Dev, BME280_Driver_t *Driver)
 Function to initialize sensor and resources.
 
int8_t BME280_ConfigureAll (BME280_t *Dev, BME280_Config_t *Config)
 Function to set all sensor settings at once.
 
int8_t BME280_Reset (BME280_t *Dev)
 Function to perform sensor's software reset.
 
int8_t BME280_GetMode (BME280_t *Dev, uint8_t *Mode)
 Function gets current Operating Mode from sensor.
 
int8_t BME280_GetPOvs (BME280_t *Dev, uint8_t *POvs)
 Function gets current pressure Oversampling from sensor.
 
int8_t BME280_GetTOvs (BME280_t *Dev, uint8_t *TOvs)
 Function gets current temperature Oversampling from sensor.
 
int8_t BME280_GetHOvs (BME280_t *Dev, uint8_t *HOvs)
 Function gets current humidity Oversampling from sensor.
 
int8_t BME280_GetTStby (BME280_t *Dev, uint8_t *TStby)
 Function gets current Standby Time from sensor.
 
int8_t BME280_GetTFilter (BME280_t *Dev, uint8_t *Filter)
 Function gets current IIR Filter coeficient from sensor.
 
int8_t BME280_Is3WireSPIEnabled (BME280_t *Dev, uint8_t *Result)
 Function checks if 3-wire SPI is enabled.
 
int8_t BME280_SetMode (BME280_t *Dev, uint8_t Mode)
 Function sets sensor's Operating Mode.
 
int8_t BME280_SetPOvs (BME280_t *Dev, uint8_t POvs)
 Function sets sensor's pressure Oversampling.
 
int8_t BME280_SetTOvs (BME280_t *Dev, uint8_t TOvs)
 Function sets sensor's temperature Oversampling.
 
int8_t BME280_SetHOvs (BME280_t *Dev, uint8_t HOvs)
 Function sets sensor's humidity Oversampling.
 
int8_t BME280_SetTStby (BME280_t *Dev, uint8_t TStby)
 Function sets sensor's Standby Time.
 
int8_t BME280_SetFilter (BME280_t *Dev, uint8_t Filter)
 Function sets sensor's IIR Filter coeficient.
 
int8_t BME280_Enable3WireSPI (BME280_t *Dev)
 Function enables 3-wire SPI bus.
 
int8_t BME280_Disable3WireSPI (BME280_t *Dev)
 Function disables 3-wire SPI bus.
 
int8_t BME280_ReadAllLast (BME280_t *Dev, BME280_Data_t *Data)
 Function reads all measured data at once.
 
int8_t BME280_ReadTempLast (BME280_t *Dev, int8_t *TempInt, uint8_t *TempFract)
 Function reads last measured temperature.
 
int8_t BME280_ReadPressLast (BME280_t *Dev, uint16_t *PressInt, uint16_t *PressFract)
 Function reads last measured pressure.
 
int8_t BME280_ReadHumLast (BME280_t *Dev, uint8_t *HumInt, uint16_t *HumFract)
 Function reads last measured humidity.
 
int8_t BME280_ReadAllForce (BME280_t *Dev, BME280_Data_t *Data)
 Function forces single measure and returns all data as integers.
 
int8_t BME280_ReadTempForce (BME280_t *Dev, int8_t *TempInt, uint8_t *TempFract)
 Function forces single measure and returns temperatrue as integers (forced mode)
 
int8_t BME280_ReadPressForce (BME280_t *Dev, uint16_t *PressInt, uint16_t *PressFract)
 Function forces single measure and returns pressure as integers (forced mode)
 
int8_t BME280_ReadHumForce (BME280_t *Dev, uint8_t *HumInt, uint16_t *HumFract)
 Function forces single measure and returns humidity as integers (forced mode)
 
int8_t BME280_ReadAllLast_F (BME280_t *Dev, BME280_DataF_t *Data)
 Function reads all measured data at once.
 
int8_t BME280_ReadTempLast_F (BME280_t *Dev, float *Temp)
 Function reads last measured temperature.
 
int8_t BME280_ReadPressLast_F (BME280_t *Dev, float *Press)
 Function reads last measured pressure.
 
int8_t BME280_ReadHumLast_F (BME280_t *Dev, float *Hum)
 Function reads last measured humidity.
 
int8_t BME280_ReadAllForce_F (BME280_t *Dev, BME280_DataF_t *Data)
 Function forces single measure and returns all data as floats.
 
int8_t BME280_ReadTempForce_F (BME280_t *Dev, float *Temp)
 Function forces single measure and returns temperatrue as floats (forced mode)
 
int8_t BME280_ReadPressForce_F (BME280_t *Dev, float *Press)
 Function forces single measure and returns pressure as floats (forced mode)
 
int8_t BME280_ReadHumForce_F (BME280_t *Dev, float *Hum)
 Function forces single measure and returns humidity as floats (forced mode)
 

Detailed Description

BME280 Driver.

Function Documentation

◆ BME280_ConfigureAll()

int8_t BME280_ConfigureAll ( BME280_t Dev,
BME280_Config_t Config 
)

Function to set all sensor settings at once.

Note
Sensor must be in BME280_SLEEPMODE to set all parameters. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function writes all 3 config registers without reading them before. It can be usefull after power-up or reset. It sets current operating mode inside *Dev structure at the end.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]*Configpointer to BME280_Config_t structure which contains all paramaters to be set
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BME280_Disable3WireSPI()

int8_t BME280_Disable3WireSPI ( BME280_t Dev)

Function disables 3-wire SPI bus.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_Enable3WireSPI()

int8_t BME280_Enable3WireSPI ( BME280_t Dev)

Function enables 3-wire SPI bus.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_GetHOvs()

int8_t BME280_GetHOvs ( BME280_t Dev,
uint8_t *  HOvs 
)

Function gets current humidity Oversampling from sensor.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*HOvspointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_GetMode()

int8_t BME280_GetMode ( BME280_t Dev,
uint8_t *  Mode 
)

Function gets current Operating Mode from sensor.

Function updates current operating mode inside *Dev structure as well.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Modepointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_GetPOvs()

int8_t BME280_GetPOvs ( BME280_t Dev,
uint8_t *  POvs 
)

Function gets current pressure Oversampling from sensor.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*POvspointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_GetTFilter()

int8_t BME280_GetTFilter ( BME280_t Dev,
uint8_t *  Filter 
)

Function gets current IIR Filter coeficient from sensor.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Filterpointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_GetTOvs()

int8_t BME280_GetTOvs ( BME280_t Dev,
uint8_t *  TOvs 
)

Function gets current temperature Oversampling from sensor.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*TOvspointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_GetTStby()

int8_t BME280_GetTStby ( BME280_t Dev,
uint8_t *  TStby 
)

Function gets current Standby Time from sensor.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*TStbypointer to vartiable where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_Init()

int8_t BME280_Init ( BME280_t Dev,
BME280_Driver_t Driver 
)

Function to initialize sensor and resources.

Note
This must be a first function usend in code before any other opearion can be performed!

Init funtion performs sensor reset and checks BME280_ID. It doesn't set any sensor's parameters. Calibration data specific for each one sensor are read while Init function. If operation is completed with success function sets "initialized" value in BME280_t structure.

Parameters
[in]*Devpointer to BME280_t structure which should be initialized
[in]*Driverpointer to BME280_Driver_t structure where all platform specific data are stored. This structure MUST exist while program is running - do not use local structures to init sensor!
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_ID_ERR sensor's id doesnt match with BME280_ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BME280_Is3WireSPIEnabled()

int8_t BME280_Is3WireSPIEnabled ( BME280_t Dev,
uint8_t *  Result 
)

Function checks if 3-wire SPI is enabled.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Resultpointer to vartiable where result will be stored, 0 - disabled, 1 - enabled
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_NO_INIT_ERR sensor was not initialized before
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the call graph for this function:

◆ BME280_ReadAllForce()

int8_t BME280_ReadAllForce ( BME280_t Dev,
BME280_Data_t Data 
)

Function forces single measure and returns all data as integers.

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads all adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into BME280_Data_t structure.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Datapointer to structure where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BME280_ReadAllForce_F()

int8_t BME280_ReadAllForce_F ( BME280_t Dev,
BME280_DataF_t Data 
)

Function forces single measure and returns all data as floats.

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads all adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into BME280_DataF_t structure.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Datapointer to structure where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadAllLast()

int8_t BME280_ReadAllLast ( BME280_t Dev,
BME280_Data_t Data 
)

Function reads all measured data at once.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads all adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into BME280_Data_t structure.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Datapointer to structure where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BME280_ReadAllLast_F()

int8_t BME280_ReadAllLast_F ( BME280_t Dev,
BME280_DataF_t Data 
)

Function reads all measured data at once.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads all adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into BME280_DataF_t structure.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Datapointer to structure where result will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadHumForce()

int8_t BME280_ReadHumForce ( BME280_t Dev,
uint8_t *  HumInt,
uint16_t *  HumFract 
)

Function forces single measure and returns humidity as integers (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperarure and humidity related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into integer (*HumInt) and fractial part (*HumFract).

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*HumIntpointer to variable where integer part of humidity will be stored
[out]*HumFractpointer to variable where fractial part of humidity will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadHumForce_F()

int8_t BME280_ReadHumForce_F ( BME280_t Dev,
float *  Hum 
)

Function forces single measure and returns humidity as floats (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperature and humidity related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into float.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Humpointer to variable where humidity will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadHumLast()

int8_t BME280_ReadHumLast ( BME280_t Dev,
uint8_t *  HumInt,
uint16_t *  HumFract 
)

Function reads last measured humidity.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature and humidity related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated value is then converted into integer part and fractial part and stored in external variables

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*HumIntpointer to variable where integer part of humidity will be stored
[out]*HumFractpointer to variable where fractial part of humidity will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadHumLast_F()

int8_t BME280_ReadHumLast_F ( BME280_t Dev,
float *  Hum 
)

Function reads last measured humidity.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature and humidity related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated value is then converted into floating point value and stored in external variable

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Humpointer to variable where temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadPressForce()

int8_t BME280_ReadPressForce ( BME280_t Dev,
uint16_t *  PressInt,
uint16_t *  PressFract 
)

Function forces single measure and returns pressure as integers (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperarure and pressure related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into integer (*PressInt) and fractial part (*PressFract).

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*PressIntpointer to variable where integer part of pressure will be stored
[out]*PressFractpointer to variable where fractial part of pressure will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadPressForce_F()

int8_t BME280_ReadPressForce_F ( BME280_t Dev,
float *  Press 
)

Function forces single measure and returns pressure as floats (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperature and pressure related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into float.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Presspointer to variable where pressure will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadPressLast()

int8_t BME280_ReadPressLast ( BME280_t Dev,
uint16_t *  PressInt,
uint16_t *  PressFract 
)

Function reads last measured pressure.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature and pressure related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated value is then converted into integer part and fractial part and stored in external variables

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*PressIntpointer to variable where integer part of pressure will be stored
[out]*PressFractpointer to variable where fractial part of pressure will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadPressLast_F()

int8_t BME280_ReadPressLast_F ( BME280_t Dev,
float *  Press 
)

Function reads last measured pressure.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature and pressure related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated value is then converted into floating point value and stored in external variable

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Presspointer to variable where temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadTempForce()

int8_t BME280_ReadTempForce ( BME280_t Dev,
int8_t *  TempInt,
uint8_t *  TempFract 
)

Function forces single measure and returns temperatrue as integers (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperature related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into integer (*TempInt) and fractial part (*TempFract).

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*TempIntpointer to variable where integer part of temperature will be stored
[out]*TempFractpointer to variable where fractial part of temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadTempForce_F()

int8_t BME280_ReadTempForce_F ( BME280_t Dev,
float *  Temp 
)

Function forces single measure and returns temperatrue as floats (forced mode)

Note
Sensor must be in BME280_SLEEPMODE to force a single measurement.

Function reads sensor's configuration to check conditions and calculate max. delay time required for measure cycle. Then sends command to force single measurement and calls used-defined delay function. When delay function returns ir reads temperature related adc values from sensor, converts them into single variables and compensate with use BME280_calibration_data. Compensated values are then converted into float.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Temppointer to variable where temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
BME280_BUSY_ERR sensor is busy so cannot proceed
Here is the call graph for this function:

◆ BME280_ReadTempLast()

int8_t BME280_ReadTempLast ( BME280_t Dev,
int8_t *  TempInt,
uint8_t *  TempFract 
)

Function reads last measured temperature.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature related adc values from sensor, converts them into single variable and compensate with use BME280_calibration_data. Compensated value is then converted into integer part and fractial part and stored in external variables

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*TempIntpointer to variable where integer part of temperature will be stored
[out]*TempFractpointer to variable where fractial part of temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_ReadTempLast_F()

int8_t BME280_ReadTempLast_F ( BME280_t Dev,
float *  Temp 
)

Function reads last measured temperature.

Note
Sensor must be in BME280_NORMALMODE to read last measured values.

Function reads temperature related adc values from sensor, converts them into single variable and compensate with use BME280_calibration_data. Compensated value is then converted into floating point value and stored in external variable

Parameters
[in]*Devpointer to sensor's BME280_t structure
[out]*Temppointer to variable where temperature will be stored
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_NORMALMODE
Here is the call graph for this function:

◆ BME280_Reset()

int8_t BME280_Reset ( BME280_t Dev)

Function to perform sensor's software reset.

Function sends BME280_RESET_VALUE to BME280_RESET_ADDR. To perform this operation bme280_writeregister function must be set inside BME280_t *Dev structure. Function sets "sleep_mode" inside *Dev structure after reset.

Parameters
[in]*Devpointer to sensor's BME280_t structure
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed or bme280_writeregister function is not set
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
Here is the caller graph for this function:

◆ BME280_SetFilter()

int8_t BME280_SetFilter ( BME280_t Dev,
uint8_t  Filter 
)

Function sets sensor's IIR Filter coeficient.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]Filtervalue to be set, must be in range of IIR Filter
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_SetHOvs()

int8_t BME280_SetHOvs ( BME280_t Dev,
uint8_t  HOvs 
)

Function sets sensor's humidity Oversampling.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]HOvsvalue to be set, must be in range of Oversampling
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_SetMode()

int8_t BME280_SetMode ( BME280_t Dev,
uint8_t  Mode 
)

Function sets sensor's Operating Mode.

Function reads single register from sensor, and checks if current mode matches mode requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value, then sets correct operating mode inside *Dev structure.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]Modevalue to be set, must be in range of Operating Mode
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
Here is the call graph for this function:

◆ BME280_SetPOvs()

int8_t BME280_SetPOvs ( BME280_t Dev,
uint8_t  POvs 
)

Function sets sensor's pressure Oversampling.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]POvsvalue to be set, must be in range of Oversampling
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_SetTOvs()

int8_t BME280_SetTOvs ( BME280_t Dev,
uint8_t  TOvs 
)

Function sets sensor's temperature Oversampling.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]TOvsvalue to be set, must be in range of Oversampling
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function:

◆ BME280_SetTStby()

int8_t BME280_SetTStby ( BME280_t Dev,
uint8_t  TStby 
)

Function sets sensor's Standby Time.

Note
Sensor must be in BME280_SLEEPMODE to set this parameter. Force BME280_SLEEPMODE with BME280_SetMode function before or use it directly after BME280_Init function only.

Function reads single register from sensor, and checks if current value matches value requested by user. If matches, function skips write operation and returns BME280_OK. If doesnt, it prepares and sends new register value.

Parameters
[in]*Devpointer to sensor's BME280_t structure
[in]TStbyvalue to be set, must be in range of Standby Time
Returns
BME280_OK success
BME280_PARAM_ERR wrong parameter passed
BME280_INTERFACE_ERR user defined read/write function returned non-zero value
BME280_NO_INIT_ERR sensor was not initialized before
BME280_CONDITION_ERR sensor is not in BME280_SLEEPMODE
Here is the call graph for this function: