Feather_Holiday_Lights/Feather_32u4_Lights/Adafruit_VCNL4000.cpp
uint16_t Adafruit_VCNL4000::read16(uint8_t address)
{
  uint16_t data;

  Wire.beginTransmission(VCNL4000_ADDRESS);
#if ARDUINO >= 100
  Wire.write(address);
#else
  Wire.send(address);
#endif
  Wire.endTransmission();

  Wire.requestFrom(VCNL4000_ADDRESS, 2);
  while(!Wire.available());
#if ARDUINO >= 100
  data = Wire.read();
  data <<= 8;
  while(!Wire.available());
  data |= Wire.read();
#else
  data = Wire.receive();
  data <<= 8;
  while(!Wire.available());
  data |= Wire.receive();
#endif
  
  return data;
}
// Read 2 byte from the VCNL4000 at 'address'
Read 2 byte from the VCNL4000 at 'address'
Read 2 byte from the VCNL4000 at ' address '
uint16_t Adafruit_VCNL4000::read16(uint8_t address)
{
  uint16_t data;
  Wire.beginTransmission(VCNL4000_ADDRESS);
#if ARDUINO >= 100
  Wire.write(address);
#else
  Wire.send(address);
#endif
  Wire.endTransmission();
  Wire.requestFrom(VCNL4000_ADDRESS, 2);
  while(!Wire.available());
#if ARDUINO >= 100
  data = Wire.read();
  data <<= 8;
  while(!Wire.available());
  data |= Wire.read();
#else
  data = Wire.receive();
  data <<= 8;
  while(!Wire.available());
  data |= Wire.receive();
#endif
  return data;
}
uint16_t Adafruit_VCNL4000 :: read16 ( uint8_t address ) { uint16_t data ; Wire . beginTransmission ( VCNL4000_ADDRESS ) ; #if ARDUINO >= 100 Wire . write ( address ) ; #else Wire . send ( address ) ; #endif Wire . endTransmission ( ) ; Wire . requestFrom ( VCNL4000_ADDRESS , 2 ) ; while ( ! Wire . available ( ) ) ; #if ARDUINO >= 100 data = Wire . read ( ) ; data <<= 8 ; while ( ! Wire . available ( ) ) ; data |= Wire . read ( ) ; #else data = Wire . receive ( ) ; data <<= 8 ; while ( ! Wire . available ( ) ) ; data |= Wire . receive ( ) ; #endif return data ; }
Read 2 byte from the VCNL4000 at 'address'
Read 2 byte from the VCNL4000 at ' address '