public RadioConfiguration(Radio radio) { _radio = radio; _payloadWidth = Constants.MaxPayloadWidth; Registers = new RegisterManager(_radio); Registers.LoadRegisters(); }
public ReceivePipe(Radio radio, int pipeId) { if (PipeId > 5) throw new ArgumentOutOfRangeException(nameof(pipeId), "Invalid PipeId number for this Pipe"); _radio = radio; PipeId = pipeId; _registers = _radio.Configuration.Registers; }
public void Initialize() { GpioController gpioController = GpioController.GetDefault(); GpioPin powerPin = gpioController.InitGpioPin(4, GpioPinDriveMode.Output, GpioSharingMode.Exclusive); GpioPin cePin = gpioController.InitGpioPin(22, GpioPinDriveMode.Output, GpioSharingMode.Exclusive); GpioPin irqPin = gpioController.InitGpioPin(25, GpioPinDriveMode.InputPullUp, GpioSharingMode.Exclusive); powerPin.Write(GpioPinValue.Low); cePin.Write(GpioPinValue.Low); irqPin.Write(GpioPinValue.High); DeviceInformationCollection devicesInfo = DeviceInformation.FindAllAsync(SpiDevice.GetDeviceSelector("SPI0")).GetAwaiter().GetResult(); SpiDevice spiDevice = SpiDevice.FromIdAsync(devicesInfo[0].Id, new SpiConnectionSettings(0)).GetAwaiter().GetResult(); ICommandProcessor commandProcessor = new CommandProcessor(spiDevice); ILoggerFactoryAdapter loggerFactoryAdapter = new DebugOutLoggerFactoryAdapter(LogLevel.All, true, true, true, "MM/dd/yyyy hh:mm:ss fffff"); _radio = new Radio(commandProcessor, loggerFactoryAdapter, powerPin, cePin, irqPin); //SenderTest(); //ReceiverTest(); SenderReceiverTest(); }
public Diagnostics(Radio radio) { _radio = radio; }
public void Dispose() { _radio.Dispose(); _radio = null; }
public void Initialize() { GpioController gpioController = GpioController.GetDefault(); GpioPin powerPin = gpioController.InitGpioPin(4, GpioPinDriveMode.Output, GpioSharingMode.Exclusive);//4 GpioPin cePin = gpioController.InitGpioPin(22, GpioPinDriveMode.Output, GpioSharingMode.Exclusive);//22 GpioPin irqPin = gpioController.InitGpioPin(25, GpioPinDriveMode.InputPullUp, GpioSharingMode.Exclusive);//25 powerPin.Write(GpioPinValue.Low); cePin.Write(GpioPinValue.Low); irqPin.Write(GpioPinValue.High); DeviceInformationCollection devicesInfo = DeviceInformation.FindAllAsync(SpiDevice.GetDeviceSelector("SPI0")).GetAwaiter().GetResult(); SpiDevice spiDevice = SpiDevice.FromIdAsync(devicesInfo[0].Id, new SpiConnectionSettings(0)).GetAwaiter().GetResult(); ICommandProcessor commandProcessor = new CommandProcessor(spiDevice); ILoggerFactoryAdapter loggerFactoryAdapter = new DebugOutLoggerFactoryAdapter(LogLevel.All, true, true, true, "MM/dd/yyyy hh:mm:ss fffff"); _radio = new Radio(commandProcessor, loggerFactoryAdapter, powerPin, cePin, irqPin); _sendReceiveRole = new SenderReceiverRole(); _sendReceiveRole.AttachRadio(_radio); _sendReceiveRole.DataArrived += DataArrived; ; _sendReceiveRole.SendAddress = SendAddress; _sendReceiveRole.ReceiveAddress = ReceiveAddress; _sendReceiveRole.Start(); ThreadPoolTimer.CreatePeriodicTimer(Handler, TimeSpan.FromSeconds(5)); WaitForData(); }
public TransmitPipe(Radio radio) { _radio = radio; _registers = _radio.Configuration.Registers; }