CHENGQI YANG / BME680

Dependents:   Example_DS3231_test

Embed: (wiki syntax)

« Back to documentation index

BME680 Class Reference

BME680 Class Reference

!! MUST CALL init() FIRST !! read the chip id and calibration data of the BME680 sensor BME680 integrated environmental sensor. More...

#include <BME680.h>

Public Member Functions

void setSequentialMode ()
 TPHG measurements are performed.
void setForcedMode ()
 Single TPHG cycle is performed.
void setParallelMode ()
 TPHG measurements are performed continuously until mode change.
bool init ()
 !! MUST CALL THIS FIRST !! read the chip id and calibration data of the BME680 sensor
int32_t getCompensatedTemperature (int field=0)
 This function is used to convert the uncompensated temperature data to compensated temperature data using compensation formula(integer version)
int16_t getTemperatureInt (int field=0)
 Reads actual temperature from uncompensated temperature.
int32_t getCompensateHumidity (int field=0)
 This function is used to convert the uncompensated humidity data to compensated humidity data using compensation formula(integer version)
uint16_t getHumidityInt (int field=0)
 Reads actual humidity from uncompensated humidity.
int32_t getCompensatePressure (int field=0)
 This function is used to convert the uncompensated pressure data to compensated pressure data data using compensation formula(integer version)
uint32_t getPressureInt (int field=0)
 Reads actual pressure from uncompensated pressure.
uint8_t convertTemperatureResistanceInt (uint16_t heater, int16_t ambient)
 This function is used to convert temperature to resistance using the integer compensation formula.
int32_t getCalculateGasInt (int field=0)
 This function is used to convert uncompensated gas data to compensated gas data using compensation formula(integer version)
double getTemperatureDouble (int field=0)
 This function used to convert temperature data to uncompensated temperature data using compensation formula.
double getHumidityDouble (int field=0)
 This function is used to convert the uncompensated humidity data to compensated humidity data data using compensation formula.
double getPressureDouble (int field=0)
 This function is used to convert the uncompensated pressure data to compensated data using compensation formula.
double convertTemperatureResistanceDouble (uint16_t heater, int16_t ambient)
 This function is used to convert temperature to resistance using the compensation formula.
double getCalculateGasDouble (int field=0)
 This function is used to convert uncompensated gas data to compensated gas data using compensation formula.
