当前位置: 首页>>代码示例>>C++>>正文


C++ CMU_ClockSelectSet函数代码示例

本文整理汇总了C++中CMU_ClockSelectSet函数的典型用法代码示例。如果您正苦于以下问题:C++ CMU_ClockSelectSet函数的具体用法?C++ CMU_ClockSelectSet怎么用?C++ CMU_ClockSelectSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CMU_ClockSelectSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rt_hw_driver_init

/***************************************************************************//**
 * @brief
 *   Initialize the hardware drivers.
 *
 * @details
 *
 * @note
 *
 ******************************************************************************/
void rt_hw_driver_init(void)
{
    CMU_ClockEnable(cmuClock_HFPER, true);

    /* Enable GPIO */
    CMU_ClockEnable(cmuClock_GPIO, true);

    /* Enabling clock to the interface of the low energy modules */
    CMU_ClockEnable(cmuClock_CORELE, true);

    /* Starting LFXO and waiting until it is stable */
    CMU_OscillatorEnable(cmuOsc_LFXO, true, true);

	/* Select LFXO for Peripherals A */
    CMU_ClockSelectSet(cmuClock_LFA,cmuSelect_LFXO);

    /* Select LFXO for specified module (and wait for it to stabilize) */
#if (defined(EFM32GG_USING_LEUART0) || defined(EFM32GG_USING_LEUART1))
    CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
#endif

    /* Enable SWO */
#if defined(EFM32GG_USING_SWO)
    efm_swo_setup();
#endif

    /* Initialize external interrupt */
#ifdef EFM32GG_USING_EINT
    eint_init();
#endif
}
开发者ID:BernardXiong,项目名称:stk3700,代码行数:40,代码来源:board.c

示例2: CAPLESENSE_setupCMU

/**************************************************************************//**
 * @brief  Setup the CMU
 *****************************************************************************/
void CAPLESENSE_setupCMU(void)
{
  /* Ensure core frequency has been updated */
  SystemCoreClockUpdate();

  /* Select clock source for HF clock. */
  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFRCO);
  /* Select clock source for LFA clock. */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);
  /* Select clock source for LFB clock. */
  CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_Disabled);

  /* Enable HF peripheral clock. */
  CMU_ClockEnable(cmuClock_HFPER, 1);
  /* Enable clock for GPIO. */
  CMU_ClockEnable(cmuClock_GPIO, 1);
  /* Enable clock for ACMP0. */
  CMU_ClockEnable(cmuClock_ACMP0, 1);
  /* Enable clock for ACMP1. */
  CMU_ClockEnable(cmuClock_ACMP1, 1);
  /* Enable CORELE clock. */
  CMU_ClockEnable(cmuClock_CORELE, 1);
  /* Enable clock for LESENSE. */
  CMU_ClockEnable(cmuClock_LESENSE, 1);

  /* Enable clock divider for LESENSE. */
  CMU_ClockDivSet(cmuClock_LESENSE, cmuClkDiv_1);
}
开发者ID:glocklueng,项目名称:sash-a300-lab,代码行数:31,代码来源:caplesense.c

示例3: setupCMU

/**************************************************************************//**
 * @brief  Setup the CMU
 *****************************************************************************/
void setupCMU(void)
{
  /* Ensure core frequency has been updated */
  SystemCoreClockUpdate();

  /* Select clock source for HF clock. */
  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFRCO);
  /* Select clock source for LFA clock. */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);
  /* Enable HF peripheral clock. */
  CMU_ClockEnable(cmuClock_HFPER, true);
  /* Enable clock for GPIO. */
  CMU_ClockEnable(cmuClock_GPIO, true);
  /* Enable clock for ACMP0. */
  CMU_ClockEnable(cmuClock_ACMP0, true);
  /* Enable clock for PRS. */
  CMU_ClockEnable(cmuClock_PRS, true);
  /* Enable CORELE clock. */
  CMU_ClockEnable(cmuClock_CORELE, true);
  /* Enable clock for PCNT. */
  CMU_ClockEnable(cmuClock_PCNT0, true);
  /* Enable clock on RTC. */
  CMU_ClockEnable(cmuClock_RTC, true);
  /* Enable clock for LESENSE. */
  CMU_ClockEnable(cmuClock_LESENSE, true);
  /* Set clock divider for LESENSE. */
  CMU_ClockDivSet(cmuClock_LESENSE, cmuClkDiv_1);
  /* Enable clock for DAC */
  CMU_ClockEnable(cmuClock_DAC0, true);
}
开发者ID:EnergyMicro,项目名称:EFM32WG_STK3800,代码行数:33,代码来源:lcsense.c

