public override bool CheckIfPossibleToConnect() { if (I2CBus.State != BusState.Connected) { return(false); } try { I2CBus.Get(CompassI2CAddress, 0); } catch (I2CException) { return(false); } return(true); }
/// <summary> /// Returns the values of multiple sequential I2C registers, or throws an I2CException. /// </summary> /// <param name="register"></param> /// <param name="numRegisters"></param> /// <returns></returns> protected byte[] GetI2CRegisters(byte register, int numRegisters) { return(I2CBus.Get(I2CAddress, register, numRegisters)); }
/// <summary> /// Returns the value in the I2C register, or throws an I2CException. /// </summary> /// <param name="register"></param> /// <returns></returns> protected byte GetI2CRegister(byte register) { return(I2CBus.Get(I2CAddress, register)); }