예제 #1
0
파일: I2CBus.cs 프로젝트: naice/HomeCon
        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;
        }
예제 #2
0
 public I2CBridge(Configuration config, RestServer.ILogger logger)
 {
     bus     = new I2CBus(logger);
     address = config.I2CBridgeAddress;
 }