示例4: clkInit

/**
 * @brief Initialize the system clock
 *
 * @return N/A
 *
 */
static ALWAYS_INLINE void clkInit(void)
{
#ifdef CONFIG_CMU_HFCLK_HFXO
	CMU_HFXOInit(&hfxoInit);
	CMU_OscillatorEnable(cmuOsc_HFXO, true, true);
	CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
	CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
	SystemHFXOClockSet(CONFIG_CMU_HFXO_FREQ);
#elif (defined CONFIG_CMU_HFCLK_LFXO)
	CMU_LFXOInit(&lfxoInit);
	CMU_OscillatorEnable(cmuOsc_LFXO, true, true);
	CMU_ClockSelectSet(cmuClock_HF, cmuSelect_LFXO);
	CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);
	SystemLFXOClockSet(CONFIG_CMU_LFXO_FREQ);
#elif (defined CONFIG_CMU_HFCLK_HFRCO)
	/*
	 * This is the default clock, the controller starts with, so nothing to
	 * do here.
	 */
#else
#error "Unsupported clock source for HFCLK selected"
#endif

	/* Enable the High Frequency Peripheral Clock */
	CMU_ClockEnable(cmuClock_HFPER, true);

#ifdef CONFIG_GPIO_GECKO
	CMU_ClockEnable(cmuClock_GPIO, true);
#endif
}
开发者ID:agatti,项目名称:zephyr,代码行数:36,代码来源:soc.c

示例5: palClockSetup

/**************************************************************************//**
 * @brief   Setup clocks necessary to drive RTC/RTCC for EXTCOM GPIO pin.
 *
 * @return  N/A
 *****************************************************************************/
static void palClockSetup(CMU_Clock_TypeDef clock)
{
  /* Enable LE domain registers */
  CMU_ClockEnable(cmuClock_CORELE, true);

#if ( defined(PAL_CLOCK_RTC) && defined(PAL_RTC_CLOCK_LFXO) ) \
    || ( defined(PAL_CLOCK_RTCC) && defined(PAL_RTCC_CLOCK_LFXO) )
  /* LFA with LFXO setup is relatively time consuming. Therefore, check if it
     already enabled before calling. */
  if ( !(CMU->STATUS & CMU_STATUS_LFXOENS) )
  {
    CMU_OscillatorEnable(cmuOsc_LFXO, true, true);
  }
  if ( cmuSelect_LFXO != CMU_ClockSelectGet(clock) )
  {
    CMU_ClockSelectSet(clock, cmuSelect_LFXO);
  }
#elif ( defined(PAL_CLOCK_RTC) && defined(PAL_RTC_CLOCK_LFRCO) ) \
    || ( defined(PAL_CLOCK_RTCC) && defined(PAL_RTCC_CLOCK_LFRCO) )
  /* Enable LF(A|E)CLK in CMU (will also enable LFRCO oscillator if not enabled) */
  CMU_ClockSelectSet(clock, cmuSelect_LFRCO);
#elif ( defined(PAL_CLOCK_RTC) && defined(PAL_RTC_CLOCK_ULFRCO) ) \
    || ( defined(PAL_CLOCK_RTCC) && defined(PAL_RTCC_CLOCK_ULFRCO) )
  /* Enable LF(A|E)CLK in CMU (will also enable ULFRCO oscillator if not enabled) */
  CMU_ClockSelectSet(clock, cmuSelect_ULFRCO);
#else
#error No clock source for RTC defined.
#endif
}
开发者ID:JeffreyThijs94,项目名称:dash7-ap-open-source-stack,代码行数:34,代码来源:displaypalemlib.c

