public SoundSensor(AnaloguePort port, int deviceAddress, II2CDeviceFactory i2CDeviceFactory, bool normalizeValue) : base(port, deviceAddress, i2CDeviceFactory) { _normalizeValue = normalizeValue; var(pin1, _) = Port.ToPinPair(); var bus = i2CDeviceFactory.GetOrCreateI2CDevice(DeviceAddress); _adc = new AnalogueDigitalConverter(bus, pin1); AddToDisposables(_adc); }
public Sh1106(int deviceAddress, II2CDeviceFactory i2CDeviceFactory) { if (i2CDeviceFactory == null) { throw new ArgumentNullException(nameof(i2CDeviceFactory)); } var bus = i2CDeviceFactory.GetOrCreateI2CDevice(deviceAddress); _serialInterface = new I2cInterface(bus); }