public I2CBus(RestServer.ILogger logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); string deviceSelector = I2cDevice.GetDeviceSelector(); DeviceInformationCollection deviceInformation = DeviceInformation.FindAllAsync(deviceSelector).AsTask().Result; if (deviceInformation.Count == 0) { throw new InvalidOperationException("I2C bus not found."); } _i2CBusId = deviceInformation.First().Id; }
public I2CBridge(Configuration config, RestServer.ILogger logger) { bus = new I2CBus(logger); address = config.I2CBridgeAddress; }