示例6: LETOUCH_setupCMU

/**************************************************************************//**
 * @brief  Enable clocks for all the peripherals to be used
 *****************************************************************************/
static void LETOUCH_setupCMU( void )
{
  /* Ensure core frequency has been updated */
  SystemCoreClockUpdate();

  /* ACMP */
  CMU_ClockEnable(cmuClock_ACMP0, true);
  CMU_ClockEnable(cmuClock_ACMP1, true);
  
  /* GPIO */
  CMU_ClockEnable(cmuClock_GPIO, true);

 /* Low energy peripherals
 *   LESENSE
 *   LFXO clock must be enabled prior to enabling
 *   clock for the low energy peripherals */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
  CMU_ClockEnable(cmuClock_CORELE, true);
  CMU_ClockEnable(cmuClock_LESENSE, true);

  /* RTC */
  CMU_ClockEnable(cmuClock_RTC, true);

  /* Disable clock source for LFB clock */
  CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_Disabled);
}
开发者ID:Blone,项目名称:my-project-hihack,代码行数:29,代码来源:lesense_letouch.c

示例7: vPortSetupTimerInterrupt

/**************************************************************************//**
 * @brief vPortSetupTimerInterrupt
 * Override the default definition of vPortSetupTimerInterrupt() that is weakly
 * defined in the FreeRTOS Cortex-M3, which set source of system tick interrupt
 *****************************************************************************/
void vPortSetupTimerInterrupt(void)
{
  /* Set our data about timer used as system ticks*/
  ulTimerReloadValueForOneTick = SYSTICK_LOAD_VALUE ;
  #if (configUSE_TICKLESS_IDLE == 1)
  xMaximumPossibleSuppressedTicks = TIMER_CAPACITY / (SYSTICK_LOAD_VALUE);
  ulStoppedTimerCompensation      = TIMER_COMPENSATION / (configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ);
#endif /* (configUSE_TICKLESS_IDLE == 1) */
  /* Configure RTC as system tick source */
  /* Structure of RTC init */
  RTC_Init_TypeDef init;
#if (configCRYSTAL_IN_EM2 == 1)
  /* LFXO setup */
  /* For cut D, use 70% boost */
  CMU->CTRL    = (CMU->CTRL & ~_CMU_CTRL_LFXOBOOST_MASK) | CMU_CTRL_LFXOBOOST_70PCENT;
  #if defined( EMU_AUXCTRL_REDLFXOBOOST )
  EMU->AUXCTRL = (EMU->AUXCTRL & ~_EMU_AUXCTRL_REDLFXOBOOST_MASK) | EMU_AUXCTRL_REDLFXOBOOST;
  #endif
#else
  /* RC oscillator */
  CMU_OscillatorEnable(cmuOsc_LFRCO, true, true);
#endif
  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);
#if (configCRYSTAL_IN_EM2 == 1)
  /* Enable osc as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
#else
  /* Enable osc as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);
#endif
  /* Set 2 times divider to reduce energy*/
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_2);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);
  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = false;         /* Count to max value before wrapping */
  /* Initialization of RTC */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(RTC_IFC_COMP0);

  /* Tick interrupt MUST execute at the lowest interrupt priority. */
  NVIC_SetPriority(RTC_IRQn, 255);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);
  RTC_CompareSet(0, SYSTICK_LOAD_VALUE);
  RTC_IntClear(RTC_IFC_COMP0);
  RTC_IntEnable(RTC_IF_COMP0);
  RTC_Enable(true);
  //RTC_CounterReset();
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:62,代码来源:low_power_tick_management.c

示例8: rtcSetup

/**************************************************************************//**
 * @brief Enables LFACLK and selects LFXO as clock source for RTC
 *        Sets up the RTC to generate an interrupt every second.
 *****************************************************************************/
