Example #1
0
        public void MultiCastLevel(byte level)
        {
            _multiCastLevel = level;
            //_radio.OperatingMode = OperatingModes.StandBy;
            IReceivePipe receivePipe = _radio.ReceivePipes[0];

            receivePipe.Address = BitConverter.GetBytes(NetworkAddressing.PipeAddress(NetworkAddressing.LevelToAddress(level), 0)).ReverseBytes();
            receivePipe.Enabled = true;
            // _radio.OperatingMode = OperatingModes.ReceiveMode;
        }
Example #2
0
        public void Begin(byte channel, ushort nodeAddress)
        {
            if (!NetworkAddressing.IsValidAddress(nodeAddress))
            {
                return;
            }
            NetworkAddressing.NodeAddress = nodeAddress;
            if (channel != Configuration.UseCurrentChannel)
            {
                _radio.Configuration.Channel = channel;
            }
            _radio.RegisterContainer.EnableAutoAcknowledgementRegister.EnableAutoAcknowledgementPipe0 = false;
            _radio.RegisterContainer.EnableAutoAcknowledgementRegister.Save();

            _radio.Configuration.DynamicPayloadLengthEnabled = true;

            AutoRetransmitDelays retryVar = (AutoRetransmitDelays)((((nodeAddress % 6) + 1) * 2) + 3);

            _radio.Configuration.AutoRetransmitDelay = retryVar;
            _radio.Configuration.AutoRetransmitCount = 5;

            TransmitTimeout = 25;
            RouteTimeout    = TransmitTimeout * 3;

            NetworkAddressing.SetupAddress();

            byte i = 6;

            while (i-- > 0)
            {
                IReceivePipe receivePipe = _radio.ReceivePipes[i];
                receivePipe.Address = BitConverter.GetBytes(NetworkAddressing.PipeAddress(nodeAddress, i)).ReverseBytes();
                receivePipe.Enabled = true;
            }

            _radio.OperatingMode = OperatingModes.ReceiveMode;
        }