Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public I2CBridge(Configuration config, RestServer.ILogger logger)
 {
     bus     = new I2CBus(logger);
     address = config.I2CBridgeAddress;
 }