float FDC1004::getGainCalibration()

in FDC1004.cpp [365:376]


float FDC1004::getGainCalibration(uint8_t sensor)
{
  //2 bits [15:14] are integer portion (in 2's complement????)
  //14 bits [13:0] are fractional portion (in 2's complement????)
  //0 to 4
  uint16_t rawgain = readRegister16(FDC1004_GAIN_CAL_CIN1+(sensor-1));

  //convert from fixed point to double
  float gain = (float) rawgain / pow(2,14);
  //float gain = (rawgain >> 14);
  return gain;
}