API Reference¶
-
group
group_board_libs
Basic set of APIs for interacting with the BME680 atmospheric sensor.
This provides basic initialization and access to to the basic accelerometer & gyroscope data. It also provides access to the base BME680 driver for full control. For more information about the motion sensor, see: https://github.com/BoschSensortec/BME680_driver.git
note
Currently, this library only supports being used for a single instance of this device.
note
BME680 support requires delays. If the RTOS_AWARE component is set or CY_RTOS_AWARE is defined, the HAL driver will defer to the RTOS for delays. Because of this, it is not safe to call any functions other than mtb_bme680_init_i2c or mtb_bme680_init_spi until after the RTOS scheduler has started.
Enums
Functions
-
cy_rslt_t
mtb_bme680_init_i2c
(mtb_bme680_t *obj, cyhal_i2c_t *inst, mtb_bme680_address_t address)¶ Initialize the atmospheric sensor for I2C communication.
Then applies the default configuration settings for both the accelerometer & gyroscope. Known maximum I2C frequency of 3.4MHz; refer to manufacturer’s datasheet for confirmation. See: mtb_bme680_config_default()
- Parameters
obj – [in] Pointer to a BME680 object. The caller must allocate the memory for this object but the init function will initialize its contents.
inst – [in] I2C instance to use for communicating with the BME680 sensor.
address – [in] BME680 I2C address, set by hardware implemntation.
- Returns
CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
-
cy_rslt_t
mtb_bme680_init_spi
(mtb_bme680_t *obj, cyhal_spi_t *inst, cyhal_gpio_t pin)¶ Initialize the atmospheric sensor for SPI communication.
Then applies the default configuration settings for both the accelerometer & gyroscope. See: mtb_bme680_config_default()
- Parameters
obj – [in] Pointer to a BME680 object. The caller must allocate the memory for this object but the init function will initialize its contents.
inst – [in] I2C instance to use for communicating with the BME680 sensor.
pin – [in] GPIO pin connected to BME680 Chip Select.
- Returns
CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
-
cy_rslt_t
mtb_bme680_config_default
(mtb_bme680_t *obj)¶ Configure the motion sensor to a default mode with both accelerometer & gyroscope enabled with a nominal output data rate.
- Parameters
obj – [in] Pointer to a BME680 object.
- Returns
CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
-
cy_rslt_t
mtb_bme680_read
(mtb_bme680_t *obj, mtb_bme680_data_t *sensor_data)¶ Reads the current accelerometer & gyroscope data from the motion sensor.
- Parameters
obj – [in] Pointer to a BME680 object.
sensor_data – [out] The accelerometer & gyroscope data read from the motion sensor
- Returns
CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
-
struct bme680_dev *
mtb_bme680_get
(mtb_bme680_t *obj)¶ Gets access to the base motion sensor data.
This allows for direct manipulation of the sensor for any desired behavior. See https://github.com/BoschSensortec/BME680_driver for more details on the sensor.
- Parameters
obj – [in] Pointer to a BME680 object.
- Returns
pointer to the BME680 configuration structure.
-
void
mtb_bme680_free
(mtb_bme680_t *obj)¶ Frees up any resources allocated by the motion_sensor as part of mtb_bme680_init_i2c or mtb_bme680_init_spi.
- Parameters
obj – [in] Pointer to a BME680 object.
-
struct
mtb_bme680_t
¶ - #include <>
Structure holding the IMU instance specific information.
-
struct
mtb_bme680_data_t
¶ - #include <>
Structure holding the atmospheric data read from the device.
-
cy_rslt_t