lib/Seeed_Arduino_AS5600/AS5600.cpp
/*******************************************************
  Method: readTwoBytes
  In: two registers to read
  Out: data read from i2c as a word
  Description: reads two bytes register from i2c
*******************************************************/
readTwoBytes
In: two registers to read
Out: data read from i2c as a word
Description: reads two bytes register from i2c
readTwoBytes In : two registers to read Out : data read from i2c as a word Description : reads two bytes register from i2c
word AMS_5600::readTwoBytes(int in_adr_hi, int in_adr_lo)
{
  word retVal = -1;
  Wire.beginTransmission(_ams5600_Address);
  Wire.write(in_adr_lo);
  Wire.endTransmission();
  Wire.requestFrom(_ams5600_Address, 1);
  while (Wire.available() == 0)
    ;
  int low = Wire.read();
  Wire.beginTransmission(_ams5600_Address);
  Wire.write(in_adr_hi);
  Wire.endTransmission();
  Wire.requestFrom(_ams5600_Address, 1);
  while (Wire.available() == 0)
    ;
  word high = Wire.read();
  high = high << 8;
  retVal = high | low;
  return retVal;
}
word AMS_5600 :: readTwoBytes ( int in_adr_hi , int in_adr_lo ) { word retVal = -1 ; Wire . beginTransmission ( _ams5600_Address ) ; Wire . write ( in_adr_lo ) ; Wire . endTransmission ( ) ; Wire . requestFrom ( _ams5600_Address , 1 ) ; while ( Wire . available ( ) == 0 ) ; int low = Wire . read ( ) ; Wire . beginTransmission ( _ams5600_Address ) ; Wire . write ( in_adr_hi ) ; Wire . endTransmission ( ) ; Wire . requestFrom ( _ams5600_Address , 1 ) ; while ( Wire . available ( ) == 0 ) ; word high = Wire . read ( ) ; high = high << 8 ; retVal = high | low ; return retVal ; }
Method: readTwoBytes
In: two registers to read
Out: data read from i2c as a word
Description: reads two bytes register from i2c
Method : readTwoBytes In : two registers to read Out : data read from i2c as a word Description : reads two bytes register from i2c
/* Read Low Byte */ /* Read High Byte */