/* Enter energy mode 3 (EM3). 
However, prior to entering EM3, the core may have been using another oscillator than HFRCO. The  */
void EMU_EnterEM3(bool restore)
/* Enter energy mode 3 (EM3). 
However, prior to entering EM3, the core may have been using another oscillator than HFRCO. The  */
void EMU_EnterEM3(bool restore)
{
  uint32_t cmuLocked;
  cmuStatus = (uint16_t)(CMU->STATUS);
  cmuLocked = CMU->LOCK & CMU_LOCK_LOCKKEY_LOCKED;
  CMU_Unlock();
  CMU->OSCENCMD = CMU_OSCENCMD_LFXODIS | CMU_OSCENCMD_LFRCODIS;
  if (cmuLocked)
  {
    CMU_Lock();
  }
  SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
  __WFI();
  if (restore)
  {
    EMU_Restore();
  }
  else if (!(cmuStatus & CMU_STATUS_HFRCOSEL))
  {
    SystemCoreClockUpdate();
  }
}