private void On() { lock (_hal) { _hal._powerPort.Write(true); Thread.Sleep(200); SWReset(); InitRegisters(); StartOsc(); EnableInterrupts(); Channel = _channel; Power = _rfPower; _rxEnabled = false; // CC2420 ext address is a random value. Recover/generate ext address from flash if needed { CC2420Address addr = null; // try to recover address ExtendedWeakReference ewr = ExtendedWeakReference.Recover(typeof(CC2420Address), 0); if (addr != null) { // address recovered from flash _hal.ExtendedAddress = addr.extAddress; } else { // save current address in flash ewr = ExtendedWeakReference.RecoverOrCreate(typeof(CC2420Address), 0, ExtendedWeakReference.c_SurvivePowerdown); if (ewr != null) { addr = new CC2420Address(); addr.extAddress = _hal.ExtendedAddress; ewr.Priority = (int)ExtendedWeakReference.PriorityLevel.System; ewr.Target = addr; ewr.PushBackIntoRecoverList(); } } } } }
private void On() { lock (_hal) { _hal._powerPort.Write(true); Thread.Sleep(200); SWReset(); InitRegisters(); StartOsc(); EnableInterrupts(); Channel = _channel; Power = _rfPower; _rxEnabled = false; // CC2420 ext address is a random value. Recover/generate ext address from flash if needed { CC2420Address addr = null; // try to recover address ExtendedWeakReference ewr = ExtendedWeakReference.Recover(typeof(CC2420Address), 0); if (addr != null) { // address recovered from flash _hal.ExtendedAddress = addr.extAddress; } else { // save current address in flash ewr = ExtendedWeakReference.RecoverOrCreate(typeof(CC2420Address), 0, ExtendedWeakReference.c_SurvivePowerdown); if (ewr != null) { addr = new CC2420Address(); addr.extAddress = _hal.ExtendedAddress; ewr.Priority = (int)ExtendedWeakReference.PriorityLevel.System; ewr.Target = addr; ewr.PushBackIntoRecoverList(); } } } } }