protected DigitalPortDeviceBase(DigitalPort port, IGpioControllerFactory controllerFactory)
 {
     if (controllerFactory == null)
     {
         throw new ArgumentNullException(nameof(controllerFactory));
     }
     DisplayProperties = new List <DisplayPropertyBase>();
     Port       = port;
     Controller = controllerFactory.GetOrCreateController();
 }
Esempio n. 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);
        }