uint32_t getUncompensatedPressureData (int field=0)
 [press_msb] [press_lsb] [press_xlsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.
uint32_t getUncompensatedTemp1Data (int field=0)
 [temp1_msb] [temp1_lsb] [temp1_xlsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.
uint32_t getUncompensatedHumidityData (int field=0)
 [hum_msb] [hum_lsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.
uint16_t getUncompensatedGasResistanceData (int field=0)
 [gas_rl] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.
uint8_t getGasResistanceRange (int field=0)
 [gas_range_rl] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.
bool isNewData (int field=0)
 [new_data_x] The measured data are stored into the output data registers at the end of each TPHG conversion phase along with status flags and index of measurement.
bool isGasMeasuring (int field=0)
 [gas_measuring] Measuring bit is set to “1‟ only during gas measurements, goes to “0‟ as soon as measurement is completed and data transferred to data registers.
bool isMeasuring (int field=0)
 [measuring] Measuring status will be set to ‘1’ whenever a conversion (Pressure, Temperature, humidity & gas) is running and back to ‘0’ when the results have been transferred to the data registers.
int getGasMeasurementIndex (int field=0)
 [gas_meas_index_x] User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.
int getSubMeasurementIndex (int field=0)
 [sub_meas_index_x] sub_meas_index_x registers form “virtual time sensor” and contain a snapshot of the internal 8 bit conversion counter.
bool isGasValid (int field=0)
 [gas_valid_rl] In parallel mode, each TPHG sequence contains a gas measurement slot, either a real one which result is used or a dummy one to keep a constant sampling rate and predictable device timing.
bool isHeaterStable (int field=0)
 [heat_stab_rl] Heater temperature stability for target heater resistance is indicated heat_stab_x status bits.
uint8_t getHeaterCurrent (int setPoint)
 [idac_heat_x] BME680 contains a heater control block that will inject enough current into the heater resistance to achieve the requested heater temperature.
void setHeaterCurrent (int setPoint, uint8_t value)
 [idac_heat_x] BME680 contains a heater control block that will inject enough current into the heater resistance to achieve the requested heater temperature.
int8_t getTargetHeaterResistance (int setPoint)
 [res_heat_x] Target heater resistance is programmed by user through res_heat_x<7:0> registers.
void setTargetHeaterResistance (int setPoint, int8_t value)
 [res_heat_x] Target heater resistance is programmed by user through res_heat_x<7:0> registers.
int getGasWaitTime (int setPoint)
 [gas_wait_x] gas_wait_x controls heater timing of the gas sensor.
void setGasWaitTime (int setPoint, int time, int multiplication)
 [gas_wait_x] gas_wait_x controls heater timing of the gas sensor.
int getGasWaitShared ()
 [gas_wait_shared] The programmable wait time between two TPHG sub-measurement sequences of parallel mode depends on gas_wait_shared settings as follows
void setGasWaitShared (int time, int multiplication)
 [gas_wait_shared] The programmable wait time between two TPHG sub-measurement sequences of parallel mode depends on gas_wait_shared settings as follows
void setHeaterOff ()
 [heat_off] Turn off current injected to heater
int getHeaterProfile ()
 [nb_conv] is used to select heater set-points of BME680 Sequential & Parallel Mode User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.
void setHeaterProfile (int value)
 [nb_conv] is used to select heater set-points of BME680 Sequential & Parallel Mode User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.
void runGasConversion ()
 [run_gas_l] The gas conversions are started only in appropriate mode if run_gas_l=1
float getWakePeriod ()
 [odr] Wake period in sequential mode – odr In the sequential mode operation the device periodically enters stand-by state and returns to an operational state after a given wake-up period.
void setWakePeriod (int value)
 [odr] Wake period in sequential mode – odr In the sequential mode operation the device periodically enters stand-by state and returns to an operational state after a given wake-up period.
int getOversamplingHumidity ()
 [osrs_h]
void setOversamplingHumidity (int value)
 [osrs_h]
int getOversamplingPressure ()
 [osrs_p]
void setOversamplingPressure (int value)
 [osrs_p]
int getOversamplingTemperature ()
 [osrs_t]
void setOversamplingTemperature (int value)
 [osrs_t]
int getIIRfilterCoefficient ()
 [filter] IIR filter control IIR filter applies to temperature and pressure data but not to humidity and gas data.
void setIIRfilterCoefficient (int value)
 [filter] IIR filter control IIR filter applies to temperature and pressure data but not to humidity and gas data.
void setMode (int mode)
 [mode] Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.
int getMode ()
 [mode] Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.
int getChipID ()
 [chip_id] Chip id of the device, this should give 0x61

Detailed Description

!! MUST CALL init() FIRST !! read the chip id and calibration data of the BME680 sensor BME680 integrated environmental sensor.

This API supports FIXED and FLOATING compenstion. By default it supports FIXED, to use FLOATING user need to disable "FIXED_POINT_COMPENSATION" in the BME680.h file.

Definition at line 41 of file BME680.h.


Member Function Documentation

double convertTemperatureResistanceDouble ( uint16_t  heater,
int16_t  ambient 
)

This function is used to convert temperature to resistance using the compensation formula.

Parameters:
heater_temp_u16,:The value of heater temperature
ambient_temp_s16,:The value of ambient temperature
bme680,:structure pointer.
Returns:
calculated resistance from temperature

Definition at line 344 of file BME680.cpp.

uint8_t convertTemperatureResistanceInt ( uint16_t  heater,
int16_t  ambient 
)

This function is used to convert temperature to resistance using the integer compensation formula.

Parameters:
heater_temp_u16,:The value of heater temperature
ambient_temp_s16,:The value of ambient temperature
bme680,:structure pointer.
Returns:
calculated resistance from temperature

Definition at line 236 of file BME680.cpp.

double getCalculateGasDouble ( int  field = 0 )

This function is used to convert uncompensated gas data to compensated gas data using compensation formula.

Parameters:
gas_adc_u16,:The value of gas resistance calculated using temperature
gas_range_u8,:The value of gas range form register value
bme680,:structure pointer.
Returns:
calculated compensated gas from compensation formula
Return values:
compensatedgas

Definition at line 373 of file BME680.cpp.

int32_t getCalculateGasInt ( int  field = 0 )

This function is used to convert uncompensated gas data to compensated gas data using compensation formula(integer version)

Parameters:
gas_adc_u16,:The value of gas resistance calculated using temperature
gas_range_u8,:The value of gas range form register value
bme680,:structure pointer.
Returns:
calculated compensated gas from compensation formula
Return values:
compensatedgas data

Definition at line 260 of file BME680.cpp.

int getChipID (  )

[chip_id] Chip id of the device, this should give 0x61

Definition at line 802 of file BME680.cpp.

int32_t getCompensatedTemperature ( int  field = 0 )

This function is used to convert the uncompensated temperature data to compensated temperature data using compensation formula(integer version)

Note:
Returns the value in 0.01 degree Centigrade Output value of "5123" equals 51.23 DegC.
Parameters:
field0-2
Returns:
Returns the compensated temperature data

Definition at line 137 of file BME680.cpp.

int32_t getCompensateHumidity ( int  field = 0 )

This function is used to convert the uncompensated humidity data to compensated humidity data using compensation formula(integer version)

Note:
Returns the value in rH as unsigned 32bit integer in Q22.10 format(22 integer 10 fractional bits).
An output value of 42313 represents 42313 / 1024 = 41.321 rH
Parameters:
v_uncomp_humidity_u32,:value of uncompensated humidity
bme680,:structure pointer.
Returns:
Return the compensated humidity data

Definition at line 154 of file BME680.cpp.

int32_t getCompensatePressure ( int  field = 0 )

This function is used to convert the uncompensated pressure data to compensated pressure data data using compensation formula(integer version)

Note:
Returns the value in Pascal(Pa) Output value of "96386" equals 96386 Pa = 963.86 hPa = 963.86 millibar
Parameters:
v_uncomp_pressure_u32: value of uncompensated pressure
bme680,:structure pointer.
Returns:
Return the compensated pressure data

Definition at line 195 of file BME680.cpp.

int getGasMeasurementIndex ( int  field = 0 )

[gas_meas_index_x] User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.

Each conversion has its own heater resistance target but 3 field registers to store conversion results. The actual gas conversion number in the measurement sequence (up to 10 conversions numbered from 0 to 9) is stored in gas_meas_index register.

Parameters:
field0-2

Definition at line 538 of file BME680.cpp.

uint8_t getGasResistanceRange ( int  field = 0 )

[gas_range_rl] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.

The data fields are updated sequentially and always results of the three latest measurements are available for the user; if the last but one conversion was written to field number k, the current conversion results are written to field with number (k+1) mod 3. All data outputs from data fields are buffered using shadowing registers to ensure keeping stable data if update of the data registers comes simultaneously with serial interface reading out. Contains ADC range of measured gas resistance Note: Only field0 will be updated in forced mode

Parameters:
field0-2

Definition at line 514 of file BME680.cpp.

int getGasWaitShared (  )

[gas_wait_shared] The programmable wait time between two TPHG sub-measurement sequences of parallel mode depends on gas_wait_shared settings as follows

Definition at line 595 of file BME680.cpp.

int getGasWaitTime ( int  setPoint )

[gas_wait_x] gas_wait_x controls heater timing of the gas sensor.

Functionality of this register will vary based on power modes. Forced Mode & Sequential mode Time between beginning of heat phase and start of sensor resistance conversion depend on gas_wait_x settings as mentioned below. Parallel Mode The number of TPHG sub-measurement sequences within the one Gas conversion for one target temperature resistance is defined by gas_wait_x settings. Note: Please take care about gas_wait_x on shifting modes between parallel & sequential/forced mode as register functionality will change.

Returns:
result * 0.477 ms
Parameters:
setPoint0-9

Definition at line 584 of file BME680.cpp.

uint8_t getHeaterCurrent ( int  setPoint )

[idac_heat_x] BME680 contains a heater control block that will inject enough current into the heater resistance to achieve the requested heater temperature.

There is a control loop which periodically measures heater resistance value and adapts the value of current injected from a DAC. BME680 heater operation could be speeded up by setting an initial heater current for a target heater temperature by using register idac_heat_x<7:0>. This step is optional since the control loop will find the current after a few iterations anyway. Current injected to the heater in mA = (idac_heat_7_1 + 1) / 8 Where: idac_heat_7_1 = decimal value stored in idac_heat<7:1> (unsigned, value from 0 to 127)

Parameters:
setPoint0-9

Definition at line 562 of file BME680.cpp.

int getHeaterProfile (  )

[nb_conv] is used to select heater set-points of BME680 Sequential & Parallel Mode User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.

Each conversion has its own heater resistance target but 3 field registers to store conversion results. The actual gas conversion number in the measurement sequence (up to 10 conversions numbered from 0 to 9) is stored in gas measurement index register In parallel mode, no TPH conversions are ran at all. In sequential mode, TPH conversions are run according to osrs_t|p|h settings, gas is skipped

Returns:
Sequential & Parallel : number of profiles (0-10), 0 means no gas conversion
Forced : indicates index of heater profile

Definition at line 613 of file BME680.cpp.

double getHumidityDouble ( int  field = 0 )

This function is used to convert the uncompensated humidity data to compensated humidity data data using compensation formula.

Note:
returns the value in relative humidity (rH)
Output value of "42.12" equals 42.12 rH
Parameters:
uncom_humidity_u16: value of uncompensated humidity
comp_temperature: value of compensated temperature
bme680,:structure pointer.
Returns:
Return the compensated humidity data in floating point

Definition at line 293 of file BME680.cpp.

uint16_t getHumidityInt ( int  field = 0 )

Reads actual humidity from uncompensated humidity.

Note:
Returns the value in rH as unsigned 16bit integer
An output value of 42313 represents 42313/512 = 82.643 rH
Parameters:
v_uncomp_humidity_u32,:value of uncompensated humidity
bme680,:structure pointer.
Returns:
Return the actual relative humidity output as u16

Definition at line 188 of file BME680.cpp.

int getIIRfilterCoefficient (  )

[filter] IIR filter control IIR filter applies to temperature and pressure data but not to humidity and gas data.

The data coming from the ADC are filtered and then loaded into the data registers. The T, P result registers are updated together at the same time at the end of measurement. IIR filter output resolution is 20 bits. The T, P result registers are reset to value 0x80000 when the T, P measurements have been skipped (osrs_x=”000‟). The appropriate filter memory is kept unchanged (the value fromt he last measurement is kept). When the appropriate OSRS register is set back to nonzero, then the first value stored to the T, P result register is filtered.

Returns:
value : [0,1,3,7,15,31,63,127]

Definition at line 758 of file BME680.cpp.

int getMode (  )

[mode] Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.

Returns:
value : [0,1,2,3] -> [Sleep, Forced, Parallel, Sequential]

Definition at line 789 of file BME680.cpp.

int getOversamplingHumidity (  )

[osrs_h]

Returns:
value : [0,1,2,4,8,16] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 674 of file BME680.cpp.

int getOversamplingPressure (  )

[osrs_p]

Returns:
value : [0,1,2,4,8,16] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 702 of file BME680.cpp.

int getOversamplingTemperature (  )

[osrs_t]

Returns:
value : [0,1,2,4,8,16] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 730 of file BME680.cpp.

double getPressureDouble ( int  field = 0 )

This function is used to convert the uncompensated pressure data to compensated data using compensation formula.

Note:
Returns pressure in Pa as double.
Output value of "96386.2" equals 96386.2 Pa = 963.862 hPa.
Parameters:
uncom_pressure_u32: value of uncompensated pressure
bme680,:structure pointer.
Returns:
Return the compensated pressure data in floating point

Definition at line 321 of file BME680.cpp.

uint32_t getPressureInt ( int  field = 0 )

Reads actual pressure from uncompensated pressure.

Note:
Returns the value in Pa.
Output value of "12337434"
represents 12337434 / 128 = 96386.2 Pa = 963.862 hPa
Parameters:
v_uncomp_pressure_u32: value of uncompensated pressure
bme680,:structure pointer.
Returns:
the actual pressure in u32

Definition at line 229 of file BME680.cpp.

int getSubMeasurementIndex ( int  field = 0 )

[sub_meas_index_x] sub_meas_index_x registers form “virtual time sensor” and contain a snapshot of the internal 8 bit conversion counter.

Conversion counter is incremented with each TPHG conversion; the counter thus contains the number of conversions modulo 256 executed since the last change of device mode. Note: This index is incremented only if gas conversion is active.

Parameters:
field0-2

Definition at line 544 of file BME680.cpp.

int8_t getTargetHeaterResistance ( int  setPoint )

[res_heat_x] Target heater resistance is programmed by user through res_heat_x<7:0> registers.

res_heat_x = 3.4* ((R_Target*(4/4+res_heat_range))-25) / ((res_heat_val * 0.002) + 1)) Where R_Target is the target heater resistance in Ohm res_heat_x is the decimal value that needs to be stored in register with same name res_heat_range is heater range stored in register address 0x02 <5:4> res_heat_val is heater resistance correction factor stored in register address 0x00 (signed, value from -128 to 127)

Parameters:
setPoint0-9

Definition at line 573 of file BME680.cpp.

double getTemperatureDouble ( int  field = 0 )

This function used to convert temperature data to uncompensated temperature data using compensation formula.

Note:
returns the value in Degree centigrade
Output value of "51.23" equals 51.23 DegC.
Parameters:
field0-2
Returns:
Return the actual temperature in floating point

Definition at line 274 of file BME680.cpp.

int16_t getTemperatureInt ( int  field = 0 )

Reads actual temperature from uncompensated temperature.

Note:
Returns the value with 500LSB/DegC centred around 24 DegC output value of "5123" equals(5123/500)+24 = 34.246DegC
Parameters:
v_uncomp_temperature_u32,:value of uncompensated temperature
bme680,:structure pointer.
Returns:
Return the actual temperature as s16 output

Definition at line 148 of file BME680.cpp.

uint16_t getUncompensatedGasResistanceData ( int  field = 0 )

[gas_rl] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.

The data fields are updated sequentially and always results of the three latest measurements are available for the user; if the last but one conversion was written to field number k, the current conversion results are written to field with number (k+1) mod 3. All data outputs from data fields are buffered using shadowing registers to ensure keeping stable data if update of the data registers comes simultaneously with serial interface reading out. Note: Only field0 will be updated in forced mode

Parameters:
field0-2

Definition at line 508 of file BME680.cpp.

uint32_t getUncompensatedHumidityData ( int  field = 0 )

[hum_msb] [hum_lsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.

The data fields are updated sequentially and always results of the three latest measurements are available for the user; if the last but one conversion was written to field number k, the current conversion results are written to field with number (k+1) mod 3. All data outputs from data fields are buffered using shadowing registers to ensure keeping stable data if update of the data registers comes simultaneously with serial interface reading out. Note: Only field0 will be updated in forced mode

Parameters:
field0-2

Definition at line 502 of file BME680.cpp.

uint32_t getUncompensatedPressureData ( int  field = 0 )

[press_msb] [press_lsb] [press_xlsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.

The data fields are updated sequentially and always results of the three latest measurements are available for the user; if the last but one conversion was written to field number k, the current conversion results are written to field with number (k+1) mod 3. All data outputs from data fields are buffered using shadowing registers to ensure keeping stable data if update of the data registers comes simultaneously with serial interface reading out. Note: Only field0 will be updated in forced mode

Parameters:
field0-2

Definition at line 490 of file BME680.cpp.

uint32_t getUncompensatedTemp1Data ( int  field = 0 )

[temp1_msb] [temp1_lsb] [temp1_xlsb] Pressure, temperature, humidity and gas data of BME680 are stored in 3 data field registers named field0, field1, and field2.

The data fields are updated sequentially and always results of the three latest measurements are available for the user; if the last but one conversion was written to field number k, the current conversion results are written to field with number (k+1) mod 3. All data outputs from data fields are buffered using shadowing registers to ensure keeping stable data if update of the data registers comes simultaneously with serial interface reading out. Note: Only field0 will be updated in forced mode

Parameters:
field0-2

Definition at line 496 of file BME680.cpp.

float getWakePeriod (  )

[odr] Wake period in sequential mode – odr In the sequential mode operation the device periodically enters stand-by state and returns to an operational state after a given wake-up period.

Wake period can be programmed by odr<3:0> register as shown below

Returns:
in ms, 0 means device does not go to standby

Definition at line 634 of file BME680.cpp.

bool init (  )

!! MUST CALL THIS FIRST !! read the chip id and calibration data of the BME680 sensor

<resistance calculation

<correction factor

<range switching error

Definition at line 415 of file BME680.cpp.

bool isGasMeasuring ( int  field = 0 )

[gas_measuring] Measuring bit is set to “1‟ only during gas measurements, goes to “0‟ as soon as measurement is completed and data transferred to data registers.

The registers storing the configuration values for the measurement (gas_wait_shared, gas_wait_x, res_heat_x, idac_heat_x, image registers) should not be changed when the device is measuring.

Parameters:
field0-2

Definition at line 526 of file BME680.cpp.

bool isGasValid ( int  field = 0 )

[gas_valid_rl] In parallel mode, each TPHG sequence contains a gas measurement slot, either a real one which result is used or a dummy one to keep a constant sampling rate and predictable device timing.

A real gas conversion (i.e., not a dummy one) is indicated by the gas_valid_rl status register.

Parameters:
field0-2

Definition at line 550 of file BME680.cpp.

bool isHeaterStable ( int  field = 0 )

[heat_stab_rl] Heater temperature stability for target heater resistance is indicated heat_stab_x status bits.

Parameters:
field0-2

Definition at line 556 of file BME680.cpp.

bool isMeasuring ( int  field = 0 )

[measuring] Measuring status will be set to ‘1’ whenever a conversion (Pressure, Temperature, humidity & gas) is running and back to ‘0’ when the results have been transferred to the data registers.

Parameters:
field0-2

Definition at line 532 of file BME680.cpp.

bool isNewData ( int  field = 0 )

[new_data_x] The measured data are stored into the output data registers at the end of each TPHG conversion phase along with status flags and index of measurement.

The part of the register map for output data storage is composed of 3 data fields (TPHG data field0|1|2)) keeping results from the last 3 measurements. Availability of new (yet unread) results is indicated by new_data_0|1|2 flags.

Parameters:
field0-2

Definition at line 520 of file BME680.cpp.

void runGasConversion (  )

[run_gas_l] The gas conversions are started only in appropriate mode if run_gas_l=1

Definition at line 627 of file BME680.cpp.

void setForcedMode (  )

Single TPHG cycle is performed.

Sensor automatically returns to sleep mode afterwards. Gas sensor heater only operates during gas sub-measureme.

Definition at line 65 of file BME680.cpp.

void setGasWaitShared ( int  time,
int  multiplication 
)

[gas_wait_shared] The programmable wait time between two TPHG sub-measurement sequences of parallel mode depends on gas_wait_shared settings as follows

Parameters:
setPoint0-9
time64 timer values with 0.477 ms step sizes, all zeros means no wait.
multiplication[0x00, 0x01, 0x10, 0x11] -> [1, 4, 16, 64]

Definition at line 601 of file BME680.cpp.

void setGasWaitTime ( int  setPoint,
int  time,
int  multiplication 
)

[gas_wait_x] gas_wait_x controls heater timing of the gas sensor.

Functionality of this register will vary based on power modes. Forced Mode & Sequential mode Time between beginning of heat phase and start of sensor resistance conversion depend on gas_wait_x settings as mentioned below. Parallel Mode The number of TPHG sub-measurement sequences within the one Gas conversion for one target temperature resistance is defined by gas_wait_x settings. Note: Please take care about gas_wait_x on shifting modes between parallel & sequential/forced mode as register functionality will change.

Returns:
result * 0.477 ms
Parameters:
setPoint0-9
time64 timer values with 1ms step sizes, all zeros means no wait.
multiplication[0, 1, 2, 3] -> [1, 4, 16, 64]

Definition at line 590 of file BME680.cpp.

void setHeaterCurrent ( int  setPoint,
uint8_t  value 
)

[idac_heat_x] BME680 contains a heater control block that will inject enough current into the heater resistance to achieve the requested heater temperature.

There is a control loop which periodically measures heater resistance value and adapts the value of current injected from a DAC. BME680 heater operation could be speeded up by setting an initial heater current for a target heater temperature by using register idac_heat_x<7:0>. This step is optional since the control loop will find the current after a few iterations anyway. Current injected to the heater in mA = (idac_heat_7_1 + 1) / 8 Where: idac_heat_7_1 = decimal value stored in idac_heat<7:1> (unsigned, value from 0 to 127)

Parameters:
setPoint0-9

Definition at line 568 of file BME680.cpp.

void setHeaterOff (  )

[heat_off] Turn off current injected to heater

Definition at line 606 of file BME680.cpp.

void setHeaterProfile ( int  value )

[nb_conv] is used to select heater set-points of BME680 Sequential & Parallel Mode User can program a sequence of up to 10 conversions by setting nb_conv<3:0>.

Each conversion has its own heater resistance target but 3 field registers to store conversion results. The actual gas conversion number in the measurement sequence (up to 10 conversions numbered from 0 to 9) is stored in gas measurement index register In parallel mode, no TPH conversions are ran at all. In sequential mode, TPH conversions are run according to osrs_t|p|h settings, gas is skipped

Parameters:
Sequential& Parallel : number of profiles (0-10), 0 means no gas conversion
Forced: indicates index of heater profile

Definition at line 619 of file BME680.cpp.

void setIIRfilterCoefficient ( int  value )

[filter] IIR filter control IIR filter applies to temperature and pressure data but not to humidity and gas data.

The data coming from the ADC are filtered and then loaded into the data registers. The T, P result registers are updated together at the same time at the end of measurement. IIR filter output resolution is 20 bits. The T, P result registers are reset to value 0x80000 when the T, P measurements have been skipped (osrs_x=”000‟). The appropriate filter memory is kept unchanged (the value fromt he last measurement is kept). When the appropriate OSRS register is set back to nonzero, then the first value stored to the T, P result register is filtered.

Parameters:
value: [0,1,2,3,4,5,6,7] -> [0,1,3,7,15,31,63,127]

Definition at line 782 of file BME680.cpp.

void setMode ( int  mode )

[mode] Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.Four measurement modes are available for BME680; that is sleep, sequential, parallel and forced mode.

Parameters:
mode: [0,1,2,3] -> [Sleep, Forced, Parallel, Sequential]

Definition at line 795 of file BME680.cpp.

void setOversamplingHumidity ( int  value )

[osrs_h]

Parameters:
value: [0,1,2,3,4,5] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 695 of file BME680.cpp.

void setOversamplingPressure ( int  value )

[osrs_p]

Parameters:
value: [0,1,2,3,4,5] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 723 of file BME680.cpp.

void setOversamplingTemperature ( int  value )

[osrs_t]

Parameters:
value: [0,1,2,3,4,5] -> [skip,X1,X2,X4,X8,X16], 0 means skipped (output set to 0x8000)

Definition at line 751 of file BME680.cpp.

void setParallelMode (  )

TPHG measurements are performed continuously until mode change.

No stand-by occurs between consecutive TPHG cycles. Gas sensor heater operates in parallel with TPH measurements.

Definition at line 31 of file BME680.cpp.

void setSequentialMode (  )

TPHG measurements are performed.

continuously until mode change. Between each cycle, the sensor enters stand-by for a period of time according to the odr<3:0> control register. Gas sensor heater only operates during gas sub-measurement. 100 ms gas wait time, T:X2, P:X16, H:X1

Definition at line 97 of file BME680.cpp.

void setTargetHeaterResistance ( int  setPoint,
int8_t  value 
)

[res_heat_x] Target heater resistance is programmed by user through res_heat_x<7:0> registers.

res_heat_x = 3.4* ((R_Target*(4/4+res_heat_range))-25) / ((res_heat_val * 0.002) + 1)) Where R_Target is the target heater resistance in Ohm res_heat_x is the decimal value that needs to be stored in register with same name res_heat_range is heater range stored in register address 0x02 <5:4> res_heat_val is heater resistance correction factor stored in register address 0x00 (signed, value from -128 to 127)

Parameters:
setPoint0-9

Definition at line 579 of file BME680.cpp.

void setWakePeriod ( int  value )

[odr] Wake period in sequential mode – odr In the sequential mode operation the device periodically enters stand-by state and returns to an operational state after a given wake-up period.

Wake period can be programmed by odr<3:0> register as shown below

Parameters:
value: [0 - 8+] [0.59,62.5,125,250,500,1000,10,20,no standby]

Definition at line 663 of file BME680.cpp.