Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CaveMike/BME680_driver
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: dr4nc3s/BME680_driver
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 7 commits
  • 12 files changed
  • 1 contributor

Commits on Mar 23, 2017

  1. Corrected typedef for u32

    BST-Github-Admin authored and kegov committed Mar 23, 2017
    Copy the full SHA
    4ebbbe5 View commit details
  2. Corrected typedef for u32

    Updated version for sensor_api_common_types.h to 2.0.1
    BST-Github-Admin committed Mar 23, 2017
    Copy the full SHA
    17d53ff View commit details
  3. Copy the full SHA
    2a4d67e View commit details

Commits on May 9, 2017

  1. Copy the full SHA
    d1c68f0 View commit details

Commits on Jul 17, 2017

  1. Upgraded bme680 API to v3.5.1

    Added Self test APIs
    BST-Github-Admin committed Jul 17, 2017
    Copy the full SHA
    2a51b9c View commit details

Commits on Nov 15, 2017

  1. v3.5.3

     - Changed the compensation equation formulas to use shifting operation
     - Updated the "bme680_get_profile_dur" API
     - Fixed Checkpatch and made linux compatible
     - Fixed bug of temperature compensation in pressure
     - Updated self test APIs
    BST-Github-Admin committed Nov 15, 2017
    Copy the full SHA
    94fd057 View commit details

Commits on Nov 21, 2017

  1. Changed

     - Updated the buffer size in "get_calib_data" API
     - Updated the set/get gas profile duration logic
    BST-Github-Admin committed Nov 21, 2017
    Copy the full SHA
    494b3bb View commit details
Showing with 2,218 additions and 4,603 deletions.
  1. BIN BME680_SensorAPI_Example_Guide.pdf
  2. +228 −158 README.md
  3. +190 −0 Self test/bme680_selftest.c
  4. +88 −0 Self test/bme680_selftest.h
  5. +959 −2,344 bme680.c
  6. +184 −602 bme680.h
  7. +0 −654 bme680_calculations.c
  8. +0 −248 bme680_calculations.h
  9. +512 −0 bme680_defs.h
  10. +0 −285 bme680_internal.h
  11. +57 −0 changelog.md
  12. +0 −312 sensor_api_common_types.h
Binary file removed BME680_SensorAPI_Example_Guide.pdf
Binary file not shown.
386 changes: 228 additions & 158 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,169 +1,239 @@
CONTENTS OF THIS FILE
======================
* Introduction
* Version
* Integration details
* Driver files information
* Supported sensor interface
* Simple Integration Example

INTRODUCTION
=============
- This package contains the Bosch Sensortec MEMS BME680 sensor driver (sensor API)
- The sensor driver package includes below files
* bme680.c
* bme680.h
* bme680_calculations.c
* bme680_calculations.h
* bme680_internal.h
* sensor_api_common_types.h
* BME680_SensorAPI_Optimization_Example_Guide_External.pdf

VERSION
========
- Version of bme680 sensor driver is:
* bme680.c - 2.0.0
* bme680.h - 2.0.1
* bme680_calculations.c - 2.0.0
* bme680_calculations.h - 2.0.0
* bme680_internal.h - 2.0.0
* sensor_api_common_types.h - 2.0.0
* BME680_SensorAPI_Example_Guide.pdf - 2.0.0

INTEGRATION DETAILS
====================
- Integrate files bme680.c, bme680.h, bme680_calculations.c, bme680_calculations.h, bme680_internal.h,
and sensor_api_common_types.h into your project.
- User has to refer bme680.h to refer the API calls for the integration.
- The BME680_SensorAPI_Example_Guide.pdf contains examples for API use cases.
# BME680 sensor API
## Introduction
This package contains the Bosch Sensortec's BME680 gas sensor API

The sensor driver package includes bme680.h, bme680.c and bme680_defs.h files

## Version
File | Version | Date
--------------|---------|-------------
bme680.c | 3.5.5 | 20 Nov 2017
bme680.h | 3.5.5 | 20 Nov 2017
bme680_defs.h | 3.5.5 | 20 Nov 2017

## Integration details
* Integrate bme680.h, bme680_defs.h and bme680.c file in to your project.
* Include the bme680.h file in your code like below.
``` c
#include "bme680.h"
```

