42#define CHIP_NAME "Bosch BME688"
43#define MANUFACTURER_NAME "Bosch"
44#define SUPPLY_VOLTAGE_MIN 1.71f
45#define SUPPLY_VOLTAGE_MAX 3.6f
46#define MAX_CURRENT 0.849f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
54#define BME688_REG_NVM_PAR_T1_L 0xE9
55#define BME688_REG_NVM_PAR_T1_H 0xEA
56#define BME688_REG_NVM_PAR_T2_L 0x8A
57#define BME688_REG_NVM_PAR_T2_H 0x8B
58#define BME688_REG_NVM_PAR_T3 0x8C
59#define BME688_REG_NVM_PAR_P1_L 0x8E
60#define BME688_REG_NVM_PAR_P1_H 0x8F
61#define BME688_REG_NVM_PAR_P2_L 0x90
62#define BME688_REG_NVM_PAR_P2_H 0x91
63#define BME688_REG_NVM_PAR_P3 0x92
64#define BME688_REG_NVM_PAR_P4_L 0x94
65#define BME688_REG_NVM_PAR_P4_H 0x95
66#define BME688_REG_NVM_PAR_P5_L 0x96
67#define BME688_REG_NVM_PAR_P5_H 0x97
68#define BME688_REG_NVM_PAR_P6 0x99
69#define BME688_REG_NVM_PAR_P7 0x98
70#define BME688_REG_NVM_PAR_P8_L 0x9C
71#define BME688_REG_NVM_PAR_P8_H 0x9D
72#define BME688_REG_NVM_PAR_P9_L 0x9E
73#define BME688_REG_NVM_PAR_P9_H 0x9F
74#define BME688_REG_NVM_PAR_P10 0xA0
75#define BME688_REG_NVM_PAR_H1_L 0xE2
76#define BME688_REG_NVM_PAR_H1_H 0xE3
77#define BME688_REG_NVM_PAR_H2_L 0xE2
78#define BME688_REG_NVM_PAR_H2_H 0xE1
79#define BME688_REG_NVM_PAR_H3 0xE4
80#define BME688_REG_NVM_PAR_H4 0xE5
81#define BME688_REG_NVM_PAR_H5 0xE6
82#define BME688_REG_NVM_PAR_H6 0xE7
83#define BME688_REG_NVM_PAR_H7 0xE8
84#define BME688_REG_NVM_PAR_G1 0xED
85#define BME688_REG_NVM_PAR_G2_L 0xEB
86#define BME688_REG_NVM_PAR_G2_H 0xEC
87#define BME688_REG_NVM_PAR_G3 0xEE
88#define BME688_REG_NVM_RES_HEAT_RANGE 0x02
89#define BME688_REG_NVM_RES_HEAT_VAL 0x00
90#define BME688_REG_NVM_RANGE_SWITCH 0x04
91#define BME688_REG_STATUS 0x73
92#define BME688_REG_VARIANT_ID 0xF0
93#define BME688_REG_RESET 0xE0
94#define BME688_REG_ID 0xD0
95#define BME688_REG_CONFIG 0x75
96#define BME688_REG_CTRL_MEAS 0x74
97#define BME688_REG_CTRL_HUM 0x72
98#define BME688_REG_CTRL_GAS_1 0x71
99#define BME688_REG_CTRL_GAS_0 0x70
100#define BME688_REG_GAS_WAIT_SHARED 0x6E
101#define BME688_REG_GAS_WAIT_X 0x64
102#define BME688_REG_RES_HEAT_X 0x5A
103#define BME688_REG_IDAC_HEAT_X 0x50
104#define BME688_REG_GAS_R_LSB_2 0x4F
105#define BME688_REG_GAS_R_MSB_2 0x4E
106#define BME688_REG_HUM_LSB_2 0x48
107#define BME688_REG_HUM_MSB_2 0x47
108#define BME688_REG_TEMP_XLSB_2 0x46
109#define BME688_REG_TEMP_LSB_2 0x45
110#define BME688_REG_TEMP_MSB_2 0x44
111#define BME688_REG_PRESS_XLSB_2 0x43
112#define BME688_REG_PRESS_LSB_2 0x42
113#define BME688_REG_PRESS_MSB_2 0x41
114#define BME688_REG_SUB_MEAS_INDEX_2 0x40
115#define BME688_REG_MEAS_STATUS_2 0x3F
116#define BME688_REG_GAS_R_LSB_1 0x3E
117#define BME688_REG_GAS_R_MSB_1 0x3D
118#define BME688_REG_HUM_LSB_1 0x37
119#define BME688_REG_HUM_MSB_1 0x36
120#define BME688_REG_TEMP_XLSB_1 0x35
121#define BME688_REG_TEMP_LSB_1 0x34
122#define BME688_REG_TEMP_MSB_1 0x33
123#define BME688_REG_PRESS_XLSB_1 0x32
124#define BME688_REG_PRESS_LSB_1 0x31
125#define BME688_REG_PRESS_MSB_1 0x30
126#define BME688_REG_SUB_MEAS_INDEX_1 0x2F
127#define BME688_REG_MEAS_STATUS_1 0x2E
128#define BME688_REG_GAS_R_LSB_0 0x2D
129#define BME688_REG_GAS_R_MSB_0 0x2C
130#define BME688_REG_HUM_LSB_0 0x26
131#define BME688_REG_HUM_MSB_0 0x25
132#define BME688_REG_TEMP_XLSB_0 0x24
133#define BME688_REG_TEMP_LSB_0 0x23
134#define BME688_REG_TEMP_MSB_0 0x22
135#define BME688_REG_PRESS_XLSB_0 0x21
136#define BME688_REG_PRESS_LSB_0 0x20
137#define BME688_REG_PRESS_MSB_0 0x1F
138#define BME688_REG_SUB_MEAS_INDEX_0 0x1E
139#define BME688_REG_MEAS_STATUS_0 0x1D
150static uint8_t a_bme688_change_spi_page(
bme688_handle_t *handle, uint8_t page)
157 if (handle->
spi_read(reg, buf, 1) != 0)
190static uint8_t a_bme688_iic_spi_read(
bme688_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
205 if (handle->
page != 0)
207 if (a_bme688_change_spi_page(handle, 0) != 0)
214 if (handle->
spi_read(reg, buf, len) != 0)
221 if (handle->
page == 0)
223 if (a_bme688_change_spi_page(handle, 1) != 0)
229 if (handle->
spi_read(reg, buf, len) != 0)
250static uint8_t a_bme688_iic_spi_write(
bme688_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
265 if (handle->
page != 0)
267 if (a_bme688_change_spi_page(handle, 0) != 0)
274 if (handle->
spi_write(reg, buf, len) != 0)
281 if (handle->
page == 0)
283 if (a_bme688_change_spi_page(handle, 1) != 0)
289 if (handle->
spi_write(reg, buf, len) != 0)
314 handle->
debug_print(
"bme688: get calibration data failed.\n");
318 handle->
par_t1 = (uint16_t)buf[1] << 8 | buf[0];
321 handle->
debug_print(
"bme688: get calibration data failed.\n");
325 handle->
par_t2 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
328 handle->
debug_print(
"bme688: get calibration data failed.\n");
332 handle->
par_t3 = (int8_t)(reg);
335 handle->
debug_print(
"bme688: get calibration data failed.\n");
339 handle->
par_p1 = (uint16_t)buf[1] <<8 | buf[0];
342 handle->
debug_print(
"bme688: get calibration data failed.\n");
346 handle->
par_p2 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
349 handle->
debug_print(
"bme688: get calibration data failed.\n");
353 handle->
par_p3 = (int8_t)(reg);
356 handle->
debug_print(
"bme688: get calibration data failed.\n");
360 handle->
par_p4 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
363 handle->
debug_print(
"bme688: get calibration data failed.\n");
367 handle->
par_p5 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
370 handle->
debug_print(
"bme688: get calibration data failed.\n");
374 handle->
par_p6 = (int8_t)(reg);
377 handle->
debug_print(
"bme688: get calibration data failed.\n");
381 handle->
par_p7 = (int8_t)(reg);
384 handle->
debug_print(
"bme688: get calibration data failed.\n");
388 handle->
par_p8 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
391 handle->
debug_print(
"bme688: get calibration data failed.\n");
395 handle->
par_p9 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
398 handle->
debug_print(
"bme688: get calibration data failed.\n");
402 handle->
par_p10 = (uint8_t)(reg);
405 handle->
debug_print(
"bme688: get calibration data failed.\n");
409 handle->
par_h1 = (uint16_t)((uint16_t)buf[1] << 4 | buf[0] & 0xF);
412 handle->
debug_print(
"bme688: get calibration data failed.\n");
416 handle->
par_h2 = (uint16_t)((uint16_t)buf[0] << 4 | ((buf[1] >> 4) & 0xF));
419 handle->
debug_print(
"bme688: get calibration data failed.\n");
423 handle->
par_h3 = (int8_t)reg;
426 handle->
debug_print(
"bme688: get calibration data failed.\n");
430 handle->
par_h4 = (int8_t)reg;
433 handle->
debug_print(
"bme688: get calibration data failed.\n");
437 handle->
par_h5 = (int8_t)reg;
440 handle->
debug_print(
"bme688: get calibration data failed.\n");
444 handle->
par_h6 = (uint8_t)reg;
447 handle->
debug_print(
"bme688: get calibration data failed.\n");
451 handle->
par_h7 = (int8_t)reg;
454 handle->
debug_print(
"bme688: get calibration data failed.\n");
461 handle->
debug_print(
"bme688: get calibration data failed.\n");
465 handle->
par_gh2 = (int16_t)((uint16_t)buf[1] << 8 | buf[0]);
468 handle->
debug_print(
"bme688: get calibration data failed.\n");
475 handle->
debug_print(
"bme688: get calibration data failed.\n");
482 handle->
debug_print(
"bme688: get calibration data failed.\n");
489 handle->
debug_print(
"bme688: get calibration data failed.\n");
510static uint8_t a_bme688_compensate_temperature(
bme688_handle_t *handle, uint32_t raw,
float *output)
515 var1 = ((((float)raw / 16384.0f) - ((float)handle->
par_t1 / 1024.0f)) * ((float)handle->
par_t2));
516 var2 = (((((float)raw / 131072.0f) - ((float)handle->
par_t1 / 8192.0f)) *
517 (((float)raw / 131072.0f) - ((float)handle->
par_t1 / 8192.0f))) * ((float)handle->
par_t3 * 16.0f));
518 handle->
t_fine = (var1 + var2);
519 *output = ((handle->
t_fine) / 5120.0f);
534static uint8_t a_bme688_compensate_pressure(
bme688_handle_t *handle, uint32_t raw,
float *output)
541 var1 = (((float)handle->
t_fine / 2.0f) - 64000.0f);
542 var2 = var1 * var1 * (((float)handle->
par_p6) / (131072.0f));
543 var2 = var2 + (var1 * ((float)handle->
par_p5) * 2.0f);
544 var2 = (var2 / 4.0f) + (((
float)handle->
par_p4) * 65536.0f);
545 var1 = (((((float)handle->
par_p3 * var1 * var1) / 16384.0f) +
546 ((float)handle->
par_p2 * var1)) / 524288.0f);
547 var1 = ((1.0f + (var1 / 32768.0f)) * ((float)handle->
par_p1));
548 calc_pres = (1048576.0f - ((float)raw));
549 if ((int32_t)var1 != 0)
551 calc_pres = (((calc_pres - (var2 / 4096.0f)) * 6250.0f) / var1);
552 var1 = (((float)handle->
par_p9) * calc_pres * calc_pres) / 2147483648.0f;
553 var2 = calc_pres * (((float)handle->
par_p8) / 32768.0f);
554 var3 = ((calc_pres / 256.0f) * (calc_pres / 256.0f) * (calc_pres / 256.0f) *
555 ((float)handle->
par_p10 / 131072.0f));
556 calc_pres = (calc_pres + (var1 + var2 + var3 + ((float)handle->
par_p7 * 128.0f)) / 16.0f);
577static uint8_t a_bme688_compensate_humidity(
bme688_handle_t *handle, uint16_t raw,
float *output)
586 temp_comp = ((handle->
t_fine) / 5120.0f);
587 var1 = (float)((
float)raw) -
588 (((float)handle->
par_h1 * 16.0f) + (((float)handle->
par_h3 / 2.0f) * temp_comp));
589 var2 = var1 * ((float)(((float)handle->
par_h2 / 262144.0f) *
590 (1.0f + (((float)handle->
par_h4 / 16384.0f) * temp_comp) +
591 (((float)handle->
par_h5 / 1048576.0f) * temp_comp * temp_comp))));
592 var3 = (float)handle->
par_h6 / 16384.0f;
593 var4 = (float)handle->
par_h7 / 2097152.0f;
594 calc_hum = var2 + ((var3 + (var4 * temp_comp)) * var2 * var2);
595 if (calc_hum > 100.0f)
599 else if (calc_hum < 0.0f)
622static uint8_t a_bme688_compensate_heat(
bme688_handle_t *handle,
float temp, uint8_t *reg)
635 var1 = (((float)handle->
par_gh1 / (16.0f)) + 49.0f);
636 var2 = ((((float)handle->
par_gh2 / (32768.0f)) * (0.0005f)) + 0.00235f);
637 var3 = ((float)handle->
par_gh3 / (1024.0f));
638 var4 = (var1 * (1.0f + (var2 * (float)temp)));
639 var5 = (var4 + (var3 * (float)handle->
amb_temp));
640 res_heat = (uint8_t)(3.4f * ((var5 * (4 / (4 + (
float)handle->
res_heat_range)) *
641 (1 / (1 + ((
float)handle->
res_heat_val * 0.002f)))) - 25));
658static uint8_t a_bme688_compensate_gas_resistance(
bme688_handle_t *handle, uint16_t gas_res_adc, uint8_t gas_range,
float *ohms)
662 uint32_t var1 = (uint32_t)262144 >> gas_range;
663 int32_t var2 = (int32_t)gas_res_adc - (int32_t)512;
665 var2 = (int32_t)4096 + var2;
666 calc_gas_res = 1000000.0f * (float)var1 / (
float)var2;
667 *ohms = calc_gas_res;
678static uint8_t a_bme688_calculate_parallel_counter(
bme688_handle_t *handle)
684 for (i = 0; i < 16; i++)
711 handle->
iic_addr = (uint8_t)addr_pin;
753 handle->
iic_spi = (uint8_t)interface;
808 handle->
debug_print(
"bme688: iic_init is null.\n");
814 handle->
debug_print(
"bme688: iic_deinit is null.\n");
820 handle->
debug_print(
"bme688: iic_read is null.\n");
826 handle->
debug_print(
"bme688: iic_write is null.\n");
832 handle->
debug_print(
"bme688: spi_init is null.\n");
838 handle->
debug_print(
"bme688: spi_deinit is null.\n");
844 handle->
debug_print(
"bme688: spi_read is null.\n");
850 handle->
debug_print(
"bme688: spi_write is null.\n");
856 handle->
debug_print(
"bme688: delay_ms is null.\n");
862 handle->
debug_print(
"bme688: receive_callback is null.\n");
884 if (a_bme688_change_spi_page(handle, 0) != 0)
886 handle->
debug_print(
"bme688: change spi page failed.\n");
892 if (a_bme688_iic_spi_read(handle,
BME688_REG_ID, (uint8_t *)&
id, 1) != 0)
907 (uint8_t *)&
id, 1) != 0)
909 handle->
debug_print(
"bme688: read variant id failed.\n");
916 handle->
debug_print(
"bme688: variant id is error.\n");
930 if (a_bme688_get_nvm_calibration(handle) != 0)
936 for (i = 0; i < 3; i++)
974 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
982 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
990 handle->
debug_print(
"bme688: iic deinit failed.\n");
999 handle->
debug_print(
"bme688: spi deinit failed.\n");
1044 handle->
debug_print(
"bme688: write idac heater failed.\n");
1084 handle->
debug_print(
"bme688: read idac heater failed.\n");
1127 handle->
debug_print(
"bme688: write resistance heater failed.\n");
1167 handle->
debug_print(
"bme688: read resistance heater failed.\n");
1210 handle->
debug_print(
"bme688: write gas wait failed.\n");
1250 handle->
debug_print(
"bme688: read gas wait failed.\n");
1285 handle->
debug_print(
"bme688: write gas wait shared failed.\n");
1319 handle->
debug_print(
"bme688: read gas wait shared failed.\n");
1389 handle->
debug_print(
"bme688: read ctrl hum failed.\n");
1394 prev |= enable << 6;
1397 handle->
debug_print(
"bme688: write ctrl hum failed.\n");
1431 handle->
debug_print(
"bme688: read ctrl hum failed.\n");
1466 handle->
debug_print(
"bme688: read ctrl hum failed.\n");
1471 prev |= oversampling << 0;
1474 handle->
debug_print(
"bme688: write ctrl hum failed.\n");
1508 handle->
debug_print(
"bme688: read ctrl hum failed.\n");
1543 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1548 prev |= oversampling << 5;
1551 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
1585 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1620 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1625 prev |= oversampling << 2;
1628 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
1662 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1697 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1705 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
1739 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
1774 handle->
debug_print(
"bme688: read config failed.\n");
1779 prev |= (filter & 0x07) << 2;
1782 handle->
debug_print(
"bme688: write config failed.\n");
1816 handle->
debug_print(
"bme688: read config failed.\n");
1851 handle->
debug_print(
"bme688: read config failed.\n");
1859 handle->
debug_print(
"bme688: write config failed.\n");
1893 handle->
debug_print(
"bme688: read config failed.\n");
1928 handle->
debug_print(
"bme688: read ctrl gas0 failed.\n");
1933 prev |= enable << 3;
1936 handle->
debug_print(
"bme688: write ctrl gas0 failed.\n");
1970 handle->
debug_print(
"bme688: read ctrl gas0 failed.\n");
2005 handle->
debug_print(
"bme688: read ctrl gas1 failed.\n");
2010 prev |= enable << 5;
2013 handle->
debug_print(
"bme688: write ctrl gas1 failed.\n");
2047 handle->
debug_print(
"bme688: read ctrl gas1 failed.\n");
2083 handle->
debug_print(
"bme688: read ctrl gas1 failed.\n");
2087 prev &= ~(0x0F << 0);
2088 prev |= (profile & 0x0F) << 0;
2091 handle->
debug_print(
"bme688: write ctrl gas1 failed.\n");
2095 for (i = 0; i < 3; i++)
2132 handle->
debug_print(
"bme688: read ctrl gas1 failed.\n");
2163 (void)a_bme688_compensate_heat(handle, degree_celsius, reg);
2190 *reg = ((uint8_t)(ma * 8) - 1) << 1;
2217 *ma = (float)(((reg >> 1) + 1) / 8);
2261 *reg = (uint8_t)(ms + (factor * 64));
2302 ms = (uint16_t)(((uint32_t)ms * 1000) / 477);
2309 *reg = (uint8_t)(ms + (factor * 64));
2354 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2356 handle->
debug_print(
"bme688: read status failed.\n");
2404 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2406 handle->
debug_print(
"bme688: read status failed.\n");
2454 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2456 handle->
debug_print(
"bme688: read status failed.\n");
2504 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2506 handle->
debug_print(
"bme688: read status failed.\n");
2510 *index = (prev & 0xF);
2554 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2556 handle->
debug_print(
"bme688: read gas lsb failed.\n");
2604 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2606 handle->
debug_print(
"bme688: read gas lsb failed.\n");
2654 if (a_bme688_iic_spi_read(handle, reg, &prev, 1) != 0)
2656 handle->
debug_print(
"bme688: get sub measurement index failed.\n");
2704 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2713 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2721 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
2725 timeout = 10 * 1000;
2726 while (timeout != 0)
2730 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2734 if ((prev & 0x03) == 0)
2764 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
2771 if ((buf[1] & (1 << 5)) == 0)
2777 if ((buf[1] & (1 << 4)) == 0)
2779 handle->
debug_print(
"bme688: heater is not stable.\n");
2783 *adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
2784 *adc_range = buf[1] & 0x0F;
2785 res = a_bme688_compensate_gas_resistance(handle, *adc_raw , *adc_range, ohms);
2788 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
2792 if (a_bme688_iic_spi_read(handle, reg_status, &prev, 1) != 0)
2794 handle->
debug_print(
"bme688: read status failed.\n");
2798 *index = (prev & 0xF);
2818 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
2825 if ((buf[1] & (1 << 5)) == 0)
2831 if ((buf[1] & (1 << 4)) == 0)
2833 handle->
debug_print(
"bme688: heater is not stable.\n");
2837 *adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
2838 *adc_range = buf[1] & 0x0F;
2839 res = a_bme688_compensate_gas_resistance(handle, *adc_raw , *adc_range, ohms);
2842 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
2846 if (a_bme688_iic_spi_read(handle, reg_status, &prev, 1) != 0)
2848 handle->
debug_print(
"bme688: read status failed.\n");
2852 *index = (prev & 0xF);
2879 uint32_t temperature_raw;
2880 float temperature_c;
2894 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2903 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2911 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
2915 timeout = 10 * 1000;
2916 while (timeout != 0)
2920 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
2924 if ((prev & 0x03) == 0)
2951 res = a_bme688_iic_spi_read(handle, reg_press, buf, 6);
2958 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
2959 (((uint32_t)(buf[4])) << 4) |
2960 ((uint32_t)buf[5] >> 4));
2961 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
2964 handle->
debug_print(
"bme688: compensate temperature failed.\n");
2968 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
2969 (((uint32_t)(buf[1])) << 4) |
2970 (((uint32_t)(buf[2])) >> 4));
2971 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
2974 handle->
debug_print(
"bme688: compensate pressure failed.\n");
2994 res = a_bme688_iic_spi_read(handle, reg_press, buf, 6);
3001 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3002 (((uint32_t)(buf[4])) << 4) |
3003 ((uint32_t)buf[5] >> 4));
3004 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
3007 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3011 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3012 (((uint32_t)(buf[1])) << 4) |
3013 (((uint32_t)(buf[2])) >> 4));
3014 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
3017 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3060 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3069 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3077 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
3081 timeout = 10 * 1000;
3082 while (timeout != 0)
3086 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3090 if ((prev & 0x03) == 0)
3117 res = a_bme688_iic_spi_read(handle, reg_press, buf, 6);
3124 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3125 (((uint32_t)(buf[4])) << 4) |
3126 ((uint32_t)buf[5] >> 4));
3127 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3130 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3150 res = a_bme688_iic_spi_read(handle, reg_press, buf, 6);
3157 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3158 (((uint32_t)(buf[4])) << 4) |
3159 ((uint32_t)buf[5] >> 4));
3160 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3163 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3193 uint32_t temperature_raw;
3194 float temperature_c;
3208 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3217 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3225 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
3229 timeout = 10 * 1000;
3230 while (timeout != 0)
3234 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3238 if ((prev & 0x03) == 0)
3265 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3272 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3273 (((uint32_t)(buf[4])) << 4) |
3274 ((uint32_t)buf[5] >> 4));
3275 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
3278 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3282 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3283 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3286 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3306 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3313 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3314 (((uint32_t)(buf[4])) << 4) |
3315 ((uint32_t)buf[5] >> 4));
3316 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
3319 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3323 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3324 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3327 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3356 uint32_t *temperature_raw,
float *temperature_c,
3357 uint32_t *pressure_raw,
float *pressure_pa,
3358 uint32_t *humidity_raw,
float *humidity_percentage)
3377 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3386 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3394 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
3398 timeout = 10 * 1000;
3399 while (timeout != 0)
3403 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3407 if ((prev & 0x03) == 0)
3434 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3441 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3442 (((uint32_t)(buf[4])) << 4) |
3443 ((uint32_t)buf[5] >> 4));
3444 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3447 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3451 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3452 (((uint32_t)(buf[1])) << 4) |
3453 (((uint32_t)(buf[2])) >> 4));
3454 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
3457 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3461 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3462 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3465 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3485 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3492 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3493 (((uint32_t)(buf[4])) << 4) |
3494 ((uint32_t)buf[5] >> 4));
3495 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3498 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3502 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3503 (((uint32_t)(buf[1])) << 4) |
3504 (((uint32_t)(buf[2])) >> 4));
3505 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
3508 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3512 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3513 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3516 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3551 uint32_t *temperature_raw,
float *temperature_c,
3552 uint32_t *pressure_raw,
float *pressure_pa,
3553 uint32_t *humidity_raw,
float *humidity_percentage,
3554 uint16_t *adc_raw, uint8_t *adc_range,
float *ohms, uint8_t *index)
3575 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3584 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3592 handle->
debug_print(
"bme688: write ctrl meas failed.\n");
3596 timeout = 10 * 1000;
3597 while (timeout != 0)
3601 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3605 if ((prev & 0x03) == 0)
3638 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3645 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3646 (((uint32_t)(buf[4])) << 4) |
3647 ((uint32_t)buf[5] >> 4));
3648 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3651 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3655 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3656 (((uint32_t)(buf[1])) << 4) |
3657 (((uint32_t)(buf[2])) >> 4));
3658 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
3661 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3665 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3666 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3669 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3674 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
3681 if ((buf[1] & (1 << 5)) == 0)
3687 if ((buf[1] & (1 << 4)) == 0)
3689 handle->
debug_print(
"bme688: heater is not stable.\n");
3693 *adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
3694 *adc_range = buf[1] & 0x0F;
3695 res = a_bme688_compensate_gas_resistance(handle, *adc_raw , *adc_range, ohms);
3698 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
3702 if (a_bme688_iic_spi_read(handle, reg_status, &prev, 1) != 0)
3704 handle->
debug_print(
"bme688: read status failed.\n");
3708 *index = (prev & 0xF);
3731 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3738 *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3739 (((uint32_t)(buf[4])) << 4) |
3740 ((uint32_t)buf[5] >> 4));
3741 res = a_bme688_compensate_temperature(handle, *temperature_raw, temperature_c);
3744 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3748 *pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3749 (((uint32_t)(buf[1])) << 4) |
3750 (((uint32_t)(buf[2])) >> 4));
3751 res = a_bme688_compensate_pressure(handle, *pressure_raw, pressure_pa);
3754 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3758 *humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3759 res = a_bme688_compensate_humidity(handle, *humidity_raw, humidity_percentage);
3762 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3767 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
3774 if ((buf[1] & (1 << 5)) == 0)
3780 if ((buf[1] & (1 << 4)) == 0)
3782 handle->
debug_print(
"bme688: heater is not stable.\n");
3786 *adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
3787 *adc_range = buf[1] & 0x0F;
3788 res = a_bme688_compensate_gas_resistance(handle, *adc_raw , *adc_range, ohms);
3791 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
3795 if (a_bme688_iic_spi_read(handle, reg_status, &prev, 1) != 0)
3797 handle->
debug_print(
"bme688: read status failed.\n");
3801 *index = (prev & 0xF);
3840 handle->
debug_print(
"bme688: read ctrl meas failed.\n");
3859 uint32_t temperature_raw;
3860 float temperature_c;
3861 uint32_t pressure_raw;
3863 uint32_t humidity_raw;
3864 float humidity_percentage;
3872 handle->
debug_print(
"bme688: read status failed.\n");
3878 handle->
debug_print(
"bme688: read status failed.\n");
3884 handle->
debug_print(
"bme688: read status failed.\n");
3890 if (((prev0 >> 7) & 0x01) != 0)
3893 index0 = prev0 & 0xF;
3896 handle->
debug_print(
"bme688: index is invalid.\n");
3906 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
3913 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
3914 (((uint32_t)(buf[4])) << 4) |
3915 ((uint32_t)buf[5] >> 4));
3916 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
3919 handle->
debug_print(
"bme688: compensate temperature failed.\n");
3923 pressure_raw = ((((uint32_t)(buf[0])) << 12) |
3924 (((uint32_t)(buf[1])) << 4) |
3925 (((uint32_t)(buf[2])) >> 4));
3926 res = a_bme688_compensate_pressure(handle, pressure_raw, &pressure_pa);
3929 handle->
debug_print(
"bme688: compensate pressure failed.\n");
3933 humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
3934 res = a_bme688_compensate_humidity(handle, humidity_raw, &humidity_percentage);
3937 handle->
debug_print(
"bme688: compensate humidity failed.\n");
3942 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
3949 adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
3950 adc_range = buf[1] & 0x0F;
3951 res = a_bme688_compensate_gas_resistance(handle, adc_raw , adc_range, &ohms);
3954 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
3958 res = a_bme688_iic_spi_read(handle, reg_sub, ®, 1);
3977 handle->
debug_print(
"bme688: sequence is lost.\n");
3989 if ((buf[1] & (1 << 5)) == 0)
3993 if ((buf[1] & (1 << 4)) == 0)
4016 if (((prev1 >> 7) & 0x01) != 0)
4019 index1 = prev1 & 0xF;
4022 handle->
debug_print(
"bme688: index is invalid.\n");
4032 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
4039 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
4040 (((uint32_t)(buf[4])) << 4) |
4041 ((uint32_t)buf[5] >> 4));
4042 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
4045 handle->
debug_print(
"bme688: compensate temperature failed.\n");
4049 pressure_raw = ((((uint32_t)(buf[0])) << 12) |
4050 (((uint32_t)(buf[1])) << 4) |
4051 (((uint32_t)(buf[2])) >> 4));
4052 res = a_bme688_compensate_pressure(handle, pressure_raw, &pressure_pa);
4055 handle->
debug_print(
"bme688: compensate pressure failed.\n");
4059 humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
4060 res = a_bme688_compensate_humidity(handle, humidity_raw, &humidity_percentage);
4063 handle->
debug_print(
"bme688: compensate humidity failed.\n");
4068 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
4075 adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
4076 adc_range = buf[1] & 0x0F;
4077 res = a_bme688_compensate_gas_resistance(handle, adc_raw , adc_range, &ohms);
4080 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
4084 res = a_bme688_iic_spi_read(handle, reg_sub, ®, 1);
4103 handle->
debug_print(
"bme688: sequence is lost.\n");
4115 if ((buf[1] & (1 << 5)) == 0)
4119 if ((buf[1] & (1 << 4)) == 0)
4142 if (((prev2 >> 7) & 0x01) != 0)
4145 index2 = prev2 & 0xF;
4148 handle->
debug_print(
"bme688: index is invalid.\n");
4158 res = a_bme688_iic_spi_read(handle, reg_press, buf, 8);
4165 temperature_raw = ((((uint32_t)(buf[3])) << 12) |
4166 (((uint32_t)(buf[4])) << 4) |
4167 ((uint32_t)buf[5] >> 4));
4168 res = a_bme688_compensate_temperature(handle, temperature_raw, &temperature_c);
4171 handle->
debug_print(
"bme688: compensate temperature failed.\n");
4175 pressure_raw = ((((uint32_t)(buf[0])) << 12) |
4176 (((uint32_t)(buf[1])) << 4) |
4177 (((uint32_t)(buf[2])) >> 4));
4178 res = a_bme688_compensate_pressure(handle, pressure_raw, &pressure_pa);
4181 handle->
debug_print(
"bme688: compensate pressure failed.\n");
4185 humidity_raw = (uint32_t)buf[6] << 8 | buf[7];
4186 res = a_bme688_compensate_humidity(handle, humidity_raw, &humidity_percentage);
4189 handle->
debug_print(
"bme688: compensate humidity failed.\n");
4194 res = a_bme688_iic_spi_read(handle, reg_gas, buf, 2);
4201 adc_raw = (((uint16_t)buf[0]) << 2) | ((buf[1] >> 6) & 0x03);
4202 adc_range = buf[1] & 0x0F;
4203 res = a_bme688_compensate_gas_resistance(handle, adc_raw , adc_range, &ohms);
4206 handle->
debug_print(
"bme688: compensate gas resistance failed.\n");
4210 res = a_bme688_iic_spi_read(handle, reg_sub, ®, 1);
4229 handle->
debug_print(
"bme688: sequence is lost.\n");
4241 if ((buf[1] & (1 << 5)) == 0)
4245 if ((buf[1] & (1 << 4)) == 0)
4285 handle->
debug_print(
"bme688: not parallel mode.\n");
4313 for (i = 0; i < 3; i++)
4354 handle->
debug_print(
"bme688: config is invalid.\n");
4360 handle->
debug_print(
"bme688: config is invalid.\n");
4366 handle->
debug_print(
"bme688: profile_len > 10.\n");
4373 (void)a_bme688_compensate_heat(handle, config->
heater_temp_prof[i], &prev);
4376 handle->
debug_print(
"bme688: write resistance heat failed.\n");
4384 handle->
debug_print(
"bme688: write gas wait failed.\n");
4400 ms = (uint16_t)(((uint32_t)ms * 1000) / 477);
4407 prev = (uint8_t)(ms + (factor * 64));
4412 handle->
debug_print(
"bme688: write gas wait shared failed.\n");
4419 handle->
debug_print(
"bme688: read ctrl gas1 failed.\n");
4423 prev &= ~(0x0F << 0);
4427 handle->
debug_print(
"bme688: write ctrl gas1 failed.\n");
4460 return a_bme688_iic_spi_write(handle, reg, buf, len);
4487 return a_bme688_iic_spi_read(handle, reg, buf, len);
#define BME688_REG_CTRL_MEAS
#define BME688_REG_NVM_PAR_H1_L
#define BME688_REG_PRESS_MSB_2
#define BME688_REG_NVM_RES_HEAT_VAL
#define BME688_REG_VARIANT_ID
#define BME688_REG_CTRL_GAS_1
#define BME688_REG_NVM_PAR_P7
#define BME688_REG_NVM_PAR_T1_L
chip register definition
#define BME688_REG_NVM_PAR_P10
#define BME688_REG_GAS_R_LSB_1
#define BME688_REG_NVM_PAR_G3
#define BME688_REG_NVM_PAR_G1
#define BME688_REG_CTRL_GAS_0
#define BME688_REG_CONFIG
#define BME688_REG_GAS_WAIT_SHARED
#define BME688_REG_GAS_R_MSB_2
#define BME688_REG_NVM_PAR_H4
#define BME688_REG_NVM_PAR_P9_L
#define BME688_REG_NVM_PAR_H3
#define BME688_REG_SUB_MEAS_INDEX_0
#define BME688_REG_NVM_PAR_G2_L
#define BME688_REG_CTRL_HUM
#define BME688_REG_NVM_RANGE_SWITCH
#define BME688_REG_NVM_PAR_P2_L
#define SUPPLY_VOLTAGE_MAX
#define BME688_REG_PRESS_MSB_1
#define BME688_REG_NVM_PAR_P4_L
#define BME688_REG_SUB_MEAS_INDEX_1
#define BME688_REG_MEAS_STATUS_1
#define BME688_REG_NVM_PAR_P6
#define BME688_REG_NVM_PAR_H6
#define BME688_REG_NVM_PAR_T2_L
#define BME688_REG_STATUS
#define BME688_REG_GAS_WAIT_X
#define BME688_REG_NVM_PAR_H2_H
#define BME688_REG_NVM_PAR_P8_L
#define BME688_REG_IDAC_HEAT_X
#define BME688_REG_GAS_R_MSB_1
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define BME688_REG_NVM_PAR_P5_L
#define BME688_REG_NVM_RES_HEAT_RANGE
#define BME688_REG_NVM_PAR_T3
#define BME688_REG_MEAS_STATUS_0
#define BME688_REG_NVM_PAR_H7
#define BME688_REG_NVM_PAR_H5
#define BME688_REG_NVM_PAR_P3
#define CHIP_NAME
chip information definition
#define BME688_REG_NVM_PAR_P1_L
#define BME688_REG_SUB_MEAS_INDEX_2
#define BME688_REG_GAS_R_LSB_0
#define BME688_REG_GAS_R_LSB_2
#define BME688_REG_PRESS_MSB_0
#define BME688_REG_MEAS_STATUS_2
#define BME688_REG_GAS_R_MSB_0
#define BME688_REG_RES_HEAT_X
driver bme688 header file
uint8_t bme688_set_filter(bme688_handle_t *handle, bme688_filter_t filter)
set filter
uint8_t bme688_get_temperature_oversampling(bme688_handle_t *handle, bme688_oversampling_t *oversampling)
get temperature oversampling
uint8_t bme688_set_interface(bme688_handle_t *handle, bme688_interface_t interface)
set the interface
uint8_t bme688_soft_reset(bme688_handle_t *handle)
soft reset
bme688_mode_t
bme688 mode enumeration definition
uint8_t bme688_get_mode(bme688_handle_t *handle, bme688_mode_t *mode)
get mode
uint8_t bme688_get_humidity_oversampling(bme688_handle_t *handle, bme688_oversampling_t *oversampling)
get humidity oversampling
bme688_address_t
bme688 address enumeration definition
uint8_t bme688_set_addr_pin(bme688_handle_t *handle, bme688_address_t addr_pin)
set the iic address pin
uint8_t bme688_read_gas_resistance(bme688_handle_t *handle, bme688_section_t section, uint16_t *adc_raw, uint8_t *adc_range, float *ohms, uint8_t *index)
read the gas resistance
uint8_t bme688_get_measuring_status(bme688_handle_t *handle, bme688_section_t section, bme688_bool_t *enable)
get measuring status
uint8_t bme688_get_spi_wire_3_data_interrupt(bme688_handle_t *handle, bme688_bool_t *enable)
get spi wire3 data interrupt status
uint8_t bme688_gas_wait_shared_convert_to_register(bme688_handle_t *handle, float m, uint8_t *reg)
convert the gas wait shared to the register raw data
uint8_t bme688_set_heater_profile(bme688_handle_t *handle, bme688_heater_profile_t profile)
set heater profile
uint8_t bme688_get_run_gas(bme688_handle_t *handle, bme688_bool_t *enable)
get run gas status
uint8_t bme688_get_resistance_heater(bme688_handle_t *handle, uint8_t index, uint8_t *reg)
get resistance heater
uint8_t bme688_read_temperature_pressure_humidity(bme688_handle_t *handle, bme688_section_t section, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa, uint32_t *humidity_raw, float *humidity_percentage)
read the temperature pressure and humidity data
uint8_t bme688_read(bme688_handle_t *handle, bme688_section_t section, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa, uint32_t *humidity_raw, float *humidity_percentage, uint16_t *adc_raw, uint8_t *adc_range, float *ohms, uint8_t *index)
read the temperature pressure humidity and gas resistance
bme688_heater_profile_t
bme688 heater profile enumeration definition
uint8_t bme688_idac_heater_convert_to_register(bme688_handle_t *handle, float ma, uint8_t *reg)
convert the idac heater to the register raw data
uint8_t bme688_get_gas_measuring_status(bme688_handle_t *handle, bme688_section_t section, bme688_bool_t *enable)
get gas measuring status
uint8_t bme688_set_temperature_oversampling(bme688_handle_t *handle, bme688_oversampling_t oversampling)
set temperature oversampling
uint8_t bme688_set_mode(bme688_handle_t *handle, bme688_mode_t mode)
set mode
uint8_t bme688_get_heater_stability_status(bme688_handle_t *handle, bme688_section_t section, bme688_bool_t *enable)
get heater stability status
uint8_t bme688_parallel_config(bme688_handle_t *handle, bme688_parallel_config_t *config)
parallel config
uint8_t bme688_set_run_gas(bme688_handle_t *handle, bme688_bool_t enable)
enable or disable run gas
uint8_t bme688_get_gas_valid_status(bme688_handle_t *handle, bme688_section_t section, bme688_bool_t *enable)
get gas valid status
uint8_t bme688_get_gas_measuring_index(bme688_handle_t *handle, bme688_section_t section, uint8_t *index)
get gas measuring index
uint8_t bme688_get_heater_off(bme688_handle_t *handle, bme688_bool_t *enable)
get heater off status
uint8_t bme688_set_spi_wire(bme688_handle_t *handle, bme688_spi_wire_t spi)
set spi wire
uint8_t bme688_get_filter(bme688_handle_t *handle, bme688_filter_t *filter)
get filter
uint8_t bme688_get_heater_profile(bme688_handle_t *handle, bme688_heater_profile_t *profile)
get heater profile
uint8_t bme688_set_idac_heater(bme688_handle_t *handle, uint8_t index, uint8_t reg)
set idac heater
bme688_filter_t
bme688 filter enumeration definition
uint8_t bme688_init(bme688_handle_t *handle)
initialize the chip
uint8_t bme688_info(bme688_info_t *info)
get chip's information
uint8_t bme688_get_idac_heater(bme688_handle_t *handle, uint8_t index, uint8_t *reg)
get idac heater
uint8_t bme688_get_interface(bme688_handle_t *handle, bme688_interface_t *interface)
get the interface
uint8_t bme688_read_temperature(bme688_handle_t *handle, bme688_section_t section, uint32_t *temperature_raw, float *temperature_c)
read the temperature data
uint8_t bme688_set_spi_wire_3_data_interrupt(bme688_handle_t *handle, bme688_bool_t enable)
enable or disable spi wire3 data interrupt
uint8_t bme688_gas_wait_convert_to_register(bme688_handle_t *handle, uint16_t ms, uint8_t *reg)
convert the gas wait to the register raw data
struct bme688_info_s bme688_info_t
bme688 information structure definition
uint8_t bme688_set_gas_wait(bme688_handle_t *handle, uint8_t index, uint8_t reg)
set gas wait
uint8_t bme688_resistance_heater_convert_to_register(bme688_handle_t *handle, float degree_celsius, uint8_t *reg)
convert the resistance heater to the register raw data
uint8_t bme688_get_gas_wait_shared(bme688_handle_t *handle, uint8_t *reg)
get gas wait shared
uint8_t bme688_deinit(bme688_handle_t *handle)
close the chip
uint8_t bme688_set_resistance_heater(bme688_handle_t *handle, uint8_t index, uint8_t reg)
set resistance heater
uint8_t bme688_get_new_data_status(bme688_handle_t *handle, bme688_section_t section, bme688_bool_t *enable)
get new data status
bme688_section_t
bme688 section enumeration definition
uint8_t bme688_get_gas_wait(bme688_handle_t *handle, uint8_t index, uint8_t *reg)
get gas wait
uint8_t bme688_idac_heater_convert_to_data(bme688_handle_t *handle, uint8_t reg, float *ma)
convert the register raw data to idac heater
uint8_t bme688_read_humidity(bme688_handle_t *handle, bme688_section_t section, uint32_t *humidity_raw, float *humidity_percentage)
read the humidity data
uint8_t bme688_get_addr_pin(bme688_handle_t *handle, bme688_address_t *addr_pin)
get the iic address pin
uint8_t bme688_read_pressure(bme688_handle_t *handle, bme688_section_t section, uint32_t *pressure_raw, float *pressure_pa)
read the pressure data
uint8_t bme688_set_heater_off(bme688_handle_t *handle, bme688_bool_t enable)
enable or disable heater off
bme688_bool_t
bme688 bool enumeration definition
uint8_t bme688_parallel_progress(bme688_handle_t *handle)
parallel progress
uint8_t bme688_parallel_reset(bme688_handle_t *handle)
parallel reset
uint8_t bme688_get_pressure_oversampling(bme688_handle_t *handle, bme688_oversampling_t *oversampling)
get pressure oversampling
bme688_interface_t
bme688 interface enumeration definition
bme688_oversampling_t
bme688 oversampling enumeration definition
uint8_t bme688_set_gas_wait_shared(bme688_handle_t *handle, uint8_t reg)
set gas wait shared
uint8_t bme688_set_humidity_oversampling(bme688_handle_t *handle, bme688_oversampling_t oversampling)
set humidity oversampling
uint8_t bme688_set_pressure_oversampling(bme688_handle_t *handle, bme688_oversampling_t oversampling)
set pressure oversampling
struct bme688_parallel_config_s bme688_parallel_config_t
bme688 parallel config structure definition
uint8_t bme688_get_sub_measurement_index(bme688_handle_t *handle, bme688_section_t section, uint8_t *ind)
get sub measurement index
bme688_spi_wire_t
bme688 spi wire enumeration definition
uint8_t bme688_get_spi_wire(bme688_handle_t *handle, bme688_spi_wire_t *spi)
get spi wire
struct bme688_handle_s bme688_handle_t
bme688 handle structure definition
@ BME688_STATUS_CHANNEL_DATA
@ BME688_STATUS_SEQUENCE_LOST
uint8_t bme688_get_reg(bme688_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t bme688_set_reg(bme688_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
uint8_t parallel_sequence_trigger[3]
uint8_t(* spi_init)(void)
void(* receive_callback)(uint8_t status, bme688_parallel_data_t *data, uint8_t len)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
bme688_parallel_data_t parallel_data[10]
uint8_t parallel_data_len
void(* debug_print)(const char *const fmt,...)
uint8_t parallel_sequence_number[3]
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint16_t parallel_data_flag
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v
const float * heater_temp_prof
const uint8_t * heater_dur_prof
float humidity_percentage