Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MERGE Sensor_iAQ_sgp30_bme_si7051 POCBreath_V2_smd_commercial
bme680_defs.h
00001 /** 00002 * @brief bme680_defs.h 00003 * @details Low power gas, pressure, temperature & humidity sensor. 00004 * Header file. 00005 * 00006 * 00007 * @return N/A 00008 * 00009 * @author Manuel Caballero 00010 * @date 21/July/2018 00011 * @version 21/July/2018 The ORIGIN 00012 * @pre This is just a port from Bosh driver to mBed ( c++ ) 00013 * @warning N/A 00014 * @pre This code belongs to Nimbus Centre ( http://www.nimbus.cit.ie ). 00015 */ 00016 /** 00017 * Copyright (C) 2017 - 2018 Bosch Sensortec GmbH 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions are met: 00021 * 00022 * Redistributions of source code must retain the above copyright 00023 * notice, this list of conditions and the following disclaimer. 00024 * 00025 * Redistributions in binary form must reproduce the above copyright 00026 * notice, this list of conditions and the following disclaimer in the 00027 * documentation and/or other materials provided with the distribution. 00028 * 00029 * Neither the name of the copyright holder nor the names of the 00030 * contributors may be used to endorse or promote products derived from 00031 * this software without specific prior written permission. 00032 * 00033 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00034 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00035 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00036 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00037 * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER 00038 * OR CONTRIBUTORS BE LIABLE FOR ANY 00039 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 00040 * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, 00041 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00042 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00043 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00044 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00045 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00046 * ANY WAY OUT OF THE USE OF THIS 00047 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00048 * 00049 * The information provided is believed to be accurate and reliable. 00050 * The copyright holder assumes no responsibility 00051 * for the consequences of use 00052 * of such information nor for any infringement of patents or 00053 * other rights of third parties which may result from its use. 00054 * No license is granted by implication or otherwise under any patent or 00055 * patent rights of the copyright holder. 00056 * 00057 * @file bme680_defs.h 00058 * @date 19 Jun 2018 00059 * @version 3.5.9 00060 * @brief 00061 * 00062 */ 00063 00064 /*! @file bme680_defs.h 00065 @brief Sensor driver for BME680 sensor */ 00066 /*! 00067 * @defgroup BME680 SENSOR API 00068 * @brief 00069 * @{*/ 00070 #ifndef BME680_DEFS_H_ 00071 #define BME680_DEFS_H_ 00072 00073 /********************************************************/ 00074 /* header includes */ 00075 #ifdef __KERNEL__ 00076 #include <linux/types.h> 00077 #include <linux/kernel.h> 00078 #else 00079 #include <stdint.h> 00080 #include <stddef.h> 00081 #endif 00082 00083 /******************************************************************************/ 00084 /*! @name Common macros */ 00085 /******************************************************************************/ 00086 /* [MANUEL] Compatible with mBed 00087 #if !defined(UINT8_C) && !defined(INT8_C) 00088 #define INT8_C(x) S8_C(x) 00089 #define UINT8_C(x) U8_C(x) 00090 #endif 00091 00092 #if !defined(UINT16_C) && !defined(INT16_C) 00093 #define INT16_C(x) S16_C(x) 00094 #define UINT16_C(x) U16_C(x) 00095 #endif 00096 00097 #if !defined(INT32_C) && !defined(UINT32_C) 00098 #define INT32_C(x) S32_C(x) 00099 #define UINT32_C(x) U32_C(x) 00100 #endif 00101 00102 #if !defined(INT64_C) && !defined(UINT64_C) 00103 #define INT64_C(x) S64_C(x) 00104 #define UINT64_C(x) U64_C(x) 00105 #endif 00106 */ 00107 00108 #if !defined(UINT8_C) && !defined(INT8_C) 00109 #define INT8_C(x) int8_t(x) 00110 #define UINT8_C(x) uint8_t(x) 00111 #endif 00112 00113 #if !defined(UINT16_C) && !defined(INT16_C) 00114 #define INT16_C(x) int16_t(x) 00115 #define UINT16_C(x) uint16_t(x) 00116 #endif 00117 00118 #if !defined(INT32_C) && !defined(UINT32_C) 00119 #define INT32_C(x) int32_t(x) 00120 #define UINT32_C(x) uint32_t(x) 00121 #endif 00122 00123 #if !defined(INT64_C) && !defined(UINT64_C) 00124 #define INT64_C(x) int64_t(x) 00125 #define UINT64_C(x) uint64_t(x) 00126 #endif 00127 00128 00129 /**@}*/ 00130 00131 /**\name C standard macros */ 00132 #ifndef NULL 00133 #ifdef __cplusplus 00134 #define NULL 0 00135 #else 00136 #define NULL ((void *) 0) 00137 #endif 00138 #endif 00139 00140 /** BME680 configuration macros */ 00141 /** Enable or un-comment the macro to provide floating point data output */ 00142 #ifndef BME680_FLOAT_POINT_COMPENSATION 00143 /* #define BME680_FLOAT_POINT_COMPENSATION */ 00144 #endif 00145 00146 /** BME680 General config */ 00147 #define BME680_POLL_PERIOD_MS UINT8_C(10) 00148 00149 /** BME680 I2C addresses */ 00150 #define BME680_I2C_ADDR_PRIMARY UINT8_C( ( 0x76 << 1 ) ) // [MANUEL] Address compatible with mBed 00151 #define BME680_I2C_ADDR_SECONDARY UINT8_C( ( 0x77 << 1 ) ) // [MANUEL] Address compatible with mBed 00152 00153 /** BME680 unique chip identifier */ 00154 #define BME680_CHIP_ID UINT8_C(0x61) 00155 00156 /** BME680 coefficients related defines */ 00157 #define BME680_COEFF_SIZE UINT8_C(41) 00158 #define BME680_COEFF_ADDR1_LEN UINT8_C(25) 00159 #define BME680_COEFF_ADDR2_LEN UINT8_C(16) 00160 00161 /** BME680 field_x related defines */ 00162 #define BME680_FIELD_LENGTH UINT8_C(15) 00163 #define BME680_FIELD_ADDR_OFFSET UINT8_C(17) 00164 00165 /** Soft reset command */ 00166 #define BME680_SOFT_RESET_CMD UINT8_C(0xb6) 00167 00168 /** Error code definitions */ 00169 #define BME680_OK INT8_C(0) 00170 /* Errors */ 00171 #define BME680_E_NULL_PTR INT8_C(-1) 00172 #define BME680_E_COM_FAIL INT8_C(-2) 00173 #define BME680_E_DEV_NOT_FOUND INT8_C(-3) 00174 #define BME680_E_INVALID_LENGTH INT8_C(-4) 00175 00176 /* Warnings */ 00177 #define BME680_W_DEFINE_PWR_MODE INT8_C(1) 00178 #define BME680_W_NO_NEW_DATA INT8_C(2) 00179 00180 /* Info's */ 00181 #define BME680_I_MIN_CORRECTION UINT8_C(1) 00182 #define BME680_I_MAX_CORRECTION UINT8_C(2) 00183 00184 /** Register map */ 00185 /** Other coefficient's address */ 00186 #define BME680_ADDR_RES_HEAT_VAL_ADDR UINT8_C(0x00) 00187 #define BME680_ADDR_RES_HEAT_RANGE_ADDR UINT8_C(0x02) 00188 #define BME680_ADDR_RANGE_SW_ERR_ADDR UINT8_C(0x04) 00189 #define BME680_ADDR_SENS_CONF_START UINT8_C(0x5A) 00190 #define BME680_ADDR_GAS_CONF_START UINT8_C(0x64) 00191 00192 /** Field settings */ 00193 #define BME680_FIELD0_ADDR UINT8_C(0x1d) 00194 00195 /** Heater settings */ 00196 #define BME680_RES_HEAT0_ADDR UINT8_C(0x5a) 00197 #define BME680_GAS_WAIT0_ADDR UINT8_C(0x64) 00198 00199 /** Sensor configuration registers */ 00200 #define BME680_CONF_HEAT_CTRL_ADDR UINT8_C(0x70) 00201 #define BME680_CONF_ODR_RUN_GAS_NBC_ADDR UINT8_C(0x71) 00202 #define BME680_CONF_OS_H_ADDR UINT8_C(0x72) 00203 #define BME680_MEM_PAGE_ADDR UINT8_C(0xf3) 00204 #define BME680_CONF_T_P_MODE_ADDR UINT8_C(0x74) 00205 #define BME680_CONF_ODR_FILT_ADDR UINT8_C(0x75) 00206 00207 /** Coefficient's address */ 00208 #define BME680_COEFF_ADDR1 UINT8_C(0x89) 00209 #define BME680_COEFF_ADDR2 UINT8_C(0xe1) 00210 00211 /** Chip identifier */ 00212 #define BME680_CHIP_ID_ADDR UINT8_C(0xd0) 00213 00214 /** Soft reset register */ 00215 #define BME680_SOFT_RESET_ADDR UINT8_C(0xe0) 00216 00217 /** Heater control settings */ 00218 #define BME680_ENABLE_HEATER UINT8_C(0x00) 00219 #define BME680_DISABLE_HEATER UINT8_C(0x08) 00220 00221 /** Gas measurement settings */ 00222 #define BME680_DISABLE_GAS_MEAS UINT8_C(0x00) 00223 #define BME680_ENABLE_GAS_MEAS UINT8_C(0x01) 00224 00225 /** Over-sampling settings */ 00226 #define BME680_OS_NONE UINT8_C(0) 00227 #define BME680_OS_1X UINT8_C(1) 00228 #define BME680_OS_2X UINT8_C(2) 00229 #define BME680_OS_4X UINT8_C(3) 00230 #define BME680_OS_8X UINT8_C(4) 00231 #define BME680_OS_16X UINT8_C(5) 00232 00233 /** IIR filter settings */ 00234 #define BME680_FILTER_SIZE_0 UINT8_C(0) 00235 #define BME680_FILTER_SIZE_1 UINT8_C(1) 00236 #define BME680_FILTER_SIZE_3 UINT8_C(2) 00237 #define BME680_FILTER_SIZE_7 UINT8_C(3) 00238 #define BME680_FILTER_SIZE_15 UINT8_C(4) 00239 #define BME680_FILTER_SIZE_31 UINT8_C(5) 00240 #define BME680_FILTER_SIZE_63 UINT8_C(6) 00241 #define BME680_FILTER_SIZE_127 UINT8_C(7) 00242 00243 /** Power mode settings */ 00244 #define BME680_SLEEP_MODE UINT8_C(0) 00245 #define BME680_FORCED_MODE UINT8_C(1) 00246 00247 /** Delay related macro declaration */ 00248 #define BME680_RESET_PERIOD UINT32_C(10) 00249 00250 /** SPI memory page settings */ 00251 #define BME680_MEM_PAGE0 UINT8_C(0x10) 00252 #define BME680_MEM_PAGE1 UINT8_C(0x00) 00253 00254 /** Ambient humidity shift value for compensation */ 00255 #define BME680_HUM_REG_SHIFT_VAL UINT8_C(4) 00256 00257 /** Run gas enable and disable settings */ 00258 #define BME680_RUN_GAS_DISABLE UINT8_C(0) 00259 #define BME680_RUN_GAS_ENABLE UINT8_C(1) 00260 00261 /** Buffer length macro declaration */ 00262 #define BME680_TMP_BUFFER_LENGTH UINT8_C(40) 00263 #define BME680_REG_BUFFER_LENGTH UINT8_C(6) 00264 #define BME680_FIELD_DATA_LENGTH UINT8_C(3) 00265 #define BME680_GAS_REG_BUF_LENGTH UINT8_C(20) 00266 00267 /** Settings selector */ 00268 #define BME680_OST_SEL UINT16_C(1) 00269 #define BME680_OSP_SEL UINT16_C(2) 00270 #define BME680_OSH_SEL UINT16_C(4) 00271 #define BME680_GAS_MEAS_SEL UINT16_C(8) 00272 #define BME680_FILTER_SEL UINT16_C(16) 00273 #define BME680_HCNTRL_SEL UINT16_C(32) 00274 #define BME680_RUN_GAS_SEL UINT16_C(64) 00275 #define BME680_NBCONV_SEL UINT16_C(128) 00276 #define BME680_GAS_SENSOR_SEL (BME680_GAS_MEAS_SEL | BME680_RUN_GAS_SEL | BME680_NBCONV_SEL) 00277 00278 /** Number of conversion settings*/ 00279 #define BME680_NBCONV_MIN UINT8_C(0) 00280 #define BME680_NBCONV_MAX UINT8_C(10) 00281 00282 /** Mask definitions */ 00283 #define BME680_GAS_MEAS_MSK UINT8_C(0x30) 00284 #define BME680_NBCONV_MSK UINT8_C(0X0F) 00285 #define BME680_FILTER_MSK UINT8_C(0X1C) 00286 #define BME680_OST_MSK UINT8_C(0XE0) 00287 #define BME680_OSP_MSK UINT8_C(0X1C) 00288 #define BME680_OSH_MSK UINT8_C(0X07) 00289 #define BME680_HCTRL_MSK UINT8_C(0x08) 00290 #define BME680_RUN_GAS_MSK UINT8_C(0x10) 00291 #define BME680_MODE_MSK UINT8_C(0x03) 00292 #define BME680_RHRANGE_MSK UINT8_C(0x30) 00293 #define BME680_RSERROR_MSK UINT8_C(0xf0) 00294 #define BME680_NEW_DATA_MSK UINT8_C(0x80) 00295 #define BME680_GAS_INDEX_MSK UINT8_C(0x0f) 00296 #define BME680_GAS_RANGE_MSK UINT8_C(0x0f) 00297 #define BME680_GASM_VALID_MSK UINT8_C(0x20) 00298 #define BME680_HEAT_STAB_MSK UINT8_C(0x10) 00299 #define BME680_MEM_PAGE_MSK UINT8_C(0x10) 00300 #define BME680_SPI_RD_MSK UINT8_C(0x80) 00301 #define BME680_SPI_WR_MSK UINT8_C(0x7f) 00302 #define BME680_BIT_H1_DATA_MSK UINT8_C(0x0F) 00303 00304 /** Bit position definitions for sensor settings */ 00305 #define BME680_GAS_MEAS_POS UINT8_C(4) 00306 #define BME680_FILTER_POS UINT8_C(2) 00307 #define BME680_OST_POS UINT8_C(5) 00308 #define BME680_OSP_POS UINT8_C(2) 00309 #define BME680_RUN_GAS_POS UINT8_C(4) 00310 00311 /** Array Index to Field data mapping for Calibration Data*/ 00312 #define BME680_T2_LSB_REG (1) 00313 #define BME680_T2_MSB_REG (2) 00314 #define BME680_T3_REG (3) 00315 #define BME680_P1_LSB_REG (5) 00316 #define BME680_P1_MSB_REG (6) 00317 #define BME680_P2_LSB_REG (7) 00318 #define BME680_P2_MSB_REG (8) 00319 #define BME680_P3_REG (9) 00320 #define BME680_P4_LSB_REG (11) 00321 #define BME680_P4_MSB_REG (12) 00322 #define BME680_P5_LSB_REG (13) 00323 #define BME680_P5_MSB_REG (14) 00324 #define BME680_P7_REG (15) 00325 #define BME680_P6_REG (16) 00326 #define BME680_P8_LSB_REG (19) 00327 #define BME680_P8_MSB_REG (20) 00328 #define BME680_P9_LSB_REG (21) 00329 #define BME680_P9_MSB_REG (22) 00330 #define BME680_P10_REG (23) 00331 #define BME680_H2_MSB_REG (25) 00332 #define BME680_H2_LSB_REG (26) 00333 #define BME680_H1_LSB_REG (26) 00334 #define BME680_H1_MSB_REG (27) 00335 #define BME680_H3_REG (28) 00336 #define BME680_H4_REG (29) 00337 #define BME680_H5_REG (30) 00338 #define BME680_H6_REG (31) 00339 #define BME680_H7_REG (32) 00340 #define BME680_T1_LSB_REG (33) 00341 #define BME680_T1_MSB_REG (34) 00342 #define BME680_GH2_LSB_REG (35) 00343 #define BME680_GH2_MSB_REG (36) 00344 #define BME680_GH1_REG (37) 00345 #define BME680_GH3_REG (38) 00346 00347 /** BME680 register buffer index settings*/ 00348 #define BME680_REG_FILTER_INDEX UINT8_C(5) 00349 #define BME680_REG_TEMP_INDEX UINT8_C(4) 00350 #define BME680_REG_PRES_INDEX UINT8_C(4) 00351 #define BME680_REG_HUM_INDEX UINT8_C(2) 00352 #define BME680_REG_NBCONV_INDEX UINT8_C(1) 00353 #define BME680_REG_RUN_GAS_INDEX UINT8_C(1) 00354 #define BME680_REG_HCTRL_INDEX UINT8_C(0) 00355 00356 /** BME680 pressure calculation macros */ 00357 /*! This max value is used to provide precedence to multiplication or division 00358 * in pressure compensation equation to achieve least loss of precision and 00359 * avoiding overflows. 00360 * i.e Comparing value, BME680_MAX_OVERFLOW_VAL = INT32_C(1 << 30) 00361 */ 00362 #define BME680_MAX_OVERFLOW_VAL INT32_C(0x40000000) 00363 00364 /** Macro to combine two 8 bit data's to form a 16 bit data */ 00365 #define BME680_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb) 00366 00367 /** Macro to SET and GET BITS of a register */ 00368 #define BME680_SET_BITS(reg_data, bitname, data) \ 00369 ((reg_data & ~(bitname##_MSK)) | \ 00370 ((data << bitname##_POS) & bitname##_MSK)) 00371 #define BME680_GET_BITS(reg_data, bitname) ((reg_data & (bitname##_MSK)) >> \ 00372 (bitname##_POS)) 00373 00374 /** Macro variant to handle the bitname position if it is zero */ 00375 #define BME680_SET_BITS_POS_0(reg_data, bitname, data) \ 00376 ((reg_data & ~(bitname##_MSK)) | \ 00377 (data & bitname##_MSK)) 00378 #define BME680_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK)) 00379 00380 /** Type definitions */ 00381 /*! 00382 * Generic communication function pointer 00383 * @param[in] dev_id: Place holder to store the id of the device structure 00384 * Can be used to store the index of the Chip select or 00385 * I2C address of the device. 00386 * @param[in] reg_addr: Used to select the register the where data needs to 00387 * be read from or written to. 00388 * @param[in/out] reg_data: Data array to read/write 00389 * @param[in] len: Length of the data array 00390 */ 00391 typedef int8_t (*bme680_com_fptr_t)(uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len); 00392 00393 /*! 00394 * Delay function pointer 00395 * @param[in] period: Time period in milliseconds 00396 */ 00397 typedef void (*bme680_delay_fptr_t )(uint32_t period); 00398 00399 /*! 00400 * @brief Interface selection Enumerations 00401 */ 00402 enum bme680_intf { 00403 /*! SPI interface */ 00404 BME680_SPI_INTF , 00405 /*! I2C interface */ 00406 BME680_I2C_INTF 00407 }; 00408 00409 /* structure definitions */ 00410 /*! 00411 * @brief Sensor field data structure 00412 */ 00413 struct bme680_field_data { 00414 /*! Contains new_data, gasm_valid & heat_stab */ 00415 uint8_t status ; 00416 /*! The index of the heater profile used */ 00417 uint8_t gas_index ; 00418 /*! Measurement index to track order */ 00419 uint8_t meas_index ; 00420 00421 #ifndef BME680_FLOAT_POINT_COMPENSATION 00422 /*! Temperature in degree celsius x100 */ 00423 int16_t temperature ; 00424 /*! Pressure in Pascal */ 00425 uint32_t pressure ; 00426 /*! Humidity in % relative humidity x1000 */ 00427 uint32_t humidity ; 00428 /*! Gas resistance in Ohms */ 00429 uint32_t gas_resistance ; 00430 #else 00431 /*! Temperature in degree celsius */ 00432 float temperature ; 00433 /*! Pressure in Pascal */ 00434 float pressure ; 00435 /*! Humidity in % relative humidity x1000 */ 00436 float humidity ; 00437 /*! Gas resistance in Ohms */ 00438 float gas_resistance ; 00439 00440 #endif 00441 00442 }; 00443 00444 /*! 00445 * @brief Structure to hold the Calibration data 00446 */ 00447 struct bme680_calib_data { 00448 /*! Variable to store calibrated humidity data */ 00449 uint16_t par_h1 ; 00450 /*! Variable to store calibrated humidity data */ 00451 uint16_t par_h2 ; 00452 /*! Variable to store calibrated humidity data */ 00453 int8_t par_h3 ; 00454 /*! Variable to store calibrated humidity data */ 00455 int8_t par_h4 ; 00456 /*! Variable to store calibrated humidity data */ 00457 int8_t par_h5 ; 00458 /*! Variable to store calibrated humidity data */ 00459 uint8_t par_h6 ; 00460 /*! Variable to store calibrated humidity data */ 00461 int8_t par_h7 ; 00462 /*! Variable to store calibrated gas data */ 00463 int8_t par_gh1 ; 00464 /*! Variable to store calibrated gas data */ 00465 int16_t par_gh2 ; 00466 /*! Variable to store calibrated gas data */ 00467 int8_t par_gh3 ; 00468 /*! Variable to store calibrated temperature data */ 00469 uint16_t par_t1 ; 00470 /*! Variable to store calibrated temperature data */ 00471 int16_t par_t2 ; 00472 /*! Variable to store calibrated temperature data */ 00473 int8_t par_t3 ; 00474 /*! Variable to store calibrated pressure data */ 00475 uint16_t par_p1 ; 00476 /*! Variable to store calibrated pressure data */ 00477 int16_t par_p2 ; 00478 /*! Variable to store calibrated pressure data */ 00479 int8_t par_p3 ; 00480 /*! Variable to store calibrated pressure data */ 00481 int16_t par_p4 ; 00482 /*! Variable to store calibrated pressure data */ 00483 int16_t par_p5 ; 00484 /*! Variable to store calibrated pressure data */ 00485 int8_t par_p6 ; 00486 /*! Variable to store calibrated pressure data */ 00487 int8_t par_p7 ; 00488 /*! Variable to store calibrated pressure data */ 00489 int16_t par_p8 ; 00490 /*! Variable to store calibrated pressure data */ 00491 int16_t par_p9 ; 00492 /*! Variable to store calibrated pressure data */ 00493 uint8_t par_p10 ; 00494 00495 #ifndef BME680_FLOAT_POINT_COMPENSATION 00496 /*! Variable to store t_fine size */ 00497 int32_t t_fine ; 00498 #else 00499 /*! Variable to store t_fine size */ 00500 float t_fine ; 00501 #endif 00502 /*! Variable to store heater resistance range */ 00503 uint8_t res_heat_range ; 00504 /*! Variable to store heater resistance value */ 00505 int8_t res_heat_val ; 00506 /*! Variable to store error range */ 00507 int8_t range_sw_err ; 00508 }; 00509 00510 /*! 00511 * @brief BME680 sensor settings structure which comprises of ODR, 00512 * over-sampling and filter settings. 00513 */ 00514 struct bme680_tph_sett { 00515 /*! Humidity oversampling */ 00516 uint8_t os_hum ; 00517 /*! Temperature oversampling */ 00518 uint8_t os_temp ; 00519 /*! Pressure oversampling */ 00520 uint8_t os_pres ; 00521 /*! Filter coefficient */ 00522 uint8_t filter ; 00523 }; 00524 00525 /*! 00526 * @brief BME680 gas sensor which comprises of gas settings 00527 * and status parameters 00528 */ 00529 struct bme680_gas_sett { 00530 /*! Variable to store nb conversion */ 00531 uint8_t nb_conv ; 00532 /*! Variable to store heater control */ 00533 uint8_t heatr_ctrl ; 00534 /*! Run gas enable value */ 00535 uint8_t run_gas ; 00536 /*! Heater temperature value */ 00537 uint16_t heatr_temp ; 00538 /*! Duration profile value */ 00539 uint16_t heatr_dur ; 00540 }; 00541 00542 /*! 00543 * @brief BME680 device structure 00544 */ 00545 struct bme680_dev { 00546 /*! Chip Id */ 00547 uint8_t chip_id ; 00548 /*! Device Id */ 00549 uint8_t dev_id ; 00550 /*! SPI/I2C interface */ 00551 enum bme680_intf intf ; 00552 /*! Memory page used */ 00553 uint8_t mem_page ; 00554 /*! Ambient temperature in Degree C */ 00555 int8_t amb_temp ; 00556 /*! Sensor calibration data */ 00557 struct bme680_calib_data calib ; 00558 /*! Sensor settings */ 00559 struct bme680_tph_sett tph_sett ; 00560 /*! Gas Sensor settings */ 00561 struct bme680_gas_sett gas_sett ; 00562 /*! Sensor power modes */ 00563 uint8_t power_mode ; 00564 /*! New sensor fields */ 00565 uint8_t new_fields ; 00566 /*! Store the info messages */ 00567 uint8_t info_msg ; 00568 /*! Bus read function pointer */ 00569 bme680_com_fptr_t read ; 00570 /*! Bus write function pointer */ 00571 bme680_com_fptr_t write ; 00572 /*! delay function pointer */ 00573 bme680_delay_fptr_t delay_ms ; 00574 /*! Communication function result */ 00575 int8_t com_rslt ; 00576 }; 00577 00578 00579 00580 #endif /* BME680_DEFS_H_ */ 00581 /** @}*/ 00582 /** @}*/
Generated on Wed Jul 13 2022 22:21:17 by
