void StartBME68XTask(void const * argument) { return_values_init ret; struct bme68x_dev bme_dev; memset(&bme_dev,0,sizeof(bme_dev)); /* Call to the function which initializes the BSEC library * Switch on low-power mode and provide no temperature offset */ #if defined(BME68X_OUTPUT_GAS_ESTIMATE) #if defined(USE_I2C_INTERFACE) ret = bsec_iot_init(BSEC_SAMPLE_RATE_SCAN, 0.0f, SensorAPI_I2Cx_Write, SensorAPI_I2Cx_Read, bst_delay_us, state_load, config_load, bme_dev); #elif defined(USE_SPI_INTERFACE) ret = bsec_iot_init(BSEC_SAMPLE_RATE_SCAN, 0.0f, SensorAPI_SPIx_Write, SensorAPI_SPIx_Read, bst_delay_us, state_load, config_load, bme_dev); #endif #elif defined(BME68X_OUTPUT_GAS_IAQ) #if defined(USE_I2C_INTERFACE) ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, SensorAPI_I2Cx_Write, SensorAPI_I2Cx_Read, bst_delay_us, state_load, config_load, bme_dev); #elif defined(USE_SPI_INTERFACE) ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, bus_write, bus_read, sleep_n, state_load, config_load, bme_dev); #endif #endif if (ret.bme68x_status) { /* Could not intialize BME68x */ printf("Could not intialize BME68x,ret.bme68x_status=%d\r\n", ret.bme68x_status); while(1); } else if (ret.bsec_status) { /* Could not intialize BSEC library */ printf("Could not intialize BSEC library,ret.bsec_status=%d\r\n", ret.bsec_status); while(1); } #if defined(BME68X_OUTPUT_GAS_ESTIMATE) /* Call to endless loop function which reads and processes data based on sensor settings */ /* State is saved every 10.000 samples, which means every 10.000 * 3 secs = 500 minutes */ bsec_iot_loop(bst_delay_us, get_timestamp_us, output_ready, state_save, 10000); #elif defined(BME68X_OUTPUT_GAS_IAQ) bsec_iot_loop(sleep_n, get_timestamp_us, output_iaq_ready, state_save, 10000); #endif }
... View more