コード例 #1
0
        public Sh1106(int deviceAddress, II2CDeviceFactory i2CDeviceFactory)
        {
            if (i2CDeviceFactory == null)
            {
                throw new ArgumentNullException(nameof(i2CDeviceFactory));
            }
            var bus = i2CDeviceFactory.GetOrCreateI2CDevice(deviceAddress);

            _serialInterface = new I2cInterface(bus);
        }
コード例 #2
0
        public Sh1106(SpiConnectionSettings connectionSettings, int dcPin, int rstPin, ISPiDeviceFactory sPiDeviceFactory, IGpioControllerFactory controllerFactory)
        {
            if (connectionSettings == null)
            {
                throw new ArgumentNullException(nameof(connectionSettings));
            }

            if (sPiDeviceFactory == null)
            {
                throw new ArgumentNullException(nameof(sPiDeviceFactory));
            }

            if (controllerFactory == null)
            {
                throw new ArgumentNullException(nameof(controllerFactory));
            }

            var spiDevice  = sPiDeviceFactory.GetOrCreateSpiDevice(connectionSettings);
            var controller = controllerFactory.GetOrCreateController();

            _serialInterface = new SpiInterface(spiDevice, controller, dcPin, rstPin);
        }
コード例 #3
0
ファイル: Worker.cs プロジェクト: JohnySeven/BoatSensors
 public Worker(ILogger <Worker> logger, ISerialInterface serial, ISKInterface signalK)
 {
     _logger  = logger;
     _serial  = serial;
     _signalK = signalK;
 }