From 494b3bb26b026dcc26059e512bb71b60eb364376 Mon Sep 17 00:00:00 2001 From: Bosch Sensortec Date: Tue, 21 Nov 2017 09:23:43 +0100 Subject: [PATCH] Changed - Updated the buffer size in "get_calib_data" API - Updated the set/get gas profile duration logic --- README.md | 6 +++--- bme680.c | 20 ++++++++++++++++---- bme680.h | 4 ++-- bme680_defs.h | 8 ++++---- changelog.md | 14 ++++++++++---- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index aea2bc5..f5042bf 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ The sensor driver package includes bme680.h, bme680.c and bme680_defs.h files ## Version File | Version | Date --------------|---------|------------- -bme680.c | 3.5.3 | 30 Oct 2017 -bme680.h | 3.5.3 | 30 Oct 2017 -bme680_defs.h | 3.5.3 | 30 Oct 2017 +bme680.c | 3.5.5 | 20 Nov 2017 +bme680.h | 3.5.5 | 20 Nov 2017 +bme680_defs.h | 3.5.5 | 20 Nov 2017 ## Integration details * Integrate bme680.h, bme680_defs.h and bme680.c file in to your project. diff --git a/bme680.c b/bme680.c index b457dac..b68e20e 100644 --- a/bme680.c +++ b/bme680.c @@ -40,8 +40,8 @@ * patent rights of the copyright holder. * * File bme680.c - * @date 30 Oct 2017 - * @version 3.5.3 + * @date 20 Nov 2017 + * @version 3.5.5 * */ @@ -596,9 +596,15 @@ int8_t bme680_get_sensor_mode(struct bme680_dev *dev) void bme680_set_profile_dur(uint16_t duration, struct bme680_dev *dev) { uint32_t tph_dur; /* Calculate in us */ + uint32_t meas_cycles; + uint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16}; + + meas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp]; + meas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres]; + meas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum]; /* TPH measurement duration */ - tph_dur = ((uint32_t) (dev->tph_sett.os_temp + dev->tph_sett.os_pres + dev->tph_sett.os_hum) * UINT32_C(1963)); + tph_dur = meas_cycles * UINT32_C(1963); tph_dur += UINT32_C(477 * 4); /* TPH switching duration */ tph_dur += UINT32_C(477 * 5); /* Gas measurement duration */ tph_dur += UINT32_C(500); /* Get it to the closest whole number.*/ @@ -615,9 +621,15 @@ void bme680_set_profile_dur(uint16_t duration, struct bme680_dev *dev) void bme680_get_profile_dur(uint16_t *duration, const struct bme680_dev *dev) { uint32_t tph_dur; /* Calculate in us */ + uint32_t meas_cycles; + uint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16}; + + meas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp]; + meas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres]; + meas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum]; /* TPH measurement duration */ - tph_dur = ((uint32_t) (dev->tph_sett.os_temp + dev->tph_sett.os_pres + dev->tph_sett.os_hum) * UINT32_C(1963)); + tph_dur = meas_cycles * UINT32_C(1963); tph_dur += UINT32_C(477 * 4); /* TPH switching duration */ tph_dur += UINT32_C(477 * 5); /* Gas measurement duration */ tph_dur += UINT32_C(500); /* Get it to the closest whole number.*/ diff --git a/bme680.h b/bme680.h index 56eb7a8..7196058 100644 --- a/bme680.h +++ b/bme680.h @@ -40,8 +40,8 @@ * patent rights of the copyright holder. * * @file bme680.h - * @date 30 Oct 2017 - * @version 3.5.3 + * @date 20 Nov 2017 + * @version 3.5.5 * @brief * */ diff --git a/bme680_defs.h b/bme680_defs.h index 3afb94c..0cf581b 100644 --- a/bme680_defs.h +++ b/bme680_defs.h @@ -39,9 +39,9 @@ * No license is granted by implication or otherwise under any patent or * patent rights of the copyright holder. * - * @file bme680_defs.h - * @date 30 Oct 2017 - * @version 3.5.3 + * @file bme680_defs.h + * @date 20 Nov 2017 + * @version 3.5.5 * @brief * */ @@ -111,7 +111,7 @@ #define BME680_CHIP_ID UINT8_C(0x61) /** BME680 coefficients related defines */ -#define BME680_COEFF_SIZE UINT8_C(0x41) +#define BME680_COEFF_SIZE UINT8_C(41) #define BME680_COEFF_ADDR1_LEN UINT8_C(25) #define BME680_COEFF_ADDR2_LEN UINT8_C(16) diff --git a/changelog.md b/changelog.md index c777229..fd357da 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,14 @@ # Change Log All notable changes to the BME680 Sensor API will be documented in this file. + +## v3.5.5, 20 Nov 2017 +### Changed + - Updated the buffer size in "get_calib_data" API + +## v3.5.4, 16 Nov 2017 +### Changed + - Updated the set/get gas profile duration logic + ## v3.5.3, 30 Oct 2017 ### Changed - Changed the compensation equation formulae to use shifting operation @@ -21,14 +30,12 @@ All notable changes to the BME680 Sensor API will be documented in this file. - Updated documentation for the type definitions - Removed mode check for get sensor data and setting and getting profile dur - ## v3.5.0, 28 Jun 2017 ### Changed - Fixed bug with getting and setting mem pages - Changed initialization sequence to be more robust - Added additional tries while reading data in case of inadequate delay - ## v3.4.0, 8 Jun 2017 ### Changed - Modified the bme680_get_sensor_data API. User has to now pass the struct that stores the data rather than retrieving from the bme680_dev structure. @@ -47,5 +54,4 @@ All notable changes to the BME680 Sensor API will be documented in this file. ## v3.2.1, 17 May 2017 ### Added -- Took the reference as base version 3.2.1 of BME680 sensor and added. - +- Took the reference as base version 3.2.1 of BME680 sensor and added. \ No newline at end of file