public void StartListening()
        {
            ConfigurationRegister configRegister = Configuration.Registers.ConfigurationRegister;

            configRegister.PWR_UP  = true;
            configRegister.PRIM_RX = true;
            configRegister.Save();

            StatusRegister statusRegister = Configuration.Registers.StatusRegister;

            statusRegister.RX_DR  = false;
            statusRegister.TX_DS  = false;
            statusRegister.MAX_RT = false;
            statusRegister.Save();

            // Restore the pipe0 address, if exists
            if (_receiveAddressPipe0 > 0)
            {
                AddressPipeRegister receiveAddressPipe0Register = Configuration.Registers.ReceiveAddressPipeRegisters[0];
                receiveAddressPipe0Register.Load(BitConverter.GetBytes(_receiveAddressPipe0));
                receiveAddressPipe0Register.Save();
            }

            TransmitPipe.FlushBuffer();
            ReceivePipes.FlushBuffer();

            ChipEnable(true);
        }
        public void Begin()
        {
            RegisterManager registers = Configuration.Registers;

            ChipEnable(false);

            // Set 1500uS (minimum for 32B payload in ESB@250KBPS) timeouts, to make testing a little easier
            // WARNING: If this is ever lowered, either 250KBS mode with AA is broken or maximum packet
            // sizes must never be used. See documentation for a more complete explanation.
            Configuration.AutoRetransmitDelay = AutoRetransmitDelays.Delay4000uS;
            Configuration.AutoRetransmitCount = 15;

            // Disable auto acknowledgement
            EnableAutoAcknowledgementRegister autoAckRegister = registers.EnableAutoAcknowledgementRegister;

            autoAckRegister.EN_AA = false;
            autoAckRegister.Save();

            // Attempt to set DataRate to 250Kbps to determine if this is a plus model
            Configuration.DataRate    = DataRates.DataRate250Kbps;
            Configuration.IsPlusModel = Configuration.DataRate == DataRates.DataRate250Kbps;

            // Restore our default PA level
            Configuration.PowerLevel = PowerLevels.Max;

            // Initialize CRC and request 2-byte (16bit) CRC
            Configuration.CrcEncodingScheme = CrcEncodingSchemes.DualBytes;
            Configuration.CrcEnabled        = true;

            // Disable dynamic payload lengths
            Configuration.DynamicPayloadLengthEnabled = false;

            // Set up default configuration.  Callers can always change it later.
            // This channel should be universally safe and not bleed over into adjacent spectrum.
            Configuration.Channel = 76;

            // Then set the data rate to the slowest (and most reliable) speed supported by all hardware.
            Configuration.DataRate = DataRates.DataRate1Mbps;

            // Reset current status
            // Notice reset and flush is the last thing we do
            StatusRegister statusRegister = registers.StatusRegister;

            statusRegister.RX_DR  = false;
            statusRegister.TX_DS  = false;
            statusRegister.MAX_RT = false;
            statusRegister.Save();

            TransmitPipe.FlushBuffer();
            ReceivePipes.FlushBuffer();
        }
 public void StopListening()
 {
     ChipEnable(false);
     TransmitPipe.FlushBuffer();
     ReceivePipes.FlushBuffer();
 }