Пример #1
0
 public override bool CheckIfPossibleToConnect()
 {
     if (I2CBus.State != BusState.Connected)
     {
         return(false);
     }
     try { I2CBus.Get(CompassI2CAddress, 0); }
     catch (I2CException) { return(false); }
     return(true);
 }
Пример #2
0
 /// <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));
 }
Пример #3
0
 /// <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));
 }