// ReSharper disable once InconsistentNaming private async Task InitI2cVCNL4000() { const string busName = "I2C1"; var bus = await FindI2CController(busName); var device = await FindI2CDevice(bus, VCNL4000_Constants.VCNL4000_ADDRESS.GetHashCode()); var initSettings = new VCNL4000Settings { IrCurrent_mA = 20, SensorTimeOut = 300, SensorPollInterval = 500, FirstPolynomial = 3.05101567E-11, SecondPolynomial = 3.75216617E-07, Dy = 4.98316469E-04 }; IVCNL4000Device vcnl4000 = new VCNL4000Device(device, initSettings); vcnl4000.ProximityReceived += ProximityReceived_Handler; vcnl4000.AmbientLightReceived += Vcnl4000_AmbientLightReceived; vcnl4000.SensorException += SensorException_Handler; _devices.Add(DeviceName(busName, (byte)VCNL4000_Constants.VCNL4000_ADDRESS.GetHashCode(), null), vcnl4000); }
// ReSharper disable once InconsistentNaming private async Task InitI2cVCNL4000() { var device = await FindI2CDevice(_I2CBus, VCNL4000_Constants.VCNL4000_ADDRESS.GetHashCode(), I2cBusSpeed.FastMode, I2cSharingMode.Shared); var initSettings = new VCNL4000Settings { IrCurrent_mA = 20, SensorTimeOut = 300, SensorPollInterval = 500, FirstPolynomial = 3.05101567E-11, SecondPolynomial = 3.75216617E-07, Dy = 4.98316469E-04 }; IVCNL4000Device vcnl4000 = new VCNL4000Device(device, initSettings); vcnl4000.ProximityReceived += ProximityReceived_Handler; vcnl4000.AmbientLightReceived += Vcnl4000_AmbientLightReceived; vcnl4000.SensorException += SensorException_Handler; AddDevice((byte)VCNL4000_Constants.VCNL4000_ADDRESS.GetHashCode(), vcnl4000); }