/* Reads relative humidity and temperature from a Si7013 sensor.  */
int32_t Si7013_MeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr, uint32_t *rhData, int32_t *tData)
/* Reads relative humidity and temperature from a Si7013 sensor.  */
int32_t Si7013_MeasureRHAndTemp(I2C_TypeDef *i2c, uint8_t addr, uint32_t *rhData, int32_t *tData)
{
  int ret = Si7013_Measure(i2c, addr, rhData, SI7013_READ_RH);
  if (ret == 2)
  {
    *rhData = (((*rhData) * 15625L) >> 13) - 6000;
  }
  else
  {
    return -1;
  }
  ret = Si7013_Measure(i2c, addr, (uint32_t *) tData, SI7013_READ_TEMP);
  if (ret == 2)
  {
    *tData = (((*tData) * 21965L) >> 13) - 46850;
  }
  else
  {
    return -1;
  }
  return 0;
}