Hi john-rubis,
We couldn't see the line "temp_raw_scaled = (int32_t)data[BMA4_TEMP_BYTE] * BMA4_SCALE_TEMP;" in driver code.
Which degree Fahrenheit or degree Kelvin you used?
/*! * @brief This API reads the chip temperature of sensor. * * @note Using a scaling factor of 1000, to obtain integer values, which * at the user end, are used to get accurate temperature value . * BMA4_FAHREN_SCALED = 1.8 * 1000, BMA4_KELVIN_SCALED = 273.15 * 1000 */ int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *dev) { int8_t rslt; uint8_t data[BMA4_TEMP_DATA_SIZE] = { 0 }; int32_t temp_raw_scaled = 0;
/* Check the dev structure as NULL */ rslt = null_pointer_check(dev);
if ((rslt == BMA4_OK) && (temp != NULL)) { /* Read temperature value from the register */ rslt = bma4_read_regs(BMA4_TEMPERATURE_ADDR, data, BMA4_TEMP_DATA_SIZE, dev); if (rslt == BMA4_OK) { temp_raw_scaled = (int32_t)data[BMA4_TEMP_BYTE] * BMA4_SCALE_TEMP; }
/* '0' value read from the register corresponds to 23 degree C */ (*temp) = temp_raw_scaled + (BMA4_OFFSET_TEMP * BMA4_SCALE_TEMP); switch (temp_unit) { case BMA4_DEG: break; case BMA4_FAHREN:
/* Temperature in degree Fahrenheit */ (*temp) = (((*temp) / BMA4_SCALE_TEMP) * BMA4_FAHREN_SCALED) + (32 * BMA4_SCALE_TEMP); break; case BMA4_KELVIN:
/* Temperature in degree Kelvin */ (*temp) = (*temp) + BMA4_KELVIN_SCALED; break; default: break; } } else { rslt = BMA4_E_NULL_PTR; }
return rslt; }
... View more