|
Data Structures | |
| struct | dev_bme680_data_t |
| BME680 measurement values. More... | |
| struct | dev_bme680_config_t |
| BME680 runtime configuration. More... | |
Macros | |
| #define | DEV_BME680_I2C_ADDR_PRIMARY 0x76 |
| 7-bit I2C address when the SDO pin is tied low. | |
| #define | DEV_BME680_I2C_ADDR_SECONDARY 0x77 |
| 7-bit I2C address when the SDO pin is tied high. | |
| #define | DEV_BME680_CHIP_ID 0x61 |
| Expected value of the chip ID register, used by dev_bme680_init() to confirm a BME680 is actually present before returning a handle. | |
| #define | DEV_BME680_REG_CHIP_ID 0xD0u |
| Register holding the chip ID (see DEV_BME680_CHIP_ID). | |
| #define | DEV_BME680_REG_VARIANT_ID 0xF0u |
| Register holding the chip variant (see DEV_BME680_VARIANT_GAS_LOW, DEV_BME680_VARIANT_GAS_HIGH). | |
| #define | DEV_BME680_REG_SOFT_RESET 0xE0u |
| Register that triggers a soft reset when DEV_BME680_SOFT_RESET_CMD is written to it. | |
| #define | DEV_BME680_REG_FIELD0 0x1Du |
| First register of the sensor data field read by dev_bme680_read(). | |
| #define | DEV_BME680_REG_RES_HEAT0 0x5Au |
| First heater resistance register, for the gas heater profile. | |
| #define | DEV_BME680_REG_GAS_WAIT0 0x64u |
| First heater duration register, for the gas heater profile. | |
| #define | DEV_BME680_REG_CTRL_GAS_0 0x70u |
| Gas heater control register. | |
| #define | DEV_BME680_REG_CTRL_GAS_1 0x71u |
| Gas measurement/heater-profile-selection control register. | |
| #define | DEV_BME680_REG_CTRL_HUM 0x72u |
| Humidity oversampling control register. | |
| #define | DEV_BME680_REG_CTRL_MEAS 0x74u |
| Temperature/pressure oversampling and power-mode control register. | |
| #define | DEV_BME680_REG_CONFIG 0x75u |
| IIR filter control register. | |
| #define | DEV_BME680_REG_COEFF1 0x8Au |
| First byte of the first calibration coefficient block. | |
| #define | DEV_BME680_REG_COEFF2 0xE1u |
| First byte of the second calibration coefficient block. | |
| #define | DEV_BME680_REG_COEFF3 0x00u |
| First byte of the third calibration coefficient block. | |
| #define | DEV_BME680_SOFT_RESET_CMD 0xB6u |
| Value that triggers a soft reset when written to DEV_BME680_REG_SOFT_RESET. | |
| #define | DEV_BME680_VARIANT_GAS_LOW 0x00u |
| Chip variant value read from DEV_BME680_REG_VARIANT_ID on earlier BME680 units, using the "low" gas resistance compensation formula. | |
| #define | DEV_BME680_VARIANT_GAS_HIGH 0x01u |
| Chip variant value read from DEV_BME680_REG_VARIANT_ID on later BME680 units, using the "high" gas resistance compensation formula. | |
Typedefs | |
| typedef struct dev_bme680_t | dev_bme680_t |
| Opaque BME680 handle. | |
Lifecycle | |
| void | dev_bme680_default_config (dev_bme680_config_t *config) |
| Fill a BME680 config struct with safe defaults. More... | |
| dev_bme680_t * | dev_bme680_init (hw_deviceio_t *device, const dev_bme680_config_t *config) |
| Initialize a BME680 sensor. More... | |
| void | dev_bme680_deinit (dev_bme680_t *bme680) |
| Deinitialize a BME680 sensor. More... | |
Properties | |
| uint8_t | dev_bme680_chip_id (const dev_bme680_t *bme680) |
| Get the detected chip ID. More... | |
| uint32_t | dev_bme680_measurement_duration_ms (const dev_bme680_config_t *config) |
| Calculate how long a measurement takes to complete for a given configuration. More... | |
Methods | |
| bool | dev_bme680_read (dev_bme680_t *bme680, dev_bme680_data_t *data) |
| Read sensor data from BME680. More... | |
| uint8_t dev_bme680_chip_id | ( | const dev_bme680_t * | bme680 | ) |
Get the detected chip ID.
| bme680 | BME680 handle. |
| void dev_bme680_default_config | ( | dev_bme680_config_t * | config | ) |
Fill a BME680 config struct with safe defaults.
| config | Config structure to initialize. |
| void dev_bme680_deinit | ( | dev_bme680_t * | bme680 | ) |
Deinitialize a BME680 sensor.
| bme680 | BME680 handle. |
Releases bme680 itself only - the hw_deviceio_t it was initialized with is left open, since dev_bme680_init() doesn't take ownership of it.
| dev_bme680_t* dev_bme680_init | ( | hw_deviceio_t * | device, |
| const dev_bme680_config_t * | config | ||
| ) |
Initialize a BME680 sensor.
| device | Device I/O handle to communicate over, from hw_i2c_init*() or hw_spi_init*() (see hw/i2c.h, hw/spi.h). |
| config | Optional configuration. Pass NULL for defaults. |
| uint32_t dev_bme680_measurement_duration_ms | ( | const dev_bme680_config_t * | config | ) |
Calculate how long a measurement takes to complete for a given configuration.
| config | Configuration to calculate for. Pass NULL to use defaults. |
Oversampling settings determine the temperature/pressure/humidity conversion time; when config->gas_mode is dev_bme680_gas_enabled, config->heater_duration_ms is added on top, since the gas heater and the TPH conversion don't run concurrently. dev_bme680_read() already accounts for this internally when polling for a result - this is for a caller that wants to know the figure itself (e.g. to pick a sensible polling interval elsewhere).
| bool dev_bme680_read | ( | dev_bme680_t * | bme680, |
| dev_bme680_data_t * | data | ||
| ) |
Read sensor data from BME680.
| bme680 | BME680 handle. |
| data | Structure to receive sensor values. |
| true | Read succeeded. |
| false | Read failed. |