control/fem_api_extension/api/src/ExcaliburFemClientPowerCardDevices.cpp
u16 ExcaliburFemClient::powerCardAD7998Read(unsigned int aDevice, unsigned int aChan)
{

  // Calculate address pointer to send to ADC
  u8 addrPtr = 0x80 | (aChan << 4);

  // Send channel select command to ADC
  std::vector<u8> cmd(2);
  cmd[0] = 0;
  cmd[1] = addrPtr;

  this->i2cWrite(kPwrCardAD7998Address[aDevice], cmd);

  // Wait 100ms
  struct timespec sleep;
  sleep.tv_sec = 0;
  sleep.tv_nsec = 100000000;
  nanosleep(&sleep, NULL);

  // Read two bytes back
  std::vector<u8> response = this->i2cRead(kPwrCardAD7998Address[aDevice], 2);

  // Decode ADC value to return
  u16 adcVal = ((((u16) response[0]) << 8) | response[1]) & 0xFFF;

  return adcVal;
}
/** powerCardAD7998Read - low level read access to AD7998 ADC devices
 *
 * Performs a low-level read command on the power card AD7998 ADC devices. The
 * required channel is selected, a read command is sent, and the converted value
 * read back from the device. This is decoded from the returned bytes and returned
 * as an ADC value
 *
 * @param aDevice which AD7994 device to read from
 * @param aChan which ADC channel to read
 * @return adcVal u16 ADC conversion value on that channel
 */
low level read access to AD7998 ADC devices
Performs a low-level read command on the power card AD7998 ADC devices. The
required channel is selected, a read command is sent, and the converted value
read back from the device. This is decoded from the returned bytes and returned
as an ADC value

@param aDevice which AD7994 device to read from
@param aChan which ADC channel to read
@return adcVal u16 ADC conversion value on that channel
low level read access to AD7998 ADC devices Performs a low - level read command on the power card AD7998 ADC devices . The required channel is selected a read command is sent and the converted value read back from the device . This is decoded from the returned bytes and returned as an ADC value @param aDevice which AD7994 device to read from @param aChan which ADC channel to read @return adcVal u16 ADC conversion value on that channel
u16 ExcaliburFemClient::powerCardAD7998Read(unsigned int aDevice, unsigned int aChan)
{
  u8 addrPtr = 0x80 | (aChan << 4);
  std::vector<u8> cmd(2);
  cmd[0] = 0;
  cmd[1] = addrPtr;
  this->i2cWrite(kPwrCardAD7998Address[aDevice], cmd);
  struct timespec sleep;
  sleep.tv_sec = 0;
  sleep.tv_nsec = 100000000;
  nanosleep(&sleep, NULL);
  std::vector<u8> response = this->i2cRead(kPwrCardAD7998Address[aDevice], 2);
  u16 adcVal = ((((u16) response[0]) << 8) | response[1]) & 0xFFF;
  return adcVal;
}
u16 ExcaliburFemClient :: powerCardAD7998Read ( unsigned int aDevice , unsigned int aChan ) { u8 addrPtr = 0x80 | ( aChan << 4 ) ; std :: vector < u8 > cmd ( 2 ) ; cmd [ 0 ] = 0 ; cmd [ 1 ] = addrPtr ; this -> i2cWrite ( kPwrCardAD7998Address [ aDevice ] , cmd ) ; struct timespec sleep ; sleep . tv_sec = 0 ; sleep . tv_nsec = 100000000 ; nanosleep ( & sleep , NULL ) ; std :: vector < u8 > response = this -> i2cRead ( kPwrCardAD7998Address [ aDevice ] , 2 ) ; u16 adcVal = ( ( ( ( u16 ) response [ 0 ] ) << 8 ) | response [ 1 ] ) & 0xFFF ; return adcVal ; }
powerCardAD7998Read - low level read access to AD7998 ADC devices
 Performs a low-level read command on the power card AD7998 ADC devices.
powerCardAD7998Read - low level read access to AD7998 ADC devices Performs a low - level read command on the power card AD7998 ADC devices .
// Calculate address pointer to send to ADC // Send channel select command to ADC // Wait 100ms // Read two bytes back // Decode ADC value to return