static void rtcSetup(unsigned int frequency)
{
  RTC_Init_TypeDef rtcInit = RTC_INIT_DEFAULT;

  /* Enable LE domain registers */
  if ( !( CMU->HFCORECLKEN0 & CMU_HFCORECLKEN0_LE) )
  {
    CMU_ClockEnable(cmuClock_CORELE, true);
  }

#ifdef PAL_RTC_CLOCK_LFXO
  /* LFA with LFXO setup is relatively time consuming. Therefore, check if it
     already enabled before calling. */
  if ( !(CMU->STATUS & CMU_STATUS_LFXOENS) )
  {
    CMU_OscillatorEnable(cmuOsc_LFXO, true, true);
  }
  if ( cmuSelect_LFXO != CMU_ClockSelectGet(cmuClock_LFA) )
  {
    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
  }
#elif defined PAL_RTC_CLOCK_LFRCO
  /* Enable LFACLK in CMU (will also enable LFRCO oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);
#elif defined PAL_RTC_CLOCK_ULFRCO
  /* Enable LFACLK in CMU (will also enable ULFRCO oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_ULFRCO);
#else
#error No clock source for RTC defined.
#endif

  /* Set the prescaler. */
  CMU_ClockDivSet( cmuClock_RTC, cmuClkDiv_1 );

  /* Enable RTC clock */
  CMU_ClockEnable(cmuClock_RTC, true);

  /* Initialize RTC */
  rtcInit.enable   = false;  /* Do not start RTC after initialization is complete. */
  rtcInit.debugRun = false;  /* Halt RTC when debugging. */
  rtcInit.comp0Top = true;   /* Wrap around on COMP0 match. */
  RTC_Init(&rtcInit);

  /* Interrupt at given frequency. */
  RTC_CompareSet(0, (CMU_ClockFreqGet(cmuClock_RTC) / frequency) - 1 );

  /* Enable interrupt */
  NVIC_EnableIRQ(RTC_IRQn);
  RTC_IntEnable(RTC_IEN_COMP0);

  /* Start Counter */
  RTC_Enable(true);
}
开发者ID:JamesH001,项目名称:SX1231,代码行数:57,代码来源:displaypalemlib.c

示例9: main

/**************************************************************************//**
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Initialize chip */
  CHIP_Init();
  
  setupSWO();

  /* Enable HFXO */
  CMU_OscillatorEnable(cmuOsc_HFXO, true, true);

  /* Switch HFCLK to HFXO */
  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);

  /* Turn off HFRCO */
  CMU_OscillatorEnable(cmuOsc_HFRCO, false, false);

  BSP_LedsInit();

  while (1)
  {
    /* Blink led three times, with a factor 1 million delay */
    blink_led(1000000, 3);

    /* Turn on LFRCO */
    CMU_OscillatorEnable(cmuOsc_LFRCO, true, true);

    /* Select LFRCO */
    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_LFRCO);

    /* Maximum prescaling for smalles frequency (64 Hz) */
    CMU_ClockDivSet(cmuClock_CORE, cmuClkDiv_512);

    /* Turn off HFXO */
    CMU_OscillatorEnable(cmuOsc_HFXO, false, false);

    /* Blink led three times, with a factor 1 delay */
    blink_led(1, 3);

    /* Turn on HFXO */
    CMU_OscillatorEnable(cmuOsc_HFXO, true, true);

    /* Select HFXO */
    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);

    /* No prescaling for maximum clock frequency (32 MHz) */
    CMU_ClockDivSet(cmuClock_CORE, cmuClkDiv_1);

    /* Turn off LFRCO */
    CMU_OscillatorEnable(cmuOsc_LFRCO, false, false);
  }
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:54,代码来源:3_core_clock.c

示例10: main

/**************************************************************************//**
 * @brief main - the entrypoint after reset.
 *****************************************************************************/
