Esempio n. 1
0
        // ReSharper disable once InconsistentNaming
        private async Task InitI2cADS1115(int slaveAddress, byte channel)
        {
            var device = await FindI2CDevice(_I2CBus, slaveAddress, I2cBusSpeed.FastMode, I2cSharingMode.Shared);

            IADS1115Device ads1115 = new ADS1115Device(device, channel);

            ads1115.ChannelChanged += Ads1115ChannelChanged;
            AddDevice(slaveAddress, ads1115);
        }
        private async Task InitI2cADS1115(byte channel)
        {
            const string busName = "I2C1";
            var          bus     = await FindI2CController(busName);

            var device = await FindI2CDevice(bus, ADS1115_Constants.ADS1115_ADDRESS.GetHashCode());

            IADS1115Device ads1115 = new ADS1115Device(device, channel);

            ads1115.ChannelChanged += Ads1115ChannelChanged;
            _devices.Add(DeviceName(busName, (byte)ADS1115_Constants.ADS1115_ADDRESS.GetHashCode(), null), ads1115);
        }