## File information
* bme680_defs.h : This header file has the constants, macros and datatype declarations.
* bme680.h : This header file contains the declarations of the sensor driver APIs.
* bme680.c : This source file contains the definitions of the sensor driver APIs.

## Supported sensor interfaces
* SPI 4-wire
* I2C

## Usage guide
### Initializing the sensor
To initialize the sensor, you will first need to create a device structure. You
can do this by creating an instance of the structure bme680_dev. Then go on to
fill in the various parameters as shown below

#### Example for SPI 4-Wire
``` c
struct bme680_dev gas_sensor;

/* You may assign a chip select identifier to be handled later */
gas_sensor.dev_id = 0;
gas_sensor.intf = BME680_SPI_INTF;
gas_sensor.read = user_spi_read;
gas_sensor.write = user_spi_write;
gas_sensor.delay_ms = user_delay_ms;

DRIVER FILES INFORMATION
===========================
bme680.h
---------
* This header file has the constant definitions, user data types and supported sensor driver calls declarations which is required by the user.
int8_t rslt = BME680_OK;
rslt = bme680_init(&gas_sensor);
```

bme680.c
---------
* This file contains the implementation for the sensor driver APIs.
#### Example for I2C
``` c
struct bme680_dev gas_sensor;

bme680_calculations.h
----------------------
* This header file has the internal function declaration for the sensor calculation.
gas_sensor.dev_id = BME680_I2C_ADDR_PRIMARY;
gas_sensor.intf = BME680_I2C_INTF;
gas_sensor.read = user_i2c_read;
gas_sensor.write = user_i2c_write;
gas_sensor.delay_ms = user_delay_ms;

bme680_calculations.c
----------------------
* This file contains the implementation of the sensor calculations for sensor driver APIs.
int8_t rslt = BME680_OK;
rslt = bme680_init(&gas_sensor);
```

