emlib/src/em_cmu.c
void CMU_AUXHFRCOBandSet(CMU_AUXHFRCOBand_TypeDef band)
{
  uint32_t tuning;

  /* Read tuning value from calibration table */
  switch (band) {
    case cmuAUXHFRCOBand_1MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND1_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND1_SHIFT;
      break;

    case cmuAUXHFRCOBand_7MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND7_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND7_SHIFT;
      break;

    case cmuAUXHFRCOBand_11MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND11_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND11_SHIFT;
      break;

    case cmuAUXHFRCOBand_14MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND14_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND14_SHIFT;
      break;

    case cmuAUXHFRCOBand_21MHz:
      tuning = (DEVINFO->AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND21_MASK)
               >> _DEVINFO_AUXHFRCOCAL1_BAND21_SHIFT;
      break;

#if defined(_CMU_AUXHFRCOCTRL_BAND_28MHZ)
    case cmuAUXHFRCOBand_28MHz:
      tuning = (DEVINFO->AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND28_MASK)
               >> _DEVINFO_AUXHFRCOCAL1_BAND28_SHIFT;
      break;
#endif

    default:
      EFM_ASSERT(0);
      return;
  }

  /* Set band/tuning */
  CMU->AUXHFRCOCTRL = (CMU->AUXHFRCOCTRL
                       & ~(_CMU_AUXHFRCOCTRL_BAND_MASK
                           | _CMU_AUXHFRCOCTRL_TUNING_MASK))
                      | (band << _CMU_AUXHFRCOCTRL_BAND_SHIFT)
                      | (tuning << _CMU_AUXHFRCOCTRL_TUNING_SHIFT);
}
/***************************************************************************/
/**
 * @brief
 *   Set AUXHFRCO band and the tuning value based on the value in the
 *   calibration table made during production.
 *
 * @param[in] band
 *   AUXHFRCO band to activate.
 ******************************************************************************/
@brief
Set AUXHFRCO band and the tuning value based on the value in the
calibration table made during production.

@param[in] band
AUXHFRCO band to activate.
@brief Set AUXHFRCO band and the tuning value based on the value in the calibration table made during production . @param [ in ] band AUXHFRCO band to activate .
void CMU_AUXHFRCOBandSet(CMU_AUXHFRCOBand_TypeDef band)
{
  uint32_t tuning;
  switch (band) {
    case cmuAUXHFRCOBand_1MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND1_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND1_SHIFT;
      break;
    case cmuAUXHFRCOBand_7MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND7_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND7_SHIFT;
      break;
    case cmuAUXHFRCOBand_11MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND11_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND11_SHIFT;
      break;
    case cmuAUXHFRCOBand_14MHz:
      tuning = (DEVINFO->AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND14_MASK)
               >> _DEVINFO_AUXHFRCOCAL0_BAND14_SHIFT;
      break;
    case cmuAUXHFRCOBand_21MHz:
      tuning = (DEVINFO->AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND21_MASK)
               >> _DEVINFO_AUXHFRCOCAL1_BAND21_SHIFT;
      break;
#if defined(_CMU_AUXHFRCOCTRL_BAND_28MHZ)
    case cmuAUXHFRCOBand_28MHz:
      tuning = (DEVINFO->AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND28_MASK)
               >> _DEVINFO_AUXHFRCOCAL1_BAND28_SHIFT;
      break;
#endif
    default:
      EFM_ASSERT(0);
      return;
  }
  CMU->AUXHFRCOCTRL = (CMU->AUXHFRCOCTRL
                       & ~(_CMU_AUXHFRCOCTRL_BAND_MASK
                           | _CMU_AUXHFRCOCTRL_TUNING_MASK))
                      | (band << _CMU_AUXHFRCOCTRL_BAND_SHIFT)
                      | (tuning << _CMU_AUXHFRCOCTRL_TUNING_SHIFT);
}
void CMU_AUXHFRCOBandSet ( CMU_AUXHFRCOBand_TypeDef band ) { uint32_t tuning ; switch ( band ) { case cmuAUXHFRCOBand_1MHz : tuning = ( DEVINFO -> AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND1_MASK ) >> _DEVINFO_AUXHFRCOCAL0_BAND1_SHIFT ; break ; case cmuAUXHFRCOBand_7MHz : tuning = ( DEVINFO -> AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND7_MASK ) >> _DEVINFO_AUXHFRCOCAL0_BAND7_SHIFT ; break ; case cmuAUXHFRCOBand_11MHz : tuning = ( DEVINFO -> AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND11_MASK ) >> _DEVINFO_AUXHFRCOCAL0_BAND11_SHIFT ; break ; case cmuAUXHFRCOBand_14MHz : tuning = ( DEVINFO -> AUXHFRCOCAL0 & _DEVINFO_AUXHFRCOCAL0_BAND14_MASK ) >> _DEVINFO_AUXHFRCOCAL0_BAND14_SHIFT ; break ; case cmuAUXHFRCOBand_21MHz : tuning = ( DEVINFO -> AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND21_MASK ) >> _DEVINFO_AUXHFRCOCAL1_BAND21_SHIFT ; break ; #if defined ( _CMU_AUXHFRCOCTRL_BAND_28MHZ ) case cmuAUXHFRCOBand_28MHz : tuning = ( DEVINFO -> AUXHFRCOCAL1 & _DEVINFO_AUXHFRCOCAL1_BAND28_MASK ) >> _DEVINFO_AUXHFRCOCAL1_BAND28_SHIFT ; break ; #endif default : EFM_ASSERT ( 0 ) ; return ; } CMU -> AUXHFRCOCTRL = ( CMU -> AUXHFRCOCTRL & ~ ( _CMU_AUXHFRCOCTRL_BAND_MASK | _CMU_AUXHFRCOCTRL_TUNING_MASK ) ) | ( band << _CMU_AUXHFRCOCTRL_BAND_SHIFT ) | ( tuning << _CMU_AUXHFRCOCTRL_TUNING_SHIFT ) ; }
@brief
   Set AUXHFRCO band and the tuning value based on the value in the
   calibration table made during production.
@brief Set AUXHFRCO band and the tuning value based on the value in the calibration table made during production .
/* Read tuning value from calibration table */ /* Set band/tuning */