コード例 #1
0
ファイル: ImuComponent.cs プロジェクト: beaglebot/BeagleBot
 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));
 }