### Configuring the sensor
#### Example for configuring the sensor in forced mode
``` c
uint8_t set_required_settings;

/* Set the temperature, pressure and humidity settings */
gas_sensor.tph_sett.os_hum = BME680_OS_2X;
gas_sensor.tph_sett.os_pres = BME680_OS_4X;
gas_sensor.tph_sett.os_temp = BME680_OS_8X;
gas_sensor.tph_sett.filter = BME680_FILTER_SIZE_3;

/* Set the remaining gas sensor settings and link the heating profile */
gas_sensor.gas_sett.run_gas = BME680_ENABLE_GAS_MEAS;
/* Create a ramp heat waveform in 3 steps */
gas_sensor.gas_sett.heatr_temp = 320; /* degree Celsius */
gas_sensor.gas_sett.heatr_dur = 150; /* milliseconds */

/* Select the power mode */
/* Must be set before writing the sensor configuration */
gas_sensor.power_mode = BME680_FORCED_MODE;

/* Set the required sensor settings needed */
set_required_settings = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_FILTER_SEL
| BME680_GAS_SENSOR_SEL;

bme680_internal.h
------------------
* This header file has the register address definition, internal constant definitions.
/* Set the desired sensor configuration */
rslt = bme680_set_sensor_settings(set_required_settings,&gas_sensor);

sensor_api_common_types.h
--------------------------
* This header file has the data type definition for different compiler platform.
/* Set the power mode */
rslt = bme680_set_sensor_mode(&gas_sensor);

/* Get the total measurement duration so as to sleep or wait till the
* measurement is complete */
uint16_t meas_period;
bme680_get_profile_dur(&meas_period, &gas_sensor);
user_delay_ms(meas_period); /* Delay till the measurement is ready */
```
SUPPORTED SENSOR INTERFACE
===========================
- This BME680 sensor driver supports SPI and I2C interfaces
### Reading sensor data
#### Example for reading all sensor data
``` c
struct bme680_field_data data;
Simple Integration Example
===========================
- A simple example for BME680 is given below.
- Example meant for Single BME680 sensor in Force Mode with Temperature
Pressure, Humidity and Gas Enabled
- For further examples and details refer BME680_SensorAPI_Example_Guide.pdf
- Please refer bme680.h to refer the API calls for the integration.

/* include bme680 main header */
#include "bme680.h"
/*!
* BME680_MAX_NO_OF_SENSOR = 2; defined in bme680.h file
* In order to interface only one sensor over SPI, user must change the value of
* BME680_MAX_NO_OF_SENSOR = 1
* Test setup: It has been assumed that “BME680 sensor_0” interfaced over SPI with
* Native chip select line
*/
/* BME680 sensor structure instance */
struct bme680_t bme680_sensor_no[BME680_MAX_NO_OF_SENSOR];
/* BME680 sensor’s compensated data structure instance */
struct bme680_comp_field_data compensate_data_sensor[BME680_MAX_NO_OF_SENSOR][3];
/* BME680 sensor’s uncompensated data structure instance */
struct bme680_uncomp_field_data uncompensated_data_of_sensor[BME680_MAX_NO_OF_SENSOR][3];
/* BME680 sensor’s configuration structure instance */
struct bme680_sens_conf set_conf_sensor[BME680_MAX_NO_OF_SENSOR];
/* BME680 sensor’s heater configuration structure instance */
struct bme680_heater_conf set_heatr_conf_sensor[BME680_MAX_NO_OF_SENSOR];

void main(void)
while(1)
{
unsigned int i = BME680_INIT_VALUE;
enum bme680_return_type com_rslt = BME680_COMM_RES_ERROR;
/* Do BME680 sensor structure instance initialization*/
/* Sensor_0 interface over SPI with native chip select line */
/* USER defined SPI bus read function */
bme680_sensor_no[0].bme680_bus_read = BME680_SPI_bus_read_user;
/* USER defined SPI bus write function */
bme680_sensor_no[0].bme680_bus_write = BME680_SPI_bus_write_user;
/* USER defined SPI burst read function */
bme680_sensor_no[0].bme680_burst_read = BME680_SPI_bus_read_user;
/* USER defined delay function */
bme680_sensor_no[0].delay_msec = BME680_delay_msec_user;
/* Mention communication interface */
bme680_sensor_no[0].interface = BME680_SPI_INTERFACE;
/* get chip id and calibration parameter */
com_rslt = bme680_init(&bme680_sensor_no[0]);
rslt = bme680_get_sensor_data(&data, &gas_sensor);
printf("T: %.2f degC, P: %.2f hPa, H %.2f %%rH ", data.temperature / 100.0f,
data.pressure / 100.0f, data.humidity / 1000.0f );
/* Avoid using measurements from an unstable heating setup */
if(data.status & BME680_GASM_VALID_MSK)
printf(", G: %d ohms", data.gas_resistance);
/* Do Sensor initialization */
for (i=0;i<BME680_MAX_NO_OF_SENSOR;i++) {
/* Check Device-ID before next steps of sensor operations */
if (BME680_CHIP_ID == bme680_sensor_no[i].chip_id) {
/* Select sensor configuration parameters */
set_conf_sensor[i].heatr_ctrl = BME680_HEATR_CTRL_ENABLE;
set_conf_sensor[i].run_gas = BME680_RUN_GAS_ENABLE;
set_conf_sensor[i].nb_conv = 0x00;
set_conf_sensor[i].osrs_hum = BME680_OSRS_1X;
set_conf_sensor[i].osrs_pres = BME680_OSRS_1X;
set_conf_sensor[i].osrs_temp = BME680_OSRS_1X;
/* activate sensor configuration */
com_rslt += bme680_set_sensor_config(&set_conf_sensor[i],
&bme680_sensor_no[i]);
/* Select Heater configuration parameters */
set_heatr_conf_sensor[i].heater_temp[0] = 300;
set_heatr_conf_sensor[i].heatr_idacv[0] = 1;
set_heatr_conf_sensor[i].heatr_dur[0] = 137;
set_heatr_conf_sensor[i].profile_cnt = 1;
/* activate heater configuration */
com_rslt += bme680_set_gas_heater_config(&set_heatr_conf_sensor[i],
&bme680_sensor_no[i]);
/* Set power mode as forced mode */
com_rslt += bme680_set_power_mode(BME680_FORCED_MODE,&bme680_sensor_no[i]);
if (BME680_COMM_RES_OK == com_rslt) {
/*Get the uncompensated T+P+G+H data*/
bme680_get_uncomp_data(uncompensated_data_of_sensor[i], 1, BME680_ALL,
&bme680_sensor_no[i]);
/*Get the compensated T+P+G+H data*/
bme680_compensate_data(uncompensated_data_of_sensor[i],
compensate_data_sensor[i], 1,
BME680_ALL, &bme680_sensor_no[i]);
/* put sensor into sleep mode explicitly */
bme680_set_power_mode(BME680_SLEEP_MODE, &bme680_sensor_no[i]);
/* call user define delay function(duration millisecond) */
User_define_delay(100);
}
}
}
}
printf("\r\n");
}
```

