The subject tells the story, when reading the Temp and Pressure values of the BME 680 i get 0 and humditiy is some wild number. This makes me think it has to do with how i call the user read and user write functions but how i approch it seems to fall in line with how other people do so. I am connecting to the sensor with a STM32 and i will include my code below. If you have any insight in what i could be doing wrong that would be most appreciated. struct bme680_dev bme;
uint8_t GTXBuffer[256];
int8_t user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len) {
uint16_t DevAddress = dev_id << 1;
HAL_I2C_Master_Transmit(&hi2c1, DevAddress, ®_addr, 1, 10000);
HAL_I2C_Master_Receive(&hi2c1, DevAddress, reg_data, len, 10000);
return 0;
}
int8_t user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len) {
uint16_t DevAddress = dev_id << 1;
GTXBuffer[0] = reg_addr;
memcpy(>XBuffer[1], reg_data, len);
HAL_I2C_Master_Transmit(&hi2c1, DevAddress, GTXBuffer, len+1, 10000);
return 0;
}
void user_delay_ms(uint32_t period)
{
HAL_Delay(period);
}
bme.dev_id = 0x76;
bme.intf = BME680_I2C_INTF;
bme.read = &user_i2c_read;
bme.write = &user_i2c_write;
bme.delay_ms = user_delay_ms;
bme.amb_temp = 25; from here on out i follow the example from the older github repository.
... View more