int main( void )
{
  BSP_Init(BSP_INIT_DEFAULT);   /* Initialize DK board register access */

  /* If first word of user data page is non-zero, enable eA Profiler trace */
  BSP_TraceProfilerSetup();

  CMU_ClockSelectSet( cmuClock_HF, cmuSelect_HFXO );
  CMU_OscillatorEnable(cmuOsc_LFXO, true, false);

  if ( !MSDDMEDIA_Init() )      /* Initialize the media layer of the MSD. */
  {
    EFM_ASSERT( false );
    for( ;; ){}
  }

  VUD_Init();                   /* Initialize the vendor unique device. */
  CDC_Init();                   /* Initialize the communication class device. */
  MSDD_Init(gpioPortE, 1);      /* Initialize the Mass Storage Device.  */

  USBD_Init(&initstruct);       /* Start USB. */

  /*
   * When using a debugger it is practical to uncomment the following three
   * lines to force host to re-enumerate the device.
   */
  /* USBD_Disconnect(); */
  /* USBTIMER_DelayMs( 1000 ); */
  /* USBD_Connect(); */

  for (;;)
  {
    MSDD_Handler();             /* Serve the MSD device. */
  }
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:38,代码来源:main.c

示例11: RTC_Setup

/***************************************************************************//**
 * @brief
 *	Enables LFACLK and selects LFXO as clock source for RTC
 *
 * @param osc
 *	Oscillator
 ******************************************************************************/
void RTC_Setup(CMU_Select_TypeDef osc)
{
  RTC_Init_TypeDef init;

  rtcInitialized = 1;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable osc as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, osc);

  /* Use a 32 division prescaler to reduce power consumption. */
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_32);

  rtcFreq = CMU_ClockFreqGet(cmuClock_RTC);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = false; /* Count to max before wrapping */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);
}
开发者ID:ketrum,项目名称:equine-health-monitor-gdp12,代码行数:39,代码来源:rtc.c

示例12: RTC_Setup

/***************************************************************************//**
 * @brief Enables LFACLK and selects LFRCO as clock source for RTC
 ******************************************************************************/
static void RTC_Setup(void)
{
  RTC_Init_TypeDef init;

  rtcInitialized = 1;

  /* Ensure LE modules are accessible */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable LFRCO as LFACLK in CMU (will also enable oscillator if not enabled) */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFRCO);

  /* Enable clock to RTC module */
  CMU_ClockEnable(cmuClock_RTC, true);

  init.enable   = false;
  init.debugRun = false;
  init.comp0Top = false; /* Count to max before wrapping */
  RTC_Init(&init);

  /* Disable interrupt generation from RTC0 */
  RTC_IntDisable(_RTC_IF_MASK);

  /* Enable interrupts */
  NVIC_ClearPendingIRQ(RTC_IRQn);
  NVIC_EnableIRQ(RTC_IRQn);
}
开发者ID:ketrum,项目名称:equine-health-monitor-gdp12,代码行数:30,代码来源:rtc.c

示例13: LETIMER_setup

void LETIMER_setup(void)
{
    /* Enabling the required clocks */
    CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_ULFRCO); //Selecting the ULFRCO as the source clock
    CMU_ClockEnable(cmuClock_LETIMER0, true);           //Enable the clock input to LETIMER

    /* Set the compare values for COMP0 */
    LETIMER_CompareSet(LETIMER0, 0,PERIOD/ULFRCO_COUNT);

    /* Configure the LETIMER0 */
    LETIMER_Init_TypeDef letimerInit = LETIMER_INIT_DEFAULT;
    //    {
    //        .enable         = true,                   /* Default: Start counting when init completed. */
    //        .debugRun       = false,                  /* Default: Counter shall not keep running during debug halt. */
    //        .rtcComp0Enable = false,                  /* Default: Don't start counting on RTC COMP0 match. */
    //        .rtcComp1Enable = false,                  /* Default: Don't start counting on RTC COMP1 match. */
    //        .comp0Top       = true,                   /* Load COMP0 register into CNT when counter underflows. COMP0 is used as TOP */
    //        .bufTop         = false,                  /* Default: Don't load COMP1 into COMP0 when REP0 reaches 0. */
    //        .out0Pol        = 0,                      /* Default: Idle value for output 0. */
    //        .out1Pol        = 0,                      /* Default: Idle value for output 1. */
    //        .ufoa0          = letimerUFOANone,        /* Default : No action on underfow on Output 0*/
    //        .ufoa1          = letimerUFOANone,        /* Default : No action on underfow on Output 1*/
    //        .repMode        = letimerRepeatFree       /* Default: Count until stopped */
    //    };

    letimerInit.comp0Top= true,                   /* Default: Start counting when init completed. */

    /* Initialize LETIMER with the values above */
    LETIMER_Init(LETIMER0, &letimerInit);
}
开发者ID:TEAM-PARADIGM-SHIFT,项目名称:author_application,代码行数:30,代码来源:main.cpp