### Templates for function pointers
``` c

void user_delay_ms(uint32_t period)
{
/*
* Return control or wait,
* for a period amount of milliseconds
*/
}

int8_t user_spi_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
{
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */

/*
* The parameter dev_id can be used as a variable to select which Chip Select pin has
* to be set low to activate the relevant device on the SPI bus
*/

/*
* Data on the bus should be like
* |----------------+---------------------+-------------|
* | MOSI | MISO | Chip Select |
* |----------------+---------------------|-------------|
* | (don't care) | (don't care) | HIGH |
* | (reg_addr) | (don't care) | LOW |
* | (don't care) | (reg_data[0]) | LOW |
* | (....) | (....) | LOW |
* | (don't care) | (reg_data[len - 1]) | LOW |
* | (don't care) | (don't care) | HIGH |
* |----------------+---------------------|-------------|
*/

return rslt;
}

int8_t user_spi_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
{
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */

/*
* The parameter dev_id can be used as a variable to select which Chip Select pin has
* to be set low to activate the relevant device on the SPI bus
*/

/*
* Data on the bus should be like
* |---------------------+--------------+-------------|
* | MOSI | MISO | Chip Select |
* |---------------------+--------------|-------------|
* | (don't care) | (don't care) | HIGH |
* | (reg_addr) | (don't care) | LOW |
* | (reg_data[0]) | (don't care) | LOW |
* | (....) | (....) | LOW |
* | (reg_data[len - 1]) | (don't care) | LOW |
* | (don't care) | (don't care) | HIGH |
* |---------------------+--------------|-------------|
*/

return rslt;
}

int8_t user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
{
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */

/*
* The parameter dev_id can be used as a variable to store the I2C address of the device
*/

/*
* Data on the bus should be like
* |------------+---------------------|
* | I2C action | Data |
* |------------+---------------------|
* | Start | - |
* | Write | (reg_addr) |
* | Stop | - |
* | Start | - |
* | Read | (reg_data[0]) |
* | Read | (....) |
* | Read | (reg_data[len - 1]) |
* | Stop | - |
* |------------+---------------------|
*/

return rslt;
}

int8_t user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len)
{
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */

/*
* The parameter dev_id can be used as a variable to store the I2C address of the device
*/

/*
* Data on the bus should be like
* |------------+---------------------|
* | I2C action | Data |
* |------------+---------------------|
* | Start | - |
* | Write | (reg_addr) |
* | Write | (reg_data[0]) |
* | Write | (....) |
* | Write | (reg_data[len - 1]) |
* | Stop | - |
* |------------+---------------------|
*/

return rslt;
}

```
## Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
190 changes: 190 additions & 0 deletions Self test/bme680_selftest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/**\mainpage
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
* The information provided is believed to be accurate and reliable.
* The copyright holder assumes no responsibility
* for the consequences of use
* of such information nor for any infringement of patents or
* other rights of third parties which may result from its use.
* No license is granted by implication or otherwise under any patent or
* patent rights of the copyright holder.
*
* File bme680_selftest.c
* @date 10 Oct 2017
* @version 3.5.2
*
*/

/*!
* @addtogroup bme680_selftest
* @brief
* @{*/

#include "bme680_selftest.h"

#define MIN_TEMPERATURE INT16_C(0) /* 0 degree Celsius */
#define MAX_TEMPERATURE INT16_C(6000) /* 60 degree Celsius */

