I2C Timeout

Hello,
Is there a way to customize the timeout for an I2C write/read? If not, could there be? Seems like it’s 1s right now which feels like a long time.
We have an application where it’s possible for i2c devices to be missing / not placed and we have to poll to see if they are there. That takes a long time to go through the possibilities with the 1s timeout.
Thanks,
Glen

@Glen The I2cController Class already has a timeout property that you can set to whatever TimeSpan you want.

        private static void Main()
        {
            I2cController i2cController = I2cController.FromName(GHIElectronics.TinyCLR.Pins.SC20260.I2cBus.I2c1);
            i2cController.Timeout = TimeSpan.FromMilliseconds(2000);
            I2cDevice _device = i2cController.GetDevice(new I2cConnectionSettings(0x27, I2cMode.Master, I2cAddressFormat.SevenBit, 400_000, true));
        }
1 Like

Thanks for the quick reply, much appreciated! Looks like this was added in 2.2 so we’ll be sorted as soon as that goes to RTW.

@Glen : Hey, you should be the first person know about this feature in 2.2 :)).