public static byte GetBits(this I2CDevice device, I2CDevice.Configuration config, int timeout, byte register, byte bitStart, byte length) { byte result; if (device.TryGetBits(config, timeout, register, bitStart, length, out result)) { return(result); } else { throw new Exception(); } }