Updated license, corrected overwriting of the idac, replaced BME680_INIT_VALUE with 0.
This commit is contained in:
parent
2a4d67e8a2
commit
d1c68f0c0b
281
README.md
281
README.md
@ -1,169 +1,148 @@
|
|||||||
CONTENTS OF THIS FILE
|
## Table of Contents
|
||||||
======================
|
- [Introduction](#intro)
|
||||||
* Introduction
|
- [Version](#ver)
|
||||||
* Version
|
- [Integration details](#integration)
|
||||||
* Integration details
|
- [Driver files information](#fileinfo)
|
||||||
* Driver files information
|
- [Supported sensor interface](#interface)
|
||||||
* Supported sensor interface
|
- [Simple Integration Example](#sample)
|
||||||
* Simple Integration Example
|
|
||||||
|
|
||||||
INTRODUCTION
|
### Introduction<a name=intro></a>
|
||||||
=============
|
- This package contains the Bosch Sensortec MEMS BME680 sensor driver (sensor API)
|
||||||
- This package contains the Bosch Sensortec MEMS BME680 sensor driver (sensor API)
|
- The sensor driver package includes below files
|
||||||
- The sensor driver package includes below files
|
* bme680.c
|
||||||
* bme680.c
|
* bme680.h
|
||||||
* bme680.h
|
* bme680_calculations.c
|
||||||
* bme680_calculations.c
|
* bme680_calculations.h
|
||||||
* bme680_calculations.h
|
* bme680_internal.h
|
||||||
* bme680_internal.h
|
* sensor_api_common_types.h
|
||||||
* sensor_api_common_types.h
|
|
||||||
* BME680_SensorAPI_Optimization_Example_Guide_External.pdf
|
|
||||||
|
|
||||||
VERSION
|
### Version<a name=ver></a>
|
||||||
========
|
File | Version | Date
|
||||||
- Version of bme680 sensor driver is:
|
-----|---------|-----
|
||||||
* bme680.c - 2.0.0
|
bme680.c | 2.2.0 | 5 May 2017
|
||||||
* bme680.h - 2.0.1
|
bme680.h | 2.2.0 | 5 May 2017
|
||||||
* bme680_calculations.c - 2.0.0
|
bme680_calculations.c | 2.2.0 | 5 May 2017
|
||||||
* bme680_calculations.h - 2.0.0
|
bme680_calculations.h | 2.2.0 | 5 May 2017
|
||||||
* bme680_internal.h - 2.0.0
|
bme680_internal.h | 2.2.0 | 5 May 2017
|
||||||
* sensor_api_common_types.h - 2.0.1
|
sensor_api_common_types.h | 2.2.0 | 5 May 2017
|
||||||
* BME680_SensorAPI_Example_Guide.pdf - 2.0.0
|
|
||||||
|
|
||||||
INTEGRATION DETAILS
|
### Integration details<a name=integration></a>
|
||||||
====================
|
- Integrate files bme680.c, bme680.h, bme680_calculations.c, bme680_calculations.h, bme680_internal.h and sensor_api_common_types.h into your project.
|
||||||
- Integrate files bme680.c, bme680.h, bme680_calculations.c, bme680_calculations.h, bme680_internal.h,
|
- Include the bme680.h file in your code like below.
|
||||||
and sensor_api_common_types.h into your project.
|
``` c
|
||||||
|
#include "bme680.h"
|
||||||
|
```
|
||||||
|
- The BME680_SensorAPI_Example_Guide.pdf contains examples for API use cases.
|
||||||
|
|
||||||
- User has to refer bme680.h to refer the API calls for the integration.
|
### Driver files information<a name=fileinfo></a>
|
||||||
|
- bme680.h
|
||||||
|
* This header file has the constant definitions, user data types and supported sensor driver calls declarations which is required by the user.
|
||||||
|
- bme680.c
|
||||||
|
* This file contains the implementation for the sensor driver APIs.
|
||||||
|
- bme680_calculations.h
|
||||||
|
* This header file has the internal function declaration for the sensor calculation.
|
||||||
|
- bme680_calculations.c
|
||||||
|
* This file contains the implementation of the sensor calculations for sensor driver APIs.
|
||||||
|
- bme680_internal.h
|
||||||
|
* This header file has the register address definition, internal constant definitions.
|
||||||
|
- sensor_api_common_types.h
|
||||||
|
* This header file has the data type definition for different compiler platform.
|
||||||
|
|
||||||
- The BME680_SensorAPI_Example_Guide.pdf contains examples for API use cases.
|
### Supported sensor interface<a name=interface></a>
|
||||||
|
- This BME680 sensor driver supports SPI and I2C interfaces
|
||||||
|
|
||||||
DRIVER FILES INFORMATION
|
### Simple Integration Example<a name=sample></a>
|
||||||
===========================
|
- A simple example for BME680 is given below.
|
||||||
bme680.h
|
- Example meant for Single BME680 sensor in Force Mode with Temperature, Pressure, Humidity and Gas Enabled
|
||||||
---------
|
- Please refer bme680.h to refer the API calls for the integration.
|
||||||
* This header file has the constant definitions, user data types and supported sensor driver calls declarations which is required by the user.
|
``` c
|
||||||
|
/* 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 <20>BME680 sensor_0<5F> 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];
|
||||||
|
|
||||||
bme680.c
|
void main(void)
|
||||||
---------
|
{
|
||||||
* This file contains the implementation for the sensor driver APIs.
|
unsigned int i = 0;
|
||||||
|
enum bme680_return_type com_rslt = BME680_COMM_RES_ERROR;
|
||||||
|
|
||||||
bme680_calculations.h
|
/* Do BME680 sensor structure instance initialization*/
|
||||||
----------------------
|
/* Sensor_0 interface over SPI with native chip select line */
|
||||||
* This header file has the internal function declaration for the sensor calculation.
|
/* 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;
|
||||||
|
|
||||||
bme680_calculations.c
|
/* get chip id and calibration parameter */
|
||||||
----------------------
|
com_rslt = bme680_init(&bme680_sensor_no[0]);
|
||||||
* This file contains the implementation of the sensor calculations for sensor driver APIs.
|
|
||||||
|
|
||||||
bme680_internal.h
|
/* Do Sensor initialization */
|
||||||
------------------
|
for (i=0;i<BME680_MAX_NO_OF_SENSOR;i++) {
|
||||||
* This header file has the register address definition, internal constant definitions.
|
/* Check Device-ID before next steps of sensor operations */
|
||||||
|
if (BME680_CHIP_ID == bme680_sensor_no[i].chip_id) {
|
||||||
sensor_api_common_types.h
|
|
||||||
--------------------------
|
|
||||||
* This header file has the data type definition for different compiler platform.
|
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED SENSOR INTERFACE
|
|
||||||
===========================
|
|
||||||
- This BME680 sensor driver supports SPI and I2C interfaces
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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]);
|
|
||||||
|
|
||||||
/* 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 */
|
/* Select sensor configuration parameters */
|
||||||
set_conf_sensor[i].heatr_ctrl = BME680_HEATR_CTRL_ENABLE;
|
set_conf_sensor[i].heatr_ctrl = BME680_HEATR_CTRL_ENABLE;
|
||||||
set_conf_sensor[i].run_gas = BME680_RUN_GAS_ENABLE;
|
set_conf_sensor[i].run_gas = BME680_RUN_GAS_ENABLE;
|
||||||
set_conf_sensor[i].nb_conv = 0x00;
|
set_conf_sensor[i].nb_conv = 0x00;
|
||||||
set_conf_sensor[i].osrs_hum = BME680_OSRS_1X;
|
set_conf_sensor[i].osrs_hum = BME680_OSRS_1X;
|
||||||
set_conf_sensor[i].osrs_pres = BME680_OSRS_1X;
|
set_conf_sensor[i].osrs_pres = BME680_OSRS_1X;
|
||||||
set_conf_sensor[i].osrs_temp = BME680_OSRS_1X;
|
set_conf_sensor[i].osrs_temp = BME680_OSRS_1X;
|
||||||
|
|
||||||
/* activate sensor configuration */
|
/* activate sensor configuration */
|
||||||
com_rslt += bme680_set_sensor_config(&set_conf_sensor[i],
|
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]);
|
&bme680_sensor_no[i]);
|
||||||
|
|
||||||
/* Select Heater configuration parameters */
|
/*Get the compensated T+P+G+H data*/
|
||||||
set_heatr_conf_sensor[i].heater_temp[0] = 300;
|
bme680_compensate_data(uncompensated_data_of_sensor[i],
|
||||||
set_heatr_conf_sensor[i].heatr_idacv[0] = 1;
|
compensate_data_sensor[i], 1,
|
||||||
set_heatr_conf_sensor[i].heatr_dur[0] = 137;
|
BME680_ALL, &bme680_sensor_no[i]);
|
||||||
set_heatr_conf_sensor[i].profile_cnt = 1;
|
|
||||||
|
|
||||||
/* activate heater configuration */
|
/* put sensor into sleep mode explicitly */
|
||||||
com_rslt += bme680_set_gas_heater_config(&set_heatr_conf_sensor[i],
|
bme680_set_power_mode(BME680_SLEEP_MODE, &bme680_sensor_no[i]);
|
||||||
&bme680_sensor_no[i]);
|
|
||||||
|
|
||||||
/* Set power mode as forced mode */
|
/* call user define delay function(duration millisecond) */
|
||||||
com_rslt += bme680_set_power_mode(BME680_FORCED_MODE,&bme680_sensor_no[i]);
|
User_define_delay(100);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
265
bme680.c
265
bme680.c
@ -1,57 +1,86 @@
|
|||||||
/** \mainpage
|
/**\mainpage
|
||||||
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
*
|
*
|
||||||
* File : bme680.c
|
* File : bme680.c
|
||||||
*
|
*
|
||||||
* Date : 2016/06/10
|
* Date: 5 May 2017
|
||||||
*
|
*
|
||||||
* Revision: 2.0.0
|
* Revision : 2.2.0 $
|
||||||
*
|
*
|
||||||
* Usage: Sensor Driver for BME680 sensor
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Section Disclaimer
|
|
||||||
*
|
*
|
||||||
* License:
|
* \section Disclaimer
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Common:
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* The purchaser must monitor the market for the purchased products,
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
* documentation and/or other materials provided with the distribution.
|
* without delay of all security relevant incidents.
|
||||||
*
|
*
|
||||||
* Neither the name of the copyright holder nor the names of the
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
* contributors may be used to endorse or promote products derived from
|
* Samples may vary from the valid technical specifications of the product
|
||||||
* this software without specific prior written permission.
|
* series. They are therefore not intended or fit for resale to third
|
||||||
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
|
* client testing. The testing of an engineering sample may in no way
|
||||||
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
|
* no liability for the use of engineering samples.
|
||||||
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
|
* samples.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
* Special:
|
||||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
* This software module (hereinafter called "Software") and any information
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* free of charge for the sole purpose to support your application work.
|
||||||
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
|
* The Software and Information is subject to the following
|
||||||
* OR CONTRIBUTORS BE LIABLE FOR ANY
|
* terms and conditions:
|
||||||
* 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 Software is specifically designed for the exclusive use for
|
||||||
* The copyright holder assumes no responsibility
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
* for the consequences of use
|
* and training. Do not use this Software if you do not have the
|
||||||
* of such information nor for any infringement of patents or
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
|
* subject to change without notice.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
/*! \file bme680.c
|
/*! \file bme680.c
|
||||||
\brief BME680 Sensor Driver Support source File */
|
\brief BME680 Sensor Driver Support source File */
|
||||||
@ -164,7 +193,7 @@ enum bme680_return_type bme680_init(struct bme680_t *bme680)
|
|||||||
{
|
{
|
||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
u8 data_u8 = BME680_INIT_VALUE;
|
u8 data_u8 = 0;
|
||||||
/* assign the pointer*/
|
/* assign the pointer*/
|
||||||
if (BME680_SPI_INTERFACE == bme680->interface) {
|
if (BME680_SPI_INTERFACE == bme680->interface) {
|
||||||
/*SPI address 0x45*/
|
/*SPI address 0x45*/
|
||||||
@ -214,13 +243,13 @@ static enum bme680_return_type bme680_get_calib_param(struct bme680_t *bme680)
|
|||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* array of data holding the calibration values*/
|
/* array of data holding the calibration values*/
|
||||||
u8 v_data_u8 = BME680_INIT_VALUE;
|
u8 v_data_u8 = 0;
|
||||||
u8 a_data_u8[BME680_CALIB_PARAM_SIZE];
|
u8 a_data_u8[BME680_CALIB_PARAM_SIZE];
|
||||||
u8 index = BME680_INIT_VALUE;
|
u8 index = 0;
|
||||||
|
|
||||||
|
|
||||||
for (; index < BME680_CALIB_PARAM_SIZE; index++)
|
for (; index < BME680_CALIB_PARAM_SIZE; index++)
|
||||||
a_data_u8[index] = BME680_INIT_VALUE;
|
a_data_u8[index] = 0;
|
||||||
|
|
||||||
/* check the bme680 structure pointer as NULL*/
|
/* check the bme680 structure pointer as NULL*/
|
||||||
if (BME680_NULL_PTR == bme680) {
|
if (BME680_NULL_PTR == bme680) {
|
||||||
@ -531,20 +560,20 @@ enum bme680_return_type bme680_get_uncomp_data(
|
|||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
|
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
u8 index = BME680_INIT_VALUE;
|
u8 index = 0;
|
||||||
u8 a_data_u8[BME680_LEN_ALL_FIELD_SIZE];
|
u8 a_data_u8[BME680_LEN_ALL_FIELD_SIZE];
|
||||||
struct bme680_uncomp_field_data temp_sensor_data[BME680_THREE];
|
struct bme680_uncomp_field_data temp_sensor_data[BME680_THREE];
|
||||||
|
|
||||||
#ifdef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
#ifdef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
||||||
|
|
||||||
/*Array to store the new_data status of all 3 fields*/
|
/*Array to store the new_data status of all 3 fields*/
|
||||||
u8 new_data[BME680_THREE] = {BME680_INIT_VALUE, BME680_INIT_VALUE,
|
u8 new_data[BME680_THREE] = {0, 0,
|
||||||
BME680_INIT_VALUE};
|
0};
|
||||||
#endif
|
#endif
|
||||||
/*clear the the latest, recent and old field index*/
|
/*clear the the latest, recent and old field index*/
|
||||||
bme680->latest_field_index = BME680_INIT_VALUE;
|
bme680->latest_field_index = 0;
|
||||||
bme680->recent_field_index = BME680_INIT_VALUE;
|
bme680->recent_field_index = 0;
|
||||||
bme680->old_field_index = BME680_INIT_VALUE;
|
bme680->old_field_index = 0;
|
||||||
|
|
||||||
if ((field_count < BME680_PRESENT_DATA_FIELD
|
if ((field_count < BME680_PRESENT_DATA_FIELD
|
||||||
|| field_count > BME680_ALL_DATA_FIELD)
|
|| field_count > BME680_ALL_DATA_FIELD)
|
||||||
@ -653,7 +682,7 @@ enum bme680_return_type bme680_get_uncomp_data(
|
|||||||
bme680);
|
bme680);
|
||||||
if (BME680_FORCED_MODE != bme680->last_set_mode) {
|
if (BME680_FORCED_MODE != bme680->last_set_mode) {
|
||||||
|
|
||||||
for (index = BME680_INIT_VALUE; index <
|
for (index = 0; index <
|
||||||
BME680_ALL_DATA_FIELD; index++)
|
BME680_ALL_DATA_FIELD; index++)
|
||||||
temp_sensor_data[index] =
|
temp_sensor_data[index] =
|
||||||
*(uncomp_data + index);
|
*(uncomp_data + index);
|
||||||
@ -767,10 +796,10 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* local buffer length is 5 and it's the maximum */
|
/* local buffer length is 5 and it's the maximum */
|
||||||
u8 temp_data_u8[BME680_THREE];
|
u8 temp_data_u8[BME680_THREE];
|
||||||
u8 count = BME680_INIT_VALUE;
|
u8 count = 0;
|
||||||
|
|
||||||
for (count = BME680_INIT_VALUE; count < BME680_THREE; count++)
|
for (count = 0; count < BME680_THREE; count++)
|
||||||
temp_data_u8[count] = BME680_INIT_VALUE;
|
temp_data_u8[count] = 0;
|
||||||
|
|
||||||
/*read uncompensated Temperature of field 0*/
|
/*read uncompensated Temperature of field 0*/
|
||||||
if (BME680_FIELD_INDEX0 == field_index) {
|
if (BME680_FIELD_INDEX0 == field_index) {
|
||||||
@ -783,7 +812,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
5,6 & 7 of the input buffer*/
|
5,6 & 7 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[5 + count] = temp_data_u8[count];
|
a_data_u8[5 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -795,7 +824,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
10,11 & 12 of the input buffer*/
|
10,11 & 12 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[10 + count] = temp_data_u8[count];
|
a_data_u8[10 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -811,7 +840,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
22,23 & 24 of the input buffer*/
|
22,23 & 24 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[22 + count] = temp_data_u8[count];
|
a_data_u8[22 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -824,7 +853,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
27,28 & 29 of the input buffer*/
|
27,28 & 29 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[27 + count] = temp_data_u8[count];
|
a_data_u8[27 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -840,7 +869,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
39,40 & 41 of the input buffer*/
|
39,40 & 41 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[39 + count] = temp_data_u8[count];
|
a_data_u8[39 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -853,7 +882,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_TEMPERATURE_DATA_LEN);
|
BME680_TEMPERATURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
44,45 & 46 of the input buffer*/
|
44,45 & 46 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
count < BME680_TEMPERATURE_DATA_LEN; count++)
|
||||||
a_data_u8[44 + count] = temp_data_u8[count];
|
a_data_u8[44 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -884,10 +913,10 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* local buffer length is 5 and it's the maximum */
|
/* local buffer length is 5 and it's the maximum */
|
||||||
u8 temp_data_u8[BME680_THREE];
|
u8 temp_data_u8[BME680_THREE];
|
||||||
u8 count = BME680_INIT_VALUE;
|
u8 count = 0;
|
||||||
|
|
||||||
for (count = BME680_INIT_VALUE; count < BME680_THREE; count++)
|
for (count = 0; count < BME680_THREE; count++)
|
||||||
temp_data_u8[count] = BME680_INIT_VALUE;
|
temp_data_u8[count] = 0;
|
||||||
|
|
||||||
/*read uncompensated Pressure of field 0*/
|
/*read uncompensated Pressure of field 0*/
|
||||||
if (BME680_FIELD_INDEX0 == field_index) {
|
if (BME680_FIELD_INDEX0 == field_index) {
|
||||||
@ -900,7 +929,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_PRESSURE_DATA_LEN);
|
BME680_PRESSURE_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
2,3 & 4 of the input buffer*/
|
2,3 & 4 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_PRESSURE_DATA_LEN; count++)
|
count < BME680_PRESSURE_DATA_LEN; count++)
|
||||||
a_data_u8[2 + count] = temp_data_u8[count];
|
a_data_u8[2 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -918,7 +947,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
/*Assign data to the
|
/*Assign data to the
|
||||||
reserved index
|
reserved index
|
||||||
19,20 & 21 of the input buffer*/
|
19,20 & 21 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_PRESSURE_DATA_LEN; count++)
|
count < BME680_PRESSURE_DATA_LEN; count++)
|
||||||
a_data_u8[19 + count] = temp_data_u8[count];
|
a_data_u8[19 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -936,7 +965,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
/*Assign data to the reserved
|
/*Assign data to the reserved
|
||||||
index 36,37 & 38 of the input
|
index 36,37 & 38 of the input
|
||||||
buffer*/
|
buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_PRESSURE_DATA_LEN; count++)
|
count < BME680_PRESSURE_DATA_LEN; count++)
|
||||||
a_data_u8[36 + count] = temp_data_u8[count];
|
a_data_u8[36 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -967,10 +996,10 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* local buffer length is 5 and it's the maximum */
|
/* local buffer length is 5 and it's the maximum */
|
||||||
u8 temp_data_u8[BME680_TWO];
|
u8 temp_data_u8[BME680_TWO];
|
||||||
u8 count = BME680_INIT_VALUE;
|
u8 count = 0;
|
||||||
|
|
||||||
for (count = BME680_INIT_VALUE; count < BME680_TWO; count++)
|
for (count = 0; count < BME680_TWO; count++)
|
||||||
temp_data_u8[count] = BME680_INIT_VALUE;
|
temp_data_u8[count] = 0;
|
||||||
/*read uncompensated Humidity of field 0*/
|
/*read uncompensated Humidity of field 0*/
|
||||||
if (BME680_FIELD_INDEX0 == field_index) {
|
if (BME680_FIELD_INDEX0 == field_index) {
|
||||||
/*read the 2 byte of H data form 0x25*/
|
/*read the 2 byte of H data form 0x25*/
|
||||||
@ -982,7 +1011,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_HUMIDITY_DATA_LEN);
|
BME680_HUMIDITY_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
8 & 9 of the input buffer*/
|
8 & 9 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_HUMIDITY_DATA_LEN; count++)
|
count < BME680_HUMIDITY_DATA_LEN; count++)
|
||||||
a_data_u8[8 + count] = temp_data_u8[count];
|
a_data_u8[8 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -998,7 +1027,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_HUMIDITY_DATA_LEN);
|
BME680_HUMIDITY_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
25 & 26 of the input buffer*/
|
25 & 26 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_HUMIDITY_DATA_LEN; count++)
|
count < BME680_HUMIDITY_DATA_LEN; count++)
|
||||||
a_data_u8[25 + count] = temp_data_u8[count];
|
a_data_u8[25 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -1014,7 +1043,7 @@ u8 field_index, u8 *a_data_u8, struct bme680_t *bme680)
|
|||||||
BME680_HUMIDITY_DATA_LEN);
|
BME680_HUMIDITY_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
42 & 43 of the input buffer*/
|
42 & 43 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_HUMIDITY_DATA_LEN; count++)
|
count < BME680_HUMIDITY_DATA_LEN; count++)
|
||||||
a_data_u8[42 + count] = temp_data_u8[count];
|
a_data_u8[42 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -1045,10 +1074,10 @@ enum bme680_return_type bme680_Gas_field_specific_uncomp_read(
|
|||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* local buffer length is 5 and it's the maximum */
|
/* local buffer length is 5 and it's the maximum */
|
||||||
u8 temp_data_u8[BME680_TWO];
|
u8 temp_data_u8[BME680_TWO];
|
||||||
u8 count = BME680_INIT_VALUE;
|
u8 count = 0;
|
||||||
|
|
||||||
for (count = BME680_INIT_VALUE; count < BME680_TWO; count++)
|
for (count = 0; count < BME680_TWO; count++)
|
||||||
temp_data_u8[count] = BME680_INIT_VALUE;
|
temp_data_u8[count] = 0;
|
||||||
|
|
||||||
/*read uncompensated Gas of field 0*/
|
/*read uncompensated Gas of field 0*/
|
||||||
if (BME680_FIELD_INDEX0 == field_index) {
|
if (BME680_FIELD_INDEX0 == field_index) {
|
||||||
@ -1061,7 +1090,7 @@ enum bme680_return_type bme680_Gas_field_specific_uncomp_read(
|
|||||||
BME680_GAS_DATA_LEN);
|
BME680_GAS_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
13,14 of the input buffer*/
|
13,14 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_GAS_DATA_LEN; count++)
|
count < BME680_GAS_DATA_LEN; count++)
|
||||||
a_data_u8[13 + count] = temp_data_u8[count];
|
a_data_u8[13 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -1077,7 +1106,7 @@ enum bme680_return_type bme680_Gas_field_specific_uncomp_read(
|
|||||||
BME680_GAS_DATA_LEN);
|
BME680_GAS_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
30,31 of the input buffer*/
|
30,31 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_GAS_DATA_LEN; count++)
|
count < BME680_GAS_DATA_LEN; count++)
|
||||||
a_data_u8[30 + count] = temp_data_u8[count];
|
a_data_u8[30 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -1093,7 +1122,7 @@ enum bme680_return_type bme680_Gas_field_specific_uncomp_read(
|
|||||||
BME680_GAS_DATA_LEN);
|
BME680_GAS_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
47,48 of the input buffer*/
|
47,48 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_GAS_DATA_LEN; count++)
|
count < BME680_GAS_DATA_LEN; count++)
|
||||||
a_data_u8[47 + count] = temp_data_u8[count];
|
a_data_u8[47 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -1131,7 +1160,7 @@ enum bme680_return_type bme680_Gas_field_specific_uncomp_read(
|
|||||||
enum bme680_return_type bme680_get_power_mode(u8 *power_mode_u8,
|
enum bme680_return_type bme680_get_power_mode(u8 *power_mode_u8,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u8 data_u8 = BME680_INIT_VALUE;
|
u8 data_u8 = 0;
|
||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* check the bme680 is NULL pointer */
|
/* check the bme680 is NULL pointer */
|
||||||
@ -1181,7 +1210,7 @@ enum bme680_return_type bme680_get_power_mode(u8 *power_mode_u8,
|
|||||||
enum bme680_return_type bme680_set_power_mode(u8 power_mode_u8,
|
enum bme680_return_type bme680_set_power_mode(u8 power_mode_u8,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u8 data_u8 = BME680_INIT_VALUE;
|
u8 data_u8 = 0;
|
||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* check the bme680 is NULL pointer */
|
/* check the bme680 is NULL pointer */
|
||||||
@ -1260,7 +1289,7 @@ enum bme680_return_type bme680_set_sensor_config(
|
|||||||
|
|
||||||
for (index = 0; index < (BME680_SENS_CONF_LEN * 2) - 2;
|
for (index = 0; index < (BME680_SENS_CONF_LEN * 2) - 2;
|
||||||
index++)
|
index++)
|
||||||
data_u8[index] = BME680_INIT_VALUE;
|
data_u8[index] = 0;
|
||||||
com_status = (enum bme680_return_type)bme680->bme680_bus_read(
|
com_status = (enum bme680_return_type)bme680->bme680_bus_read(
|
||||||
bme680->dev_addr,
|
bme680->dev_addr,
|
||||||
BME680_ADDR_SENSOR_CONFIG,
|
BME680_ADDR_SENSOR_CONFIG,
|
||||||
@ -1376,7 +1405,7 @@ enum bme680_return_type bme680_get_sensor_config(
|
|||||||
if (BME680_COMM_RES_OK == com_status) {
|
if (BME680_COMM_RES_OK == com_status) {
|
||||||
|
|
||||||
for (index = 0; index < BME680_SENS_CONF_LEN ; index++)
|
for (index = 0; index < BME680_SENS_CONF_LEN ; index++)
|
||||||
data_u8[index] = BME680_INIT_VALUE;
|
data_u8[index] = 0;
|
||||||
|
|
||||||
com_status = (enum bme680_return_type)
|
com_status = (enum bme680_return_type)
|
||||||
bme680->bme680_bus_read(
|
bme680->bme680_bus_read(
|
||||||
@ -1438,7 +1467,7 @@ enum bme680_return_type bme680_get_sensor_config(
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief This function is used for setting gas heater configuration
|
* @brief This function is used for setting gas heater configuration
|
||||||
* of the sensor from register 50 to 6E address
|
* of the sensor from register 5A to 6E address
|
||||||
*
|
*
|
||||||
* @param heatr_conf : structure pointer of Heater configuration
|
* @param heatr_conf : structure pointer of Heater configuration
|
||||||
* structure
|
* structure
|
||||||
@ -1447,8 +1476,6 @@ enum bme680_return_type bme680_get_sensor_config(
|
|||||||
*
|
*
|
||||||
* @note reference input values from user are below
|
* @note reference input values from user are below
|
||||||
*
|
*
|
||||||
* heatr_idacv - initial heater current for
|
|
||||||
* target heater temperature(optional)
|
|
||||||
* heater_temp - target temperature (200 to 400 deg cls)
|
* heater_temp - target temperature (200 to 400 deg cls)
|
||||||
* heatr_dur - heater duration ( 1 to 4032 ms)
|
* heatr_dur - heater duration ( 1 to 4032 ms)
|
||||||
* heatr_dur_shared - wait time for parallel mode
|
* heatr_dur_shared - wait time for parallel mode
|
||||||
@ -1489,14 +1516,14 @@ enum bme680_return_type bme680_set_gas_heater_config(
|
|||||||
com_status = bme680_get_power_mode(&power_mode, bme680);
|
com_status = bme680_get_power_mode(&power_mode, bme680);
|
||||||
for (index = 0; index < heatr_conf->profile_cnt;
|
for (index = 0; index < heatr_conf->profile_cnt;
|
||||||
index++) {
|
index++) {
|
||||||
data_u8[index] = heatr_conf->heatr_idacv[index];
|
|
||||||
#ifdef FIXED_POINT_COMPENSATION
|
#ifdef FIXED_POINT_COMPENSATION
|
||||||
data_u8[index + 10] =
|
data_u8[index] =
|
||||||
bme680_convert_temperature_to_resistance_int32(
|
bme680_convert_temperature_to_resistance_int32(
|
||||||
heatr_conf->heater_temp[index],
|
heatr_conf->heater_temp[index],
|
||||||
25, bme680);
|
25, bme680);
|
||||||
#else
|
#else
|
||||||
data_u8[index + 10] =
|
data_u8[index] =
|
||||||
bme680_convert_temperature_to_resistance_double(
|
bme680_convert_temperature_to_resistance_double(
|
||||||
heatr_conf->heater_temp[index],
|
heatr_conf->heater_temp[index],
|
||||||
25, bme680);
|
25, bme680);
|
||||||
@ -1504,7 +1531,7 @@ enum bme680_return_type bme680_set_gas_heater_config(
|
|||||||
if (power_mode != BME680_PARALLEL_MODE)
|
if (power_mode != BME680_PARALLEL_MODE)
|
||||||
bme680_scale_to_multiplication_factor(
|
bme680_scale_to_multiplication_factor(
|
||||||
&heatr_conf->heatr_dur[index]);
|
&heatr_conf->heatr_dur[index]);
|
||||||
data_u8[index + 20] = heatr_conf->heatr_dur[index];
|
data_u8[index + 10] = heatr_conf->heatr_dur[index];
|
||||||
|
|
||||||
}
|
}
|
||||||
if (BME680_PARALLEL_MODE == power_mode) {
|
if (BME680_PARALLEL_MODE == power_mode) {
|
||||||
@ -1513,7 +1540,7 @@ enum bme680_return_type bme680_set_gas_heater_config(
|
|||||||
BME680_GAS_WAIT_STEP_SIZE;
|
BME680_GAS_WAIT_STEP_SIZE;
|
||||||
bme680_scale_to_multiplication_factor(
|
bme680_scale_to_multiplication_factor(
|
||||||
&heatr_conf->heatr_dur_shared);
|
&heatr_conf->heatr_dur_shared);
|
||||||
data_u8[30] = heatr_conf->heatr_dur_shared;
|
data_u8[20] = heatr_conf->heatr_dur_shared;
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
@ -1602,7 +1629,7 @@ static void bme680_buffer_restruct_burst_write(u8 arr[], u8 reg_addr,
|
|||||||
#endif
|
#endif
|
||||||
/*!
|
/*!
|
||||||
* @brief This function is used to read the sensor heater
|
* @brief This function is used to read the sensor heater
|
||||||
* configuration from register 50 to 6E address
|
* configuration from register 5A to 6E address
|
||||||
*
|
*
|
||||||
* @param heatr_conf : structure pointer of Heater
|
* @param heatr_conf : structure pointer of Heater
|
||||||
* configuration structure
|
* configuration structure
|
||||||
@ -1611,8 +1638,6 @@ static void bme680_buffer_restruct_burst_write(u8 arr[], u8 reg_addr,
|
|||||||
*
|
*
|
||||||
* @note reference output values from the sensor are below
|
* @note reference output values from the sensor are below
|
||||||
*
|
*
|
||||||
* heatr_idacv - initial heater current for
|
|
||||||
* target heater temperature(optional)
|
|
||||||
* heater_temp - target temperature (200 to 400 deg cls)
|
* heater_temp - target temperature (200 to 400 deg cls)
|
||||||
* heatr_dur - heater duration ( 1 to 4032 ms)
|
* heatr_dur - heater duration ( 1 to 4032 ms)
|
||||||
* heatr_dur_shared - wait time for parallel mode
|
* heatr_dur_shared - wait time for parallel mode
|
||||||
@ -1651,11 +1676,11 @@ enum bme680_return_type bme680_get_gas_heater_config(
|
|||||||
if (BME680_COMM_RES_OK == com_status) {
|
if (BME680_COMM_RES_OK == com_status) {
|
||||||
|
|
||||||
for (index = 0; index < BME680_SENS_HEATR_CONF_LEN; index++)
|
for (index = 0; index < BME680_SENS_HEATR_CONF_LEN; index++)
|
||||||
data_u8[index] = BME680_INIT_VALUE;
|
data_u8[index] = 0;
|
||||||
|
|
||||||
com_status = (enum bme680_return_type)
|
com_status = (enum bme680_return_type)
|
||||||
bme680->bme680_bus_read(bme680->dev_addr,
|
bme680->bme680_bus_read(bme680->dev_addr,
|
||||||
0x50,
|
BME680_ADDR_SENS_CONF_START,
|
||||||
data_u8,
|
data_u8,
|
||||||
BME680_SENS_HEATR_CONF_LEN);
|
BME680_SENS_HEATR_CONF_LEN);
|
||||||
if (BME680_COMM_RES_OK == com_status) {
|
if (BME680_COMM_RES_OK == com_status) {
|
||||||
@ -1668,18 +1693,16 @@ enum bme680_return_type bme680_get_gas_heater_config(
|
|||||||
(heatr_conf->profile_cnt == 0)) {
|
(heatr_conf->profile_cnt == 0)) {
|
||||||
for (index = 0; index < BME680_PROFILE_MAX;
|
for (index = 0; index < BME680_PROFILE_MAX;
|
||||||
index++) {
|
index++) {
|
||||||
heatr_conf->heatr_idacv[index] =
|
|
||||||
data_u8[index];
|
|
||||||
heatr_conf->heater_temp[index] =
|
heatr_conf->heater_temp[index] =
|
||||||
data_u8[index + 10];
|
data_u8[index];
|
||||||
heatr_conf->heatr_dur[index] =
|
heatr_conf->heatr_dur[index] =
|
||||||
data_u8[index + 20];
|
data_u8[index + 10];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
com_status = BME680_PROFILE_CNT_ERROR;
|
com_status = BME680_PROFILE_CNT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
heatr_conf->heatr_dur_shared = data_u8[30];
|
heatr_conf->heatr_dur_shared = data_u8[20];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1907,7 +1930,7 @@ for (index = 0; ((index < field_count) &&
|
|||||||
static enum bme680_return_type bme680_set_memory_page(u8 memory_page_u8,
|
static enum bme680_return_type bme680_set_memory_page(u8 memory_page_u8,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u8 data_u8 = BME680_INIT_VALUE;
|
u8 data_u8 = 0;
|
||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
/* check the bme680 is NULL pointer */
|
/* check the bme680 is NULL pointer */
|
||||||
@ -1963,8 +1986,8 @@ static enum bme680_return_type bme680_set_memory_page(u8 memory_page_u8,
|
|||||||
void bme680_align_uncomp_data(u8 *a_data_u8, u8 field_count, u8 sensor_type,
|
void bme680_align_uncomp_data(u8 *a_data_u8, u8 field_count, u8 sensor_type,
|
||||||
struct bme680_uncomp_field_data *uncomp_data, struct bme680_t *bme680)
|
struct bme680_uncomp_field_data *uncomp_data, struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u8 offset = BME680_INIT_VALUE;
|
u8 offset = 0;
|
||||||
s8 index = BME680_INIT_VALUE;
|
s8 index = 0;
|
||||||
|
|
||||||
if (BME680_FORCED_MODE != bme680->last_set_mode)
|
if (BME680_FORCED_MODE != bme680->last_set_mode)
|
||||||
field_count = BME680_ALL_DATA_FIELD;
|
field_count = BME680_ALL_DATA_FIELD;
|
||||||
@ -2036,16 +2059,16 @@ void bme680_get_latest_recent_old_field_index(
|
|||||||
{
|
{
|
||||||
/* Array holding the filed0, field1 and field2
|
/* Array holding the filed0, field1 and field2
|
||||||
temperature, pressure, humidity and gas data*/
|
temperature, pressure, humidity and gas data*/
|
||||||
u8 latest = BME680_INIT_VALUE;
|
u8 latest = 0;
|
||||||
u8 recent = BME680_INIT_VALUE;
|
u8 recent = 0;
|
||||||
u8 old = BME680_INIT_VALUE;
|
u8 old = 0;
|
||||||
u8 index = BME680_INIT_VALUE;
|
u8 index = 0;
|
||||||
u8 large_index = BME680_INIT_VALUE;
|
u8 large_index = 0;
|
||||||
u8 max_index = 2;
|
u8 max_index = 2;
|
||||||
u8 meas_index[3];
|
u8 meas_index[3];
|
||||||
|
|
||||||
for (index = BME680_INIT_VALUE; index < 3; index++)
|
for (index = 0; index < 3; index++)
|
||||||
meas_index[index] = BME680_INIT_VALUE;
|
meas_index[index] = 0;
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
for (index = 0; index < 3; index++)
|
for (index = 0; index < 3; index++)
|
||||||
@ -2114,9 +2137,9 @@ enum bme680_return_type bme680_read_status_fields(
|
|||||||
/* used to return the communication result*/
|
/* used to return the communication result*/
|
||||||
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
enum bme680_return_type com_status = BME680_COMM_RES_ERROR;
|
||||||
|
|
||||||
u8 count = BME680_INIT_VALUE;
|
u8 count = 0;
|
||||||
/* local buffer length is 5 and it's the maximum */
|
/* local buffer length is 5 and it's the maximum */
|
||||||
u8 temp_data_u8[2] = {BME680_INIT_VALUE, BME680_INIT_VALUE};
|
u8 temp_data_u8[2] = {0, 0};
|
||||||
|
|
||||||
|
|
||||||
/*read the 2 byte of status form 0x1D - field_0*/
|
/*read the 2 byte of status form 0x1D - field_0*/
|
||||||
@ -2127,7 +2150,7 @@ enum bme680_return_type bme680_read_status_fields(
|
|||||||
BME680_STATUS_DATA_LEN);
|
BME680_STATUS_DATA_LEN);
|
||||||
/* Assign data to the reserved
|
/* Assign data to the reserved
|
||||||
index of the input buffer */
|
index of the input buffer */
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_STATUS_DATA_LEN; count++)
|
count < BME680_STATUS_DATA_LEN; count++)
|
||||||
a_data_u8[0 + count] = temp_data_u8[count];
|
a_data_u8[0 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -2147,7 +2170,7 @@ enum bme680_return_type bme680_read_status_fields(
|
|||||||
BME680_STATUS_DATA_LEN);
|
BME680_STATUS_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
17 and 18 of the input buffer*/
|
17 and 18 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_STATUS_DATA_LEN; count++)
|
count < BME680_STATUS_DATA_LEN; count++)
|
||||||
a_data_u8[17 + count] = temp_data_u8[count];
|
a_data_u8[17 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -2166,7 +2189,7 @@ enum bme680_return_type bme680_read_status_fields(
|
|||||||
BME680_STATUS_DATA_LEN);
|
BME680_STATUS_DATA_LEN);
|
||||||
/*Assign data to the reserved index
|
/*Assign data to the reserved index
|
||||||
34 and 35 of the input buffer*/
|
34 and 35 of the input buffer*/
|
||||||
for (count = BME680_INIT_VALUE;
|
for (count = 0;
|
||||||
count < BME680_STATUS_DATA_LEN; count++)
|
count < BME680_STATUS_DATA_LEN; count++)
|
||||||
a_data_u8[34 + count] = temp_data_u8[count];
|
a_data_u8[34 + count] = temp_data_u8[count];
|
||||||
|
|
||||||
@ -2203,14 +2226,14 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
struct bme680_uncomp_field_data *temp_sensor_data)
|
struct bme680_uncomp_field_data *temp_sensor_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
u8 index = BME680_INIT_VALUE;
|
u8 index = 0;
|
||||||
#ifndef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
#ifndef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
||||||
sensor_type = BME680_ALL;
|
sensor_type = BME680_ALL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
#ifdef BME680_SPECIFIC_FIELD_DATA_READ_ENABLED
|
||||||
/* copy status of all field */
|
/* copy status of all field */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
sensor_data[index].status =
|
sensor_data[index].status =
|
||||||
@ -2228,7 +2251,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
/* copy temperature data
|
/* copy temperature data
|
||||||
by default for Pressure and Humidity
|
by default for Pressure and Humidity
|
||||||
*/
|
*/
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
sensor_data[index].temp_adcv =
|
sensor_data[index].temp_adcv =
|
||||||
@ -2244,7 +2267,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
switch (sensor_type) {
|
switch (sensor_type) {
|
||||||
case BME680_PRESSURE:
|
case BME680_PRESSURE:
|
||||||
/* copying only pressure data */
|
/* copying only pressure data */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
sensor_data[index].pres_adcv =
|
sensor_data[index].pres_adcv =
|
||||||
@ -2260,7 +2283,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
break;
|
break;
|
||||||
case BME680_HUMIDITY:
|
case BME680_HUMIDITY:
|
||||||
/* copying only humidity data */
|
/* copying only humidity data */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
sensor_data[index].hum_adcv =
|
sensor_data[index].hum_adcv =
|
||||||
@ -2277,7 +2300,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
}
|
}
|
||||||
} else if (BME680_GAS == sensor_type) {
|
} else if (BME680_GAS == sensor_type) {
|
||||||
/* copying only gas data */
|
/* copying only gas data */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
sensor_data[index].gas_res_adcv =
|
sensor_data[index].gas_res_adcv =
|
||||||
@ -2292,7 +2315,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
}
|
}
|
||||||
} else if (BME680_ALL == sensor_type) {
|
} else if (BME680_ALL == sensor_type) {
|
||||||
/* copying T,P,G,& H data */
|
/* copying T,P,G,& H data */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
*(sensor_data + index) =
|
*(sensor_data + index) =
|
||||||
@ -2308,7 +2331,7 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
#else
|
#else
|
||||||
if (BME680_ALL == sensor_type) {
|
if (BME680_ALL == sensor_type) {
|
||||||
/* copying T,P,G,& H data */
|
/* copying T,P,G,& H data */
|
||||||
for (index = BME680_INIT_VALUE; index < BME680_MAX_FIELD_INDEX;
|
for (index = 0; index < BME680_MAX_FIELD_INDEX;
|
||||||
index++) {
|
index++) {
|
||||||
if (index == BME680_FIELD_INDEX0)
|
if (index == BME680_FIELD_INDEX0)
|
||||||
*(sensor_data + index) =
|
*(sensor_data + index) =
|
||||||
@ -2336,8 +2359,8 @@ void bme680_copy_ordered_sensor_field_data(
|
|||||||
static u8 bme680_find_largest_index(u8 *meas_index)
|
static u8 bme680_find_largest_index(u8 *meas_index)
|
||||||
{
|
{
|
||||||
|
|
||||||
u8 index = BME680_INIT_VALUE;
|
u8 index = 0;
|
||||||
u8 temp_index = BME680_INIT_VALUE;
|
u8 temp_index = 0;
|
||||||
|
|
||||||
if (*(meas_index + index) > *(meas_index + (index + 2))) {
|
if (*(meas_index + index) > *(meas_index + (index + 2))) {
|
||||||
if (*(meas_index + index) > *(meas_index + (index + 1)))
|
if (*(meas_index + index) > *(meas_index + (index + 1)))
|
||||||
|
108
bme680.h
108
bme680.h
@ -1,58 +1,86 @@
|
|||||||
/*
|
/**
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
*
|
*
|
||||||
* File : bme680.h
|
* File : bme680.h
|
||||||
*
|
*
|
||||||
* Date : 2016/08/17
|
* Date: 5 May 2017
|
||||||
*
|
*
|
||||||
* Revision: 2.0.1
|
* Revision : 2.2.0 $
|
||||||
*
|
*
|
||||||
* Usage: Sensor Driver for BME680 sensor
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*
|
*
|
||||||
* Section Disclaimer
|
* \section Disclaimer
|
||||||
* License:
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Common:
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* The purchaser must monitor the market for the purchased products,
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
* documentation and/or other materials provided with the distribution.
|
* without delay of all security relevant incidents.
|
||||||
*
|
*
|
||||||
* Neither the name of the copyright holder nor the names of the
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
* contributors may be used to endorse or promote products derived from
|
* Samples may vary from the valid technical specifications of the product
|
||||||
* this software without specific prior written permission.
|
* series. They are therefore not intended or fit for resale to third
|
||||||
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
|
* client testing. The testing of an engineering sample may in no way
|
||||||
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
|
* no liability for the use of engineering samples.
|
||||||
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
|
* samples.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
* Special:
|
||||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
* This software module (hereinafter called "Software") and any information
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* free of charge for the sole purpose to support your application work.
|
||||||
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
|
* The Software and Information is subject to the following
|
||||||
* OR CONTRIBUTORS BE LIABLE FOR ANY
|
* terms and conditions:
|
||||||
* 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 Software is specifically designed for the exclusive use for
|
||||||
* The copyright holder assumes no responsibility
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
* for the consequences of use
|
* and training. Do not use this Software if you do not have the
|
||||||
* of such information nor for any infringement of patents or
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
|
* subject to change without notice.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
/*! \file bme680.h
|
/*! \file bme680.h
|
||||||
\brief BME680 Sensor Driver Support Header File */
|
\brief BME680 Sensor Driver Support Header File */
|
||||||
@ -194,8 +222,6 @@ float value into fixed point */
|
|||||||
/* Constants */
|
/* Constants */
|
||||||
#define BME680_NULL_PTR ((void *)0)
|
#define BME680_NULL_PTR ((void *)0)
|
||||||
#define BME680_RETURN_FUNCTION_TYPE s8
|
#define BME680_RETURN_FUNCTION_TYPE s8
|
||||||
#define BME680_INIT_VALUE ((u8)0)
|
|
||||||
|
|
||||||
|
|
||||||
/* Section 3.5: Function macros */
|
/* Section 3.5: Function macros */
|
||||||
#define BME680_SET_REG(reg, data, mask, shift)\
|
#define BME680_SET_REG(reg, data, mask, shift)\
|
||||||
@ -283,8 +309,6 @@ struct bme680_t {
|
|||||||
*/
|
*/
|
||||||
struct bme680_heater_conf {
|
struct bme680_heater_conf {
|
||||||
|
|
||||||
u8 heatr_idacv[BME680_MAX_PROFILES];
|
|
||||||
/**< used to store the idac parameter */
|
|
||||||
u16 heatr_dur_shared;
|
u16 heatr_dur_shared;
|
||||||
/**< variable to store heater duration for parallel mode */
|
/**< variable to store heater duration for parallel mode */
|
||||||
u16 heater_temp[BME680_MAX_PROFILES];
|
u16 heater_temp[BME680_MAX_PROFILES];
|
||||||
@ -586,7 +610,7 @@ enum bme680_return_type bme680_set_sensor_config(
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief This function is used for setting gas heater configuration
|
* @brief This function is used for setting gas heater configuration
|
||||||
* of the sensor from register 50 to 6E address
|
* of the sensor from register 5A to 6E address
|
||||||
*/
|
*/
|
||||||
enum bme680_return_type bme680_set_gas_heater_config(
|
enum bme680_return_type bme680_set_gas_heater_config(
|
||||||
struct bme680_heater_conf *heatr_conf, struct bme680_t *bme680);
|
struct bme680_heater_conf *heatr_conf, struct bme680_t *bme680);
|
||||||
@ -600,7 +624,7 @@ enum bme680_return_type bme680_get_sensor_config(
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief This function is used to read the sensor heater
|
* @brief This function is used to read the sensor heater
|
||||||
* configuration from register 50 to 6E address
|
* configuration from register 5A to 6E address
|
||||||
*/
|
*/
|
||||||
enum bme680_return_type bme680_get_gas_heater_config(
|
enum bme680_return_type bme680_get_gas_heater_config(
|
||||||
struct bme680_heater_conf *heatr_conf, struct bme680_t *bme680);
|
struct bme680_heater_conf *heatr_conf, struct bme680_t *bme680);
|
||||||
|
@ -1,56 +1,86 @@
|
|||||||
/*
|
/**
|
||||||
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
*
|
*
|
||||||
* File : bme680_calculations.c
|
* File : bme680_calculations.c
|
||||||
*
|
*
|
||||||
* Date : 2016/06/10
|
* Date: 5 May 2017
|
||||||
*
|
*
|
||||||
* Revision: 2.0.0
|
* Revision : 2.2.0 $
|
||||||
*
|
*
|
||||||
* Usage: Sensor Driver for BME680 sensor
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* \Section Disclaimer
|
|
||||||
* License:
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* \section Disclaimer
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Common:
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
* documentation and/or other materials provided with the distribution.
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
*
|
*
|
||||||
* Neither the name of the copyright holder nor the names of the
|
* The purchaser must monitor the market for the purchased products,
|
||||||
* contributors may be used to endorse or promote products derived from
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
* this software without specific prior written permission.
|
* without delay of all security relevant incidents.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
* Samples may vary from the valid technical specifications of the product
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* series. They are therefore not intended or fit for resale to third
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
|
* client testing. The testing of an engineering sample may in no way
|
||||||
* OR CONTRIBUTORS BE LIABLE FOR ANY
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
* no liability for the use of engineering samples.
|
||||||
* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
* samples.
|
||||||
* 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.
|
* Special:
|
||||||
* The copyright holder assumes no responsibility
|
* This software module (hereinafter called "Software") and any information
|
||||||
* for the consequences of use
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
* of such information nor for any infringement of patents or
|
* free of charge for the sole purpose to support your application work.
|
||||||
|
* The Software and Information is subject to the following
|
||||||
|
* terms and conditions:
|
||||||
|
*
|
||||||
|
* The Software is specifically designed for the exclusive use for
|
||||||
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
|
* and training. Do not use this Software if you do not have the
|
||||||
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
|
* subject to change without notice.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
/*! \file bme680_calculations.c
|
/*! \file bme680_calculations.c
|
||||||
\brief BME680 Sensor Driver calculation source File */
|
\brief BME680 Sensor Driver calculation source File */
|
||||||
@ -93,10 +123,10 @@
|
|||||||
s32 bme680_calculate_gas_int32(u16 gas_adc_u16, u8 gas_range_u8,
|
s32 bme680_calculate_gas_int32(u16 gas_adc_u16, u8 gas_range_u8,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s8 range_switching_error_val = BME680_INIT_VALUE;
|
s8 range_switching_error_val = 0;
|
||||||
s64 var1 = BME680_INIT_VALUE;
|
s64 var1 = 0;
|
||||||
s64 var2 = BME680_INIT_VALUE;
|
s64 var2 = 0;
|
||||||
s32 gas_res = BME680_INIT_VALUE;
|
s32 gas_res = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -148,10 +178,10 @@ s32 bme680_calculate_gas_int32(u16 gas_adc_u16, u8 gas_range_u8,
|
|||||||
s32 bme680_compensate_temperature_int32(u32 v_uncomp_temperature_u32,
|
s32 bme680_compensate_temperature_int32(u32 v_uncomp_temperature_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s32 var1 = BME680_INIT_VALUE;
|
s32 var1 = 0;
|
||||||
s32 var2 = BME680_INIT_VALUE;
|
s32 var2 = 0;
|
||||||
s32 var3 = BME680_INIT_VALUE;
|
s32 var3 = 0;
|
||||||
s32 temp_comp = BME680_INIT_VALUE;
|
s32 temp_comp = 0;
|
||||||
|
|
||||||
var1 = ((s32)v_uncomp_temperature_u32 >> 3) -
|
var1 = ((s32)v_uncomp_temperature_u32 >> 3) -
|
||||||
((s32)bme680->cal_param.par_T1 << 1);
|
((s32)bme680->cal_param.par_T1 << 1);
|
||||||
@ -186,14 +216,14 @@ s32 bme680_compensate_temperature_int32(u32 v_uncomp_temperature_u32,
|
|||||||
s32 bme680_compensate_humidity_int32(u32 v_uncomp_humidity_u32,
|
s32 bme680_compensate_humidity_int32(u32 v_uncomp_humidity_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s32 temp_scaled = BME680_INIT_VALUE;
|
s32 temp_scaled = 0;
|
||||||
s32 var1 = BME680_INIT_VALUE;
|
s32 var1 = 0;
|
||||||
s32 var2 = BME680_INIT_VALUE;
|
s32 var2 = 0;
|
||||||
s32 var3 = BME680_INIT_VALUE;
|
s32 var3 = 0;
|
||||||
s32 var4 = BME680_INIT_VALUE;
|
s32 var4 = 0;
|
||||||
s32 var5 = BME680_INIT_VALUE;
|
s32 var5 = 0;
|
||||||
s32 var6 = BME680_INIT_VALUE;
|
s32 var6 = 0;
|
||||||
s32 humidity_comp = BME680_INIT_VALUE;
|
s32 humidity_comp = 0;
|
||||||
|
|
||||||
temp_scaled = (((s32)bme680->cal_param.t_fine * 5) + 128) >> 8;
|
temp_scaled = (((s32)bme680->cal_param.t_fine * 5) + 128) >> 8;
|
||||||
var1 = (s32)v_uncomp_humidity_u32 -
|
var1 = (s32)v_uncomp_humidity_u32 -
|
||||||
@ -246,11 +276,11 @@ s32 bme680_compensate_humidity_int32(u32 v_uncomp_humidity_u32,
|
|||||||
s32 bme680_compensate_pressure_int32(u32 v_uncomp_pressure_u32,
|
s32 bme680_compensate_pressure_int32(u32 v_uncomp_pressure_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s32 var1 = BME680_INIT_VALUE;
|
s32 var1 = 0;
|
||||||
s32 var2 = BME680_INIT_VALUE;
|
s32 var2 = 0;
|
||||||
s32 var3 = BME680_INIT_VALUE;
|
s32 var3 = 0;
|
||||||
s32 var4 = BME680_INIT_VALUE;
|
s32 var4 = 0;
|
||||||
s32 pressure_comp = BME680_INIT_VALUE;
|
s32 pressure_comp = 0;
|
||||||
|
|
||||||
var1 = (((s32)bme680->cal_param.t_fine) >> 1) - 64000;
|
var1 = (((s32)bme680->cal_param.t_fine) >> 1) - 64000;
|
||||||
var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) *
|
var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) *
|
||||||
@ -298,13 +328,13 @@ s32 bme680_compensate_pressure_int32(u32 v_uncomp_pressure_u32,
|
|||||||
u8 bme680_convert_temperature_to_resistance_int32(u16 heater_temp_u16,
|
u8 bme680_convert_temperature_to_resistance_int32(u16 heater_temp_u16,
|
||||||
s16 ambient_temp_s16, struct bme680_t *bme680)
|
s16 ambient_temp_s16, struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s32 var1 = BME680_INIT_VALUE;
|
s32 var1 = 0;
|
||||||
s32 var2 = BME680_INIT_VALUE;
|
s32 var2 = 0;
|
||||||
s32 var3 = BME680_INIT_VALUE;
|
s32 var3 = 0;
|
||||||
s32 var4 = BME680_INIT_VALUE;
|
s32 var4 = 0;
|
||||||
s32 var5 = BME680_INIT_VALUE;
|
s32 var5 = 0;
|
||||||
s32 res_heat_x100 = BME680_INIT_VALUE;
|
s32 res_heat_x100 = 0;
|
||||||
u8 res_heat = BME680_INIT_VALUE;
|
u8 res_heat = 0;
|
||||||
|
|
||||||
|
|
||||||
if ((heater_temp_u16 >= BME680_GAS_PROFILE_TEMPERATURE_MIN)
|
if ((heater_temp_u16 >= BME680_GAS_PROFILE_TEMPERATURE_MIN)
|
||||||
@ -343,8 +373,8 @@ u8 bme680_convert_temperature_to_resistance_int32(u16 heater_temp_u16,
|
|||||||
u16 bme680_compensate_H_int32_sixteen_bit_output(u32 v_uncomp_humidity_u32,
|
u16 bme680_compensate_H_int32_sixteen_bit_output(u32 v_uncomp_humidity_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u32 v_x1_u32 = BME680_INIT_VALUE;
|
u32 v_x1_u32 = 0;
|
||||||
u16 v_x2_u32 = BME680_INIT_VALUE;
|
u16 v_x2_u32 = 0;
|
||||||
|
|
||||||
v_x1_u32 = (u32) bme680_compensate_humidity_int32(
|
v_x1_u32 = (u32) bme680_compensate_humidity_int32(
|
||||||
v_uncomp_humidity_u32, bme680);
|
v_uncomp_humidity_u32, bme680);
|
||||||
@ -368,7 +398,7 @@ u16 bme680_compensate_H_int32_sixteen_bit_output(u32 v_uncomp_humidity_u32,
|
|||||||
s16 bme680_compensate_T_int32_sixteen_bit_output(u32 v_uncomp_temperature_u32,
|
s16 bme680_compensate_T_int32_sixteen_bit_output(u32 v_uncomp_temperature_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
s16 temperature = BME680_INIT_VALUE;
|
s16 temperature = 0;
|
||||||
|
|
||||||
bme680_compensate_temperature_int32(v_uncomp_temperature_u32, bme680);
|
bme680_compensate_temperature_int32(v_uncomp_temperature_u32, bme680);
|
||||||
temperature = (s16)((((
|
temperature = (s16)((((
|
||||||
@ -394,7 +424,7 @@ s16 bme680_compensate_T_int32_sixteen_bit_output(u32 v_uncomp_temperature_u32,
|
|||||||
u32 bme680_compensate_P_int32_twentyfour_bit_output(u32 v_uncomp_pressure_u32,
|
u32 bme680_compensate_P_int32_twentyfour_bit_output(u32 v_uncomp_pressure_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
u32 pressure = BME680_INIT_VALUE;
|
u32 pressure = 0;
|
||||||
|
|
||||||
pressure = (u32)bme680_compensate_pressure_int32(
|
pressure = (u32)bme680_compensate_pressure_int32(
|
||||||
v_uncomp_pressure_u32, bme680);
|
v_uncomp_pressure_u32, bme680);
|
||||||
@ -420,7 +450,7 @@ u32 bme680_compensate_P_int32_twentyfour_bit_output(u32 v_uncomp_pressure_u32,
|
|||||||
double bme680_compensate_gas_double(u16 gas_adc_u16, u8 gas_range_u8,
|
double bme680_compensate_gas_double(u16 gas_adc_u16, u8 gas_range_u8,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
double gas_res_d = BME680_INIT_VALUE;
|
double gas_res_d = 0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef HEATER_C1_ENABLE
|
#ifdef HEATER_C1_ENABLE
|
||||||
@ -431,10 +461,10 @@ double bme680_compensate_gas_double(u16 gas_adc_u16, u8 gas_range_u8,
|
|||||||
const double lookup_k2_range[BME680_GAS_RANGE_RL_LENGTH] = {
|
const double lookup_k2_range[BME680_GAS_RANGE_RL_LENGTH] = {
|
||||||
0.0, 0.0, 0.0, 0.0, 0.1, 0.7, 0.0, -0.8,
|
0.0, 0.0, 0.0, 0.0, 0.1, 0.7, 0.0, -0.8,
|
||||||
-0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
-0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||||
s8 range_switching_error_val = BME680_INIT_VALUE;
|
s8 range_switching_error_val = 0;
|
||||||
double var1 = BME680_INIT_VALUE;
|
double var1 = 0;
|
||||||
double var2 = BME680_INIT_VALUE;
|
double var2 = 0;
|
||||||
double var3 = BME680_INIT_VALUE;
|
double var3 = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -476,11 +506,11 @@ double bme680_compensate_gas_double(u16 gas_adc_u16, u8 gas_range_u8,
|
|||||||
double bme680_compensate_humidity_double(u16 uncom_humidity_u16,
|
double bme680_compensate_humidity_double(u16 uncom_humidity_u16,
|
||||||
double comp_temperature, struct bme680_t *bme680)
|
double comp_temperature, struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
double humidity_comp = BME680_INIT_VALUE;
|
double humidity_comp = 0;
|
||||||
double var1 = BME680_INIT_VALUE;
|
double var1 = 0;
|
||||||
double var2 = BME680_INIT_VALUE;
|
double var2 = 0;
|
||||||
double var3 = BME680_INIT_VALUE;
|
double var3 = 0;
|
||||||
double var4 = BME680_INIT_VALUE;
|
double var4 = 0;
|
||||||
|
|
||||||
var1 = (double)((double)uncom_humidity_u16) - (((double)
|
var1 = (double)((double)uncom_humidity_u16) - (((double)
|
||||||
bme680->cal_param.par_H1 * 16.0) +
|
bme680->cal_param.par_H1 * 16.0) +
|
||||||
@ -522,10 +552,10 @@ double bme680_compensate_humidity_double(u16 uncom_humidity_u16,
|
|||||||
double bme680_compensate_pressure_double(u32 uncom_pressure_u32,
|
double bme680_compensate_pressure_double(u32 uncom_pressure_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
double data1_d = BME680_INIT_VALUE;
|
double data1_d = 0;
|
||||||
double data2_d = BME680_INIT_VALUE;
|
double data2_d = 0;
|
||||||
double data3_d = BME680_INIT_VALUE;
|
double data3_d = 0;
|
||||||
double pressure_comp = BME680_INIT_VALUE;
|
double pressure_comp = 0;
|
||||||
|
|
||||||
data1_d = (((double)bme680->cal_param.t_fine / 2.0) - 64000.0);
|
data1_d = (((double)bme680->cal_param.t_fine / 2.0) - 64000.0);
|
||||||
data2_d = data1_d * data1_d * (((double)bme680->cal_param.par_P6) /
|
data2_d = data1_d * data1_d * (((double)bme680->cal_param.par_P6) /
|
||||||
@ -541,7 +571,7 @@ double bme680_compensate_pressure_double(u32 uncom_pressure_u32,
|
|||||||
((double)bme680->cal_param.par_P1));
|
((double)bme680->cal_param.par_P1));
|
||||||
pressure_comp = (1048576.0 - ((double)uncom_pressure_u32));
|
pressure_comp = (1048576.0 - ((double)uncom_pressure_u32));
|
||||||
/* Avoid exception caused by division by zero */
|
/* Avoid exception caused by division by zero */
|
||||||
if ((int)data1_d != BME680_INIT_VALUE) {
|
if ((int)data1_d != 0) {
|
||||||
pressure_comp = (((pressure_comp - (data2_d
|
pressure_comp = (((pressure_comp - (data2_d
|
||||||
/ 4096.0)) * 6250.0) / data1_d);
|
/ 4096.0)) * 6250.0) / data1_d);
|
||||||
data1_d = (((double)bme680->cal_param.par_P9) *
|
data1_d = (((double)bme680->cal_param.par_P9) *
|
||||||
@ -556,7 +586,7 @@ double bme680_compensate_pressure_double(u32 uncom_pressure_u32,
|
|||||||
return pressure_comp;
|
return pressure_comp;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return BME680_INIT_VALUE;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -577,9 +607,9 @@ double bme680_compensate_pressure_double(u32 uncom_pressure_u32,
|
|||||||
double bme680_compensate_temperature_double(u32 uncom_temperature_u32,
|
double bme680_compensate_temperature_double(u32 uncom_temperature_u32,
|
||||||
struct bme680_t *bme680)
|
struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
double data1_d = BME680_INIT_VALUE;
|
double data1_d = 0;
|
||||||
double data2_d = BME680_INIT_VALUE;
|
double data2_d = 0;
|
||||||
double temperature = BME680_INIT_VALUE;
|
double temperature = 0;
|
||||||
/* calculate x1 data */
|
/* calculate x1 data */
|
||||||
data1_d = ((((double)uncom_temperature_u32 / 16384.0)
|
data1_d = ((((double)uncom_temperature_u32 / 16384.0)
|
||||||
- ((double)bme680->cal_param.par_T1 / 1024.0))
|
- ((double)bme680->cal_param.par_T1 / 1024.0))
|
||||||
@ -617,12 +647,12 @@ double bme680_compensate_temperature_double(u32 uncom_temperature_u32,
|
|||||||
double bme680_convert_temperature_to_resistance_double(u16 heater_temp_u16,
|
double bme680_convert_temperature_to_resistance_double(u16 heater_temp_u16,
|
||||||
s16 ambient_temp_s16, struct bme680_t *bme680)
|
s16 ambient_temp_s16, struct bme680_t *bme680)
|
||||||
{
|
{
|
||||||
double var1 = BME680_INIT_VALUE;
|
double var1 = 0;
|
||||||
double var2 = BME680_INIT_VALUE;
|
double var2 = 0;
|
||||||
double var3 = BME680_INIT_VALUE;
|
double var3 = 0;
|
||||||
double var4 = BME680_INIT_VALUE;
|
double var4 = 0;
|
||||||
double var5 = BME680_INIT_VALUE;
|
double var5 = 0;
|
||||||
double res_heat = BME680_INIT_VALUE;
|
double res_heat = 0;
|
||||||
|
|
||||||
if ((heater_temp_u16 >= BME680_GAS_PROFILE_TEMPERATURE_MIN)
|
if ((heater_temp_u16 >= BME680_GAS_PROFILE_TEMPERATURE_MIN)
|
||||||
&& (heater_temp_u16 <= BME680_GAS_PROFILE_TEMPERATURE_MAX)) {
|
&& (heater_temp_u16 <= BME680_GAS_PROFILE_TEMPERATURE_MAX)) {
|
||||||
|
@ -1,58 +1,87 @@
|
|||||||
/*
|
/**
|
||||||
****************************************************************************
|
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
|
||||||
*
|
|
||||||
* File : bme680_calculations.h
|
|
||||||
*
|
|
||||||
* Date : 2016/06/10
|
|
||||||
*
|
*
|
||||||
* Revision: 2.0.0
|
****************************************************************************
|
||||||
*
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
* Usage: Sensor Driver for BME680 sensor
|
|
||||||
*
|
|
||||||
****************************************************************************
|
|
||||||
* \Section Disclaimer
|
|
||||||
*
|
|
||||||
* License:
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* File : bme680_calculations.h
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Date: 5 May 2017
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Revision : 2.2.0 $
|
||||||
* 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
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
* 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.
|
* \section Disclaimer
|
||||||
* The copyright holder assumes no responsibility
|
*
|
||||||
* for the consequences of use
|
* Common:
|
||||||
* of such information nor for any infringement of patents or
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
|
*
|
||||||
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
|
*
|
||||||
|
* The purchaser must monitor the market for the purchased products,
|
||||||
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
|
* without delay of all security relevant incidents.
|
||||||
|
*
|
||||||
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
|
* Samples may vary from the valid technical specifications of the product
|
||||||
|
* series. They are therefore not intended or fit for resale to third
|
||||||
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
|
* client testing. The testing of an engineering sample may in no way
|
||||||
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
|
* no liability for the use of engineering samples.
|
||||||
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
|
* samples.
|
||||||
|
*
|
||||||
|
* Special:
|
||||||
|
* This software module (hereinafter called "Software") and any information
|
||||||
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
|
* free of charge for the sole purpose to support your application work.
|
||||||
|
* The Software and Information is subject to the following
|
||||||
|
* terms and conditions:
|
||||||
|
*
|
||||||
|
* The Software is specifically designed for the exclusive use for
|
||||||
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
|
* and training. Do not use this Software if you do not have the
|
||||||
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
**************************************************************************/
|
* subject to change without notice.
|
||||||
|
**************************************************************************/
|
||||||
/*! \file bme680_calculations.h
|
/*! \file bme680_calculations.h
|
||||||
\brief BME680 Sensor Driver calculation Header File */
|
\brief BME680 Sensor Driver calculation Header File */
|
||||||
|
|
||||||
|
@ -1,58 +1,86 @@
|
|||||||
/*
|
/**
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
*
|
*
|
||||||
* File : bme680_internal.h
|
* File : bme680_internal.h
|
||||||
*
|
*
|
||||||
* Date : 2016/06/10
|
* Date: 5 May 2017
|
||||||
*
|
*
|
||||||
* Revision: 2.0.0
|
* Revision : 2.2.0 $
|
||||||
*
|
*
|
||||||
* Usage: Sensor Driver for BME680 sensor
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*
|
*
|
||||||
* Section Disclaimer
|
* \section Disclaimer
|
||||||
* License:
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Common:
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* The purchaser must monitor the market for the purchased products,
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
* documentation and/or other materials provided with the distribution.
|
* without delay of all security relevant incidents.
|
||||||
*
|
*
|
||||||
* Neither the name of the copyright holder nor the names of the
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
* contributors may be used to endorse or promote products derived from
|
* Samples may vary from the valid technical specifications of the product
|
||||||
* this software without specific prior written permission.
|
* series. They are therefore not intended or fit for resale to third
|
||||||
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
|
* client testing. The testing of an engineering sample may in no way
|
||||||
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
|
* no liability for the use of engineering samples.
|
||||||
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
|
* samples.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
* Special:
|
||||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
* This software module (hereinafter called "Software") and any information
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* free of charge for the sole purpose to support your application work.
|
||||||
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
|
* The Software and Information is subject to the following
|
||||||
* OR CONTRIBUTORS BE LIABLE FOR ANY
|
* terms and conditions:
|
||||||
* 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 Software is specifically designed for the exclusive use for
|
||||||
* The copyright holder assumes no responsibility
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
* for the consequences of use
|
* and training. Do not use this Software if you do not have the
|
||||||
* of such information nor for any infringement of patents or
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
|
* subject to change without notice.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
/*! \file bme680_internal.h
|
/*! \file bme680_internal.h
|
||||||
\brief BME680 Sensor Driver internal support Header File */
|
\brief BME680 Sensor Driver internal support Header File */
|
||||||
@ -85,7 +113,7 @@
|
|||||||
#define BME680_GAS_WAIT_STEP_SIZE (477)
|
#define BME680_GAS_WAIT_STEP_SIZE (477)
|
||||||
|
|
||||||
#define BME680_SENS_CONF_LEN (0x06)
|
#define BME680_SENS_CONF_LEN (0x06)
|
||||||
#define BME680_SENS_HEATR_CONF_LEN (0x1F)
|
#define BME680_SENS_HEATR_CONF_LEN (0x15)
|
||||||
|
|
||||||
#define BME680_TRUE (1)
|
#define BME680_TRUE (1)
|
||||||
#define BME680_FALSE (0)
|
#define BME680_FALSE (0)
|
||||||
@ -113,7 +141,7 @@
|
|||||||
|
|
||||||
#define BME680_ADDR_SPI_MEM_PAGE (0x73)
|
#define BME680_ADDR_SPI_MEM_PAGE (0x73)
|
||||||
#define BME680_ADDR_OP_MODE (0x74)
|
#define BME680_ADDR_OP_MODE (0x74)
|
||||||
#define BME680_ADDR_SENS_CONF_START (0x50)
|
#define BME680_ADDR_SENS_CONF_START (0x5A)
|
||||||
#define BME680_ADDR_FIELD_0 (0x1D)
|
#define BME680_ADDR_FIELD_0 (0x1D)
|
||||||
#define BME680_ADDR_SENSOR_CONFIG (0x70)
|
#define BME680_ADDR_SENSOR_CONFIG (0x70)
|
||||||
#define BME680_ADDR_RES_HEAT_VAL (0x00)
|
#define BME680_ADDR_RES_HEAT_VAL (0x00)
|
||||||
|
@ -1,58 +1,86 @@
|
|||||||
/*
|
/**
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Copyright (C) 2015 Bosch Sensortec GmbH
|
* Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
|
||||||
*
|
*
|
||||||
* File : sensor_api_common_types.h
|
* File : sensor_api_common_types.h
|
||||||
*
|
*
|
||||||
* Date : 2016/06/10
|
* Date: 5 May 2017
|
||||||
*
|
*
|
||||||
* Revision: 2.0.1
|
* Revision : 2.2.0 $
|
||||||
*
|
*
|
||||||
* Usage: sensor API common data types Header File
|
* Usage: Sensor Driver for BME680 sensor
|
||||||
*
|
*
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*
|
*
|
||||||
* Section Disclaimer
|
* \section Disclaimer
|
||||||
* License:
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Common:
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* Bosch Sensortec products are developed for the consumer goods industry.
|
||||||
|
* They may only be used within the parameters of the respective valid
|
||||||
|
* product data sheet. Bosch Sensortec products are provided with the
|
||||||
|
* express understanding that there is no warranty of fitness for a
|
||||||
|
* particular purpose.They are not fit for use in life-sustaining,
|
||||||
|
* safety or security sensitive systems or any system or device
|
||||||
|
* that may lead to bodily harm or property damage if the system
|
||||||
|
* or device malfunctions. In addition,Bosch Sensortec products are
|
||||||
|
* not fit for use in products which interact with motor vehicle systems.
|
||||||
|
* The resale and or use of products are at the purchasers own risk and
|
||||||
|
* his own responsibility. The examination of fitness for the intended use
|
||||||
|
* is the sole responsibility of the Purchaser.
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* The purchaser shall indemnify Bosch Sensortec from all third party
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* claims, including any claims for incidental, or consequential damages,
|
||||||
|
* arising from any product use not covered by the parameters of
|
||||||
|
* the respective valid product data sheet or not approved by
|
||||||
|
* Bosch Sensortec and reimburse Bosch Sensortec for all costs in
|
||||||
|
* connection with such claims.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* The purchaser must monitor the market for the purchased products,
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* particularly with regard to product safety and inform Bosch Sensortec
|
||||||
* documentation and/or other materials provided with the distribution.
|
* without delay of all security relevant incidents.
|
||||||
*
|
*
|
||||||
* Neither the name of the copyright holder nor the names of the
|
* Engineering Samples are marked with an asterisk (*) or (e).
|
||||||
* contributors may be used to endorse or promote products derived from
|
* Samples may vary from the valid technical specifications of the product
|
||||||
* this software without specific prior written permission.
|
* series. They are therefore not intended or fit for resale to third
|
||||||
|
* parties or for use in end products. Their sole purpose is internal
|
||||||
|
* client testing. The testing of an engineering sample may in no way
|
||||||
|
* replace the testing of a product series. Bosch Sensortec assumes
|
||||||
|
* no liability for the use of engineering samples.
|
||||||
|
* By accepting the engineering samples, the Purchaser agrees to indemnify
|
||||||
|
* Bosch Sensortec from all claims arising from the use of engineering
|
||||||
|
* samples.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
* Special:
|
||||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
* This software module (hereinafter called "Software") and any information
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* on application-sheets (hereinafter called "Information") is provided
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* free of charge for the sole purpose to support your application work.
|
||||||
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
|
* The Software and Information is subject to the following
|
||||||
* OR CONTRIBUTORS BE LIABLE FOR ANY
|
* terms and conditions:
|
||||||
* 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 Software is specifically designed for the exclusive use for
|
||||||
* The copyright holder assumes no responsibility
|
* Bosch Sensortec products by personnel who have special experience
|
||||||
* for the consequences of use
|
* and training. Do not use this Software if you do not have the
|
||||||
* of such information nor for any infringement of patents or
|
* proper experience or training.
|
||||||
|
*
|
||||||
|
* This Software package is provided `` as is `` and without any expressed
|
||||||
|
* or implied warranties,including without limitation, the implied warranties
|
||||||
|
* of merchantability and fitness for a particular purpose.
|
||||||
|
*
|
||||||
|
* Bosch Sensortec and their representatives and agents deny any liability
|
||||||
|
* for the functional impairment
|
||||||
|
* of this Software in terms of fitness, performance and safety.
|
||||||
|
* Bosch Sensortec and their representatives and agents shall not be liable
|
||||||
|
* for any direct or indirect damages or injury, except as
|
||||||
|
* otherwise stipulated in mandatory applicable law.
|
||||||
|
*
|
||||||
|
* The Information provided is believed to be accurate and reliable.
|
||||||
|
* Bosch Sensortec 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.
|
* other rights of third parties which may result from its use.
|
||||||
* No license is granted by implication or otherwise under any patent or
|
* No license is granted by implication or otherwise under any patent or
|
||||||
* patent rights of the copyright holder.
|
* patent rights of Bosch. Specifications mentioned in the Information are
|
||||||
|
* subject to change without notice.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
/*! \file sensor_api_common_types.h
|
/*! \file sensor_api_common_types.h
|
||||||
\brief sensor API common data types Header File */
|
\brief sensor API common data types Header File */
|
||||||
|
Loading…
Reference in New Issue
Block a user