12-04-2020 07:34 PM
Hello im just wondering if anyone can explain how the I2C functions (read/write) need to be set up for the BME680 sensor and possible any examples? i am using the raspberry pi 4b and just trying to read the sensors values and print them to the screen then save the outcomes in a text file
Solved! Go to Solution.
12-06-2020 04:49 PM
Hello Callum42069,
There was example code in github for BME680, https://github.com/BoschSensortec/BME68x-Sensor-API/blob/master/examples/common/common.c
For I2C read/write function, you need to implement the following functions in bold. There functions were general I2C reading, writing.
BME68X_INTF_RET_TYPE bme68x_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
{
uint8_t dev_addr = *(uint8_t*)intf_ptr;
return coines_read_i2c(dev_addr, reg_addr, reg_data, (uint16_t)len);
}
BME68X_INTF_RET_TYPE bme68x_i2c_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
{
uint8_t dev_addr = *(uint8_t*)intf_ptr;
return coines_write_i2c(dev_addr, reg_addr, (uint8_t *)reg_data, (uint16_t)len);
}
12-06-2020 07:48 PM
Is ther any way to do this without the use of coines ? and so just implementing them functions will allow for I2c data transfer?
12-07-2020 03:44 AM
Hello Callum42069,
BME680 sensor API was portable. For different HW paltform, just need to replace coines_read_i2c, coines_write_i2c function.
12-07-2020 08:08 PM
Ok so for the raspberry pi for example i would just put pi read/write? and then the address of the sensor?