#define MIN_PRESSURE UINT32_C(90000) /* 900 hecto Pascals */
#define MAX_PRESSURE UINT32_C(110000) /* 1100 hecto Pascals */

#define MIN_HUMIDITY UINT32_C(20000) /* 20% relative humidity */
#define MAX_HUMIDITY UINT32_C(80000) /* 80% relative humidity*/

#define HEATR_DUR 2000
#define N_MEAS 6
#define LOW_TEMP 150
#define HIGH_TEMP 350

/*!
* @brief Function to analyze the sensor data
*
* @param[in] data Array of measurement data
* @param[in] n_meas Number of measurements
*
* @return Error code
* @retval 0 Success
* @retval > 0 Warning
*/
static int8_t analyze_sensor_data(struct bme680_field_data *data, uint8_t n_meas);

/*!
* @brief Self-test API for the BME680
*/
int8_t bme680_self_test(struct bme680_dev *dev)
{
int8_t rslt = BME680_OK;
struct bme680_field_data data[N_MEAS];

struct bme680_dev t_dev;

/* Copy required parameters from reference bme680_dev struct */
t_dev.dev_id = dev->dev_id;
t_dev.amb_temp = 25;
t_dev.read = dev->read;
t_dev.write = dev->write;
t_dev.intf = dev->intf;
t_dev.delay_ms = dev->delay_ms;

rslt = bme680_init(&t_dev);

if (rslt == BME680_OK) {
/* Select the power mode */
/* Must be set before writing the sensor configuration */
t_dev.power_mode = BME680_FORCED_MODE;

uint16_t settings_sel;

/* Set the temperature, pressure and humidity & filter settings */
t_dev.tph_sett.os_hum = BME680_OS_1X;
t_dev.tph_sett.os_pres = BME680_OS_16X;
t_dev.tph_sett.os_temp = BME680_OS_2X;

/* Set the remaining gas sensor settings and link the heating profile */
t_dev.gas_sett.run_gas = BME680_ENABLE_GAS_MEAS;
t_dev.gas_sett.heatr_dur = HEATR_DUR;

settings_sel = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL | BME680_GAS_SENSOR_SEL;

uint16_t profile_dur = 0;
bme680_get_profile_dur(&profile_dur, &t_dev);

uint8_t i = 0;
while ((rslt == BME680_OK) && (i < N_MEAS)) {
if (rslt == BME680_OK) {

if (i % 2 == 0)
t_dev.gas_sett.heatr_temp = HIGH_TEMP; /* Higher temperature */
else
t_dev.gas_sett.heatr_temp = LOW_TEMP; /* Lower temperature */

rslt = bme680_set_sensor_settings(settings_sel, &t_dev);

if (rslt == BME680_OK) {

rslt = bme680_set_sensor_mode(&t_dev); /* Trigger a measurement */

t_dev.delay_ms(profile_dur); /* Wait for the measurement to complete */

rslt = bme680_get_sensor_data(&data[i], &t_dev);
}
}

i++;
}

if (rslt == BME680_OK)
rslt = analyze_sensor_data(data, N_MEAS);
}

return rslt;
}

/*!
* @brief Function to analyze the sensor data
*/
static int8_t analyze_sensor_data(struct bme680_field_data *data, uint8_t n_meas)
{
int8_t rslt = BME680_OK;
uint8_t self_test_failed = 0, i;
uint32_t cent_res = 0;

if ((data[0].temperature < MIN_TEMPERATURE) || (data[0].temperature > MAX_TEMPERATURE))
self_test_failed++;

if ((data[0].pressure < MIN_PRESSURE) || (data[0].pressure > MAX_PRESSURE))
self_test_failed++;

if ((data[0].humidity < MIN_HUMIDITY) || (data[0].humidity > MAX_HUMIDITY))
self_test_failed++;

for (i = 0; i < n_meas; i++) /* Every gas measurement should be valid */
if (!(data[i].status & BME680_GASM_VALID_MSK))
self_test_failed++;

/* 3 cycles heating are completed(HT1/LT1, HT2/LT2,HT3/LT3)
centroid gas ratio = 2*HT3 / (LT2+LT3) < 0.5*/
/* Invert formula to get integer values for centroid resistance */
if (n_meas >= 6)
cent_res = (data[3].gas_resistance + data[5].gas_resistance) / (2 * data[4].gas_resistance);

if ((cent_res < 2)) /*cent_res^-1 < 0.5 */
self_test_failed++;

if (self_test_failed)
rslt = BME680_W_SELF_TEST_FAILED;

return rslt;
}

