public ReceivePipe(ILoggerFactoryAdapter loggerFactoryAdapter, IConfiguration configuration, ICommandProcessor commandProcessor, IRegisterContainer registerContainer, IReceivePipeCollection parent, int pipeId) { if (PipeId > 5) throw new ArgumentOutOfRangeException(nameof(pipeId), "Invalid PipeId number for this Pipe"); _logger = loggerFactoryAdapter.GetLogger(string.Format("{0}{1}", GetType().Name, pipeId)); _configuration = configuration; _commandProcessor = commandProcessor; _registerContainer = registerContainer; _parent = parent; PipeId = pipeId; }
public ReceivePipe(ILoggerFactoryAdapter loggerFactoryAdapter, IConfiguration configuration, ICommandProcessor commandProcessor, IRegisterContainer registerContainer, IReceivePipeCollection parent, int pipeId) { if (PipeId > 5) { throw new ArgumentOutOfRangeException(nameof(pipeId), "Invalid PipeId number for this Pipe"); } _logger = loggerFactoryAdapter.GetLogger(string.Format("{0}{1}", GetType().Name, pipeId)); _configuration = configuration; _commandProcessor = commandProcessor; _registerContainer = registerContainer; _parent = parent; PipeId = pipeId; }
public Radio(ICommandProcessor commandProcessor, ILoggerFactoryAdapter loggerFactoryAdapter, GpioPin powerPin, GpioPin cePin, GpioPin irqPin = null) { _syncRoot = new object(); _operatingMode = OperatingModes.PowerOff; _powerPin = powerPin; _powerPin.Write(GpioPinValue.Low); _cePin = cePin; _cePin.Write(GpioPinValue.Low); _loggerFactoryAdapter = loggerFactoryAdapter; _logger = _loggerFactoryAdapter.GetLogger(GetType()); _commandProcessor = commandProcessor; _commandProcessor.LoggerFactory = _loggerFactoryAdapter; _commandProcessor.GetOperatingMode = () => OperatingMode; RegisterContainer = new RegisterContainer(_loggerFactoryAdapter, _commandProcessor); OperatingMode = OperatingModes.PowerDown; RegisterContainer.ResetRegistersToDefault(); Configuration = new Configuration(_loggerFactoryAdapter, _commandProcessor, RegisterContainer); TransmitPipe = new TransmitPipe(_loggerFactoryAdapter, Configuration, _commandProcessor, RegisterContainer, _cePin); ReceivePipes = new ReceivePipeCollection(_loggerFactoryAdapter, Configuration, _commandProcessor, RegisterContainer); bool useIrq = irqPin != null; if (useIrq) { _irqPin = irqPin; _irqPin.Write(GpioPinValue.High); _irqPin.ValueChanged += irqPin_ValueChanged; } ConfigurationRegister configurationRegister = RegisterContainer.ConfigurationRegister; configurationRegister.MaximunTransmitRetriesMask = !useIrq; configurationRegister.ReceiveDataReadyMask = !useIrq; configurationRegister.TransmitDataSentMask = !useIrq; configurationRegister.Save(); OperatingMode = OperatingModes.StandBy; }