示例14: BootComUartInit

/************************************************************************************//**
** \brief     Initializes the UART communication interface.
** \return    none.
**
****************************************************************************************/
static void BootComUartInit(void)
{
  LEUART_Init_TypeDef init = LEUART_INIT_DEFAULT;

  /* configure GPIO pins */
  CMU_ClockEnable(cmuClock_GPIO, true);
  /* to avoid false start, configure output as high */
  GPIO_PinModeSet(gpioPortC, 6, gpioModePushPull, 1);
  GPIO_PinModeSet(gpioPortC, 7, gpioModeInput, 0);
  /* enable CORE LE clock in order to access LE modules */
  CMU_ClockEnable(cmuClock_CORELE, true);
  /* select LFXO for LEUARTs (and wait for it to stabilize) */
  CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
  /* do not prescale clock */
  CMU_ClockDivSet(cmuClock_LEUART1, cmuClkDiv_1);
  /* enable LEUART1 clock */
  CMU_ClockEnable(cmuClock_LEUART1, true);
  /* configure LEUART */
  init.enable = leuartDisable;
  LEUART_Init(LEUART1, &init);
  LEUART_BaudrateSet(LEUART1, 0, BOOT_COM_UART_BAUDRATE);
  /* enable pins at default location */
  LEUART1->ROUTE = LEUART_ROUTE_RXPEN | LEUART_ROUTE_TXPEN;
  /* clear previous RX interrupts */
  LEUART_IntClear(LEUART1, LEUART_IF_RXDATAV);
  /* finally enable it */
  LEUART_Enable(LEUART1, leuartEnable);
} /*** end of BootUartComInit ***/
开发者ID:x893,项目名称:OpenBLT,代码行数:33,代码来源:boot.c

示例15: rtcSetup

/**************************************************************************//**
 * @brief Enables LFACLK and selects LFXO as clock source for RTC
 *        Sets up the RTC to generate an interrupt every minute.
 *****************************************************************************/
void rtcSetup(void)
{
  RTC_Init_TypeDef rtcInit = RTC_INIT_DEFAULT;

  /* Enable LE domain registers */
  CMU_ClockEnable(cmuClock_CORELE, true);

  /* Enable LFXO as LFACLK in CMU. This will also start LFXO */
  CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);

  /* Set a clock divisor of 32 to reduce power conumption. */
  CMU_ClockDivSet(cmuClock_RTC, cmuClkDiv_32);

  /* Enable RTC clock */
  CMU_ClockEnable(cmuClock_RTC, true);

  /* Initialize RTC */
  rtcInit.enable   = false;  /* Do not start RTC after initialization is complete. */
  rtcInit.debugRun = false;  /* Halt RTC when debugging. */
  rtcInit.comp0Top = true;   /* Wrap around on COMP0 match. */
  RTC_Init(&rtcInit);

  /* Interrupt every minute */
  RTC_CompareSet(0, ((RTC_FREQ / 32) * 60 ) - 1 );

  /* Enable interrupt */
  NVIC_EnableIRQ(RTC_IRQn);
  RTC_IntEnable(RTC_IEN_COMP0);

  /* Start Counter */
  RTC_Enable(true);
}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:36,代码来源:clock.c


注:本文中的CMU_ClockSelectSet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。