/** @}*/
88 changes: 88 additions & 0 deletions Self test/bme680_selftest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
* The information provided is believed to be accurate and reliable.
* The copyright holder assumes no responsibility
* for the consequences of use
* of such information nor for any infringement of patents or
* other rights of third parties which may result from its use.
* No license is granted by implication or otherwise under any patent or
* patent rights of the copyright holder.
*
* @file bme680_selftest.h
* @date 10 Oct 2017
* @version 3.5.2
* @brief
*
*/

/*!
* @addtogroup bme680_selftest
* @brief
* @{*/


#ifndef BME680_SELFTEST_H_
#define BME680_SELFTEST_H_

#include "bme680.h"

/*! CPP guard */
#ifdef __cplusplus
extern "C"
{
#endif

#define BME680_W_SELF_TEST_FAILED 3

/*!
* @brief Self-test API for the BME680
*
* @param[in] Device structure containing relevant information on how
* to communicate with the sensor
*
* @return Error code
* @retval 0 Success
* @retval < 0 Error
* @retval > 0 Warning
*/
int8_t bme680_self_test(struct bme680_dev *dev);

/*! CPP guard */
#ifdef __cplusplus
}
#endif

#endif /* BME680_SELFTEST_H_ */

/** @}*/
3,303 changes: 959 additions & 2,344 deletions bme680.c

Large diffs are not rendered by default.

786 changes: 184 additions & 602 deletions bme680.h

Large diffs are not rendered by default.

654 changes: 0 additions & 654 deletions bme680_calculations.c

This file was deleted.

248 changes: 0 additions & 248 deletions bme680_calculations.h

This file was deleted.

512 changes: 512 additions & 0 deletions bme680_defs.h

Large diffs are not rendered by default.

285 changes: 0 additions & 285 deletions bme680_internal.h

This file was deleted.

57 changes: 57 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Change Log
All notable changes to the BME680 Sensor API will be documented in this file.

## v3.5.5, 20 Nov 2017
### Changed
- Updated the buffer size in "get_calib_data" API

## v3.5.4, 16 Nov 2017
### Changed
- Updated the set/get gas profile duration logic

## v3.5.3, 30 Oct 2017
### Changed
- Changed the compensation equation formulae to use shifting operation
- Updated the "bme680_get_profile_dur" API
- Fixed Checkpatch and made linux compatible

## v3.5.2, 18 Oct 2017
### Changed
- Fixed bug of temperature compensation in pressure

## v3.5.1, 5 Jul 2017
### Changed
- Fixed bug with overwriting of the result with communication results
- Added member in the dev structure to store communication results
- Updated set profile duration API to not return a result.
- Added new API to get the duration for the existing profile
- Fixed bug with setting gas configuration. Reduced to writing only relevant bytes
- Updated readme
- Updated documentation for the type definitions
- Removed mode check for get sensor data and setting and getting profile dur

## v3.5.0, 28 Jun 2017
### Changed
- Fixed bug with getting and setting mem pages
- Changed initialization sequence to be more robust
- Added additional tries while reading data in case of inadequate delay

## v3.4.0, 8 Jun 2017
### Changed
- Modified the bme680_get_sensor_data API. User has to now pass the struct that stores the data rather than retrieving from the bme680_dev structure.
- Fixed possible bugs

## v3.3.0, 24 May 2017
### Changed
- Name changes in the BME680 device structure.
- Removed sequential and parallel modes.
- Removed ODR related sensor settings
- Modified get sensor settings API with user selection.
- Removed sort sensor data and swap fields API which are not required.

### Added
- BME680 set profile duration API.

## v3.2.1, 17 May 2017
### Added
- Took the reference as base version 3.2.1 of BME680 sensor and added.
312 changes: 0 additions & 312 deletions sensor_api_common_types.h

This file was deleted.