示例#1
0
        public override I2cDevice CreateDevice(int deviceAddress)
        {
            if (_devices.ContainsKey(deviceAddress))
            {
                throw new ArgumentException($"Device with address 0x{deviceAddress,0X2} is already open.", nameof(deviceAddress));
            }

            Windows10I2cBusDevice device = new Windows10I2cBusDevice(this, new I2cConnectionSettings(BusId, deviceAddress));

            _devices[deviceAddress] = device;

            return(device);
        }
示例#2
0
 internal void RemoveDeviceNoCheck(int deviceAddress, Windows10I2cBusDevice device)
 {
     _devices?.Remove(deviceAddress);
     device.DisposeDevice();
 }