您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CMU_ClockFreqGet函数代码示例

51自学网 2021-06-01 20:03:03
  C++
这篇教程C++ CMU_ClockFreqGet函数代码示例写得很实用,希望能帮到您。

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

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

示例1: main

int main(void) {		CHIP_Init();	if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000)) while (1) ;  BSP_Init(BSP_INIT_DEFAULT);	BSP_LedsSet(0);  BSP_PeripheralAccess(BSP_AUDIO_IN, true);  BSP_PeripheralAccess(BSP_AUDIO_OUT, true);  RTCDRV_Trigger(1000, NULL);  EMU_EnterEM2(true);  initSource();	setupCMU();  setupDMA();    //setupADC();  //setupDAC();  //setupDMAInput();  //setupDMAOutput();	//setupDMASplit();	//setupDMAMerge();  ADCConfig();  DACConfig();  TIMER_Init_TypeDef timerInit = TIMER_INIT_DEFAULT;  TIMER_TopSet(TIMER0, CMU_ClockFreqGet(cmuClock_HFPER) / SAMPLE_RATE);  TIMER_Init(TIMER0, &timerInit);	Delay(100);	BSP_LedsSet(3);	Delay(500);	BSP_LedsSet(0);	Delay(100);	while(1) {		volatile bool result = test();		if (result) {			BSP_LedsSet(0x00FF);		} else {			BSP_LedsSet(0xFF00);					}		Delay(1000);    BSP_LedsSet(0x0);        Delay(1000);	}}
开发者ID:havardh,项目名称:bitless,代码行数:56,


示例2: CAN_GetClockFrequency

/***************************************************************************//** * @brief *   Get the CAN module frequency. * * @details *   There is an internal prescaler of 2 inside the CAN module. * * @param[in] can *   Pointer to CAN peripheral register block. * * @return *   Clock value ******************************************************************************/uint32_t CAN_GetClockFrequency(CAN_TypeDef *can){#if defined CAN0  if (can == CAN0) {    return CMU_ClockFreqGet(cmuClock_CAN0) / 2;  }#endif#if defined CAN1  if (can == CAN1) {    return CMU_ClockFreqGet(cmuClock_CAN1) / 2;  }#endif  EFM_ASSERT(false);  return 0;}
开发者ID:sg-,项目名称:mbed-os,代码行数:29,


示例3: rtccSetup

/**************************************************************************//** * @brief Enables LFECLK and selects clock source for RTCC *        Sets up the RTCC to generate an interrupt every second. *****************************************************************************/static void rtccSetup(unsigned int frequency){  RTCC_Init_TypeDef rtccInit = RTCC_INIT_DEFAULT;  rtccInit.presc = rtccCntPresc_1;  palClockSetup(cmuClock_LFE);  /* Enable RTCC clock */  CMU_ClockEnable(cmuClock_RTCC, true);  /* Initialize RTC */  rtccInit.enable   = false;  /* Do not start RTC after initialization is complete. */  rtccInit.debugRun = false;  /* Halt RTC when debugging. */  rtccInit.cntWrapOnCCV1 = true;   /* Wrap around on CCV1 match. */  RTCC_Init(&rtccInit);  /* Interrupt at given frequency. */  RTCC_CCChConf_TypeDef ccchConf = RTCC_CH_INIT_COMPARE_DEFAULT;  ccchConf.compMatchOutAction = rtccCompMatchOutActionToggle;  RTCC_ChannelInit(1, &ccchConf);  RTCC_ChannelCCVSet(1, (CMU_ClockFreqGet(cmuClock_RTCC) / frequency) - 1);#ifndef INCLUDE_PAL_GPIO_PIN_AUTO_TOGGLE_HW_ONLY  /* Enable interrupt */  NVIC_EnableIRQ(RTCC_IRQn);  RTCC_IntEnable(RTCC_IEN_CC1);#endif  RTCC->CNT = _RTCC_CNT_RESETVALUE;  /* Start Counter */  RTCC_Enable(true);}
开发者ID:JeffreyThijs94,项目名称:dash7-ap-open-source-stack,代码行数:35,


示例4: main

/**************************************************************************//** * @brief  Main function *****************************************************************************/int main(void){  /* Initialize DK board register access */  BSP_Init(BSP_INIT_DEFAULT);  /* If first word of user data page is non-zero, enable eA Profiler trace */  BSP_TraceProfilerSetup();  /* Setup SysTick Timer for 1 msec interrupts  */  if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000))  {    while (1) ;  }  /* Initialize DK interrupt enable */  DK_IRQInit();  /* Initialize GPIO interrupt */  GPIO_IRQInit();  /* Turn off LEDs */  BSP_LedsSet(0x0000);  while (1)  {    /* Wait 5 seconds */    Delay(5000);    /* Quick flash to show we're alive */    BSP_LedsSet(0xffff);    Delay(20);    BSP_LedsSet(0x0000);  }}
开发者ID:CarmeloRangel,项目名称:EFM32WG_DK3850,代码行数:36,


示例5: LEUART_BaudrateGet

/***************************************************************************//** * @brief *   Get current baudrate for LEUART. * * @details *   This function returns the actual baudrate (not considering oscillator *   inaccuracies) used by a LEUART peripheral. * * @param[in] leuart *   Pointer to LEUART peripheral register block. * * @return *   Current baudrate. ******************************************************************************/uint32_t LEUART_BaudrateGet(LEUART_TypeDef *leuart){  uint32_t          freq;  CMU_Clock_TypeDef clock;  /* Get current frequency */  if (leuart == LEUART0)  {    clock = cmuClock_LEUART0;  }#if (LEUART_COUNT > 1)  else if (leuart == LEUART1)  {    clock = cmuClock_LEUART1;  }#endif  else  {    EFM_ASSERT(0);    return 0;  }  freq = CMU_ClockFreqGet(clock);  return LEUART_BaudrateCalc(freq, leuart->CLKDIV);}
开发者ID:Rajusr70,项目名称:makersguide,代码行数:40,


示例6: 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;  palClockSetup(cmuClock_LFA);  /* Set the prescaler. */  CMU_ClockDivSet( cmuClock_RTC, cmuClkDiv_2 );    /* 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) & _RTC_COMP0_MASK );#ifndef INCLUDE_PAL_GPIO_PIN_AUTO_TOGGLE_HW_ONLY  /* Enable interrupt */  NVIC_EnableIRQ(RTC_IRQn);  RTC_IntEnable(RTC_IEN_COMP0);#endif  RTC_CounterReset();  /* Start Counter */  RTC_Enable(true);}
开发者ID:JeffreyThijs94,项目名称:dash7-ap-open-source-stack,代码行数:35,


示例7: OS_CPU_SysTickClkFreq

/***************************************************************************//** *                         OS_CPU_SysTickClkFreq() * @brief      Get system tick clock frequency. * * @param[in]  none * @exception  none * @return     Clock frequency (of system tick). * ******************************************************************************/CPU_INT32U  OS_CPU_SysTickClkFreq (void){  CPU_INT32U  freq;  freq = CMU_ClockFreqGet(cmuClock_HFPER);  return (freq);}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:16,


示例8: main

/**************************************************************************//** * @brief  Main function *****************************************************************************/int main(void){  /* Chip revision alignment and errata fixes */  CHIP_Init();  /* Initialize DK board register access */  BSP_Init(BSP_INIT_DEFAULT);  /* If first word of user data page is non-zero, enable eA Profiler trace */  BSP_TraceProfilerSetup();  /* Setup SysTick Timer for 1 msec interrupts  */  if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000))  {    while (1) ;  }  /* Blink forever */  while (1)  {    /* Blink user leds on DVK board */    BSP_LedsSet(0x00ff);    Delay(200);    /* Blink user leds on DVK board */    BSP_LedsSet(0xff00);    Delay(200);  }}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:32,


示例9: 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,


示例10: GUI_X_Delay

/***************************************************************************//***     @brief*        is used to stop code execution for specified time*     @param[in] ms*        contains number of miliseconds to suspend program. Maximum allowed*        value is 10000 (10 seconds).*     @details*        This routine could enter into EM1 or EM2 mode to reduce power*        consumption. If touch panel is not pressed EM2 is executed, otherwise*        due to fact that ADC requires HF clock, only EM1 is enabled. This*        function is also used to handle joystick state and move cursor*        according to it. In addition it could also reinitialize LCD if*        previously Advanced Energy Monitor screen was active. ******************************************************************************/void GUI_X_Delay(int ms){  volatile uint32_t now;  uint32_t startTime, waitTime;  if ( BSP_RegisterRead( &BC_REGISTER->UIF_AEM) != BC_UIF_AEM_EFM)  {    /* Switched to Advanced Energy Monitor, LCD will need to be reinitialized */    aemMode = true;  }  else if( aemMode )  {    /* Switched back from Advanced Energy Monitor, reinitialize LCD  */    aemMode = false;    PLOT_DisplayInit();  }  if ( ms > 0 )  {    waitTime = ms * (CMU_ClockFreqGet(cmuClock_CORE) / 1000);    /* Enable DWT and make sure CYCCNT is running. */    CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;    DWT->CTRL        |= 1;    startTime = DWT->CYCCNT;    do    {      now = DWT->CYCCNT;    } while ( ( now - startTime ) < waitTime );  }}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:46,


示例11: ADC_TimebaseCalc

/***************************************************************************//** * @brief *   Calculate timebase value in order to get a timebase providing at least 1us. * * @param[in] hfperFreq Frequency in Hz of reference HFPER clock. Set to 0 to *   use currently defined HFPER clock setting. * * @return *   Timebase value to use for ADC in order to achieve at least 1 us. ******************************************************************************/uint8_t ADC_TimebaseCalc(uint32_t hfperFreq){  if (!hfperFreq)  {    hfperFreq = CMU_ClockFreqGet(cmuClock_HFPER);    /* Just in case, make sure we get non-zero freq for below calculation */    if (!hfperFreq)    {      hfperFreq = 1;    }  }#if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)  /* Handle errata on Giant Gecko, max TIMEBASE is 5 bits wide or max 0x1F */  /* cycles. This will give a warmp up time of e.g. 0.645us, not the       */  /* required 1us when operating at 48MHz. One must also increase acqTime  */  /* to compensate for the missing clock cycles, adding up to 1us in total.*/  /* See reference manual for details. */  if( hfperFreq > 32000000 )  {    hfperFreq = 32000000;  }#endif  /* Determine number of HFPERCLK cycle >= 1us */  hfperFreq += 999999;  hfperFreq /= 1000000;  /* Return timebase value (N+1 format) */  return (uint8_t)(hfperFreq - 1);}
开发者ID:andachen07,项目名称:HRSCeres,代码行数:40,


示例12: TimerInit

/************************************************************************************//**** /brief     Initializes the timer.** /return    none.******************************************************************************************/void TimerInit(void){  /* configure the SysTick timer for 1 ms period */  SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000);  /* reset the millisecond counter */  TimerSet(0);} /*** end of TimerInit ***/
开发者ID:x893,项目名称:OpenBLT,代码行数:12,


示例13: USBTIMER_Init

/***************************************************************************//** * @brief *   Activate the hardware timer used to pace the 1 millisecond timer system. * * @details *   Call this function whenever the HFPERCLK frequency is changed. *   This function is initially called by HOST and DEVICE stack xxxx_Init() *   functions. ******************************************************************************/void USBTIMER_Init( void ){  uint32_t freq;  TIMER_Init_TypeDef timerInit     = TIMER_INIT_DEFAULT;  TIMER_InitCC_TypeDef timerCCInit = TIMER_INITCC_DEFAULT;  freq = CMU_ClockFreqGet( cmuClock_HFPER );  ticksPrMs = ( freq + 500 ) / 1000;  ticksPr1us = ( freq + 500000 ) / 1000000;  ticksPr10us = ( freq + 50000 ) / 100000;  ticksPr100us = ( freq + 5000 ) / 10000;  timerCCInit.mode = timerCCModeCompare;  CMU_ClockEnable( TIMER_CLK, true );  TIMER_TopSet( TIMER, 0xFFFF );  TIMER_InitCC( TIMER, 0, &timerCCInit );  TIMER_Init( TIMER, &timerInit );#if ( NUM_QTIMERS > 0 )  TIMER_IntClear( TIMER, 0xFFFFFFFF );  TIMER_IntEnable( TIMER, TIMER_IEN_CC0 );  TIMER_CompareSet( TIMER, 0, TIMER_CounterGet( TIMER ) + ticksPrMs );  NVIC_ClearPendingIRQ( TIMER_IRQ );  NVIC_EnableIRQ( TIMER_IRQ );#endif /* ( NUM_QTIMERS > 0 ) */}
开发者ID:EnergyMicro,项目名称:usb,代码行数:35,


示例14: USART_BaudrateSyncSet

/***************************************************************************//** * @brief *   Configure USART operating in synchronous mode to use a given baudrate *   (or as close as possible to specified baudrate). * * @details *   The configuration will be set to use a baudrate <= the specified baudrate *   in order to ensure that the baudrate does not exceed the specified value. * *   Fractional clock division is suppressed, although the HW design allows it. *   It could cause half clock cycles to exceed specified limit, and thus *   potentially violate specifications for the slave device. In some special *   situations fractional clock division may be useful even in synchronous *   mode, but in those cases it must be directly adjusted, possibly assisted *   by USART_BaudrateCalc(): * * @param[in] usart *   Pointer to USART peripheral register block. (Cannot be used on UART *   modules.) * * @param[in] refFreq *   USART reference clock frequency in Hz that will be used. If set to 0, *   the currently configured reference clock is assumed. * * @param[in] baudrate *   Baudrate to try to achieve for USART. ******************************************************************************/void USART_BaudrateSyncSet(USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate){  uint32_t clkdiv;  /* Inhibit divide by 0 */  EFM_ASSERT(baudrate);  /*   * We want to use integer division to avoid forcing in float division   * utils, and yet keep rounding effect errors to a minimum.   *   * CLKDIV in synchronous mode is given by:   *   * CLKDIV = 256 * (fHFPERCLK/(2 * br) - 1)   * or   * CLKDIV = (256 * fHFPERCLK)/(2 * br) - 256 = (128 * fHFPERCLK)/br - 256   *   * The basic problem with integer division in the above formula is that   * the dividend (128 * fHFPERCLK) may become higher than max 32 bit   * integer. Yet, we want to evaluate dividend first before dividing in   * order to get as small rounding effects as possible. We do not want   * to make too harsh restrictions on max fHFPERCLK value either.   *   * One can possibly factorize 128 and br. However, since the last   * 6 bits of CLKDIV are don't care, we can base our integer arithmetic   * on the below formula without loosing any extra precision:   *   * CLKDIV / 64 = (2 * fHFPERCLK)/br - 4   *   * and calculate 1/64 of CLKDIV first. This allows for fHFPERCLK   * up to 2GHz without overflowing a 32 bit value!   */  /* HFPERCLK used to clock all USART/UART peripheral modules */  if (!refFreq)  {    refFreq = CMU_ClockFreqGet(cmuClock_HFPER);  }  /* Calculate and set CLKDIV with fractional bits */  clkdiv  = 2 * refFreq;  clkdiv += baudrate - 1;  clkdiv /= baudrate;  clkdiv -= 4;  clkdiv *= 64;  /* Make sure we don't use fractional bits by rounding CLKDIV */  /* up (and thus reducing baudrate, not increasing baudrate above */  /* specified value). */  clkdiv += 0xc0;  clkdiv &= 0xffffff00;  /* Verify that resulting clock divider is within limits */  EFM_ASSERT(clkdiv <= _USART_CLKDIV_MASK);  /* If EFM_ASSERT is not enabled, make sure we don't write to reserved bits */  clkdiv &= _USART_CLKDIV_DIV_MASK;  usart->CLKDIV = clkdiv;}
开发者ID:rolandvs,项目名称:network_tester,代码行数:86,


示例15: delayUs

/**************************************************************************//** * @brief Microsecond delay function * @param[in] usec Delay in microseconds *****************************************************************************/static void delayUs( uint32_t usec ){  uint64_t totalTicks;  totalTicks = (((uint64_t)CMU_ClockFreqGet(cmuClock_CORE)*usec)+500000)/1000000;  delayTicks( totalTicks );}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:12,


示例16: initClocks

/* Initialize clock settings */void initClocks(void) {  /* Configure for 48MHz HFXO operation of core clock */  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);   /* Enable SysTick interrupt, used by GUI software timer */  if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000)) while (1);}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:9,


示例17: timer_init

int timer_init(tim_t dev, unsigned long freq, timer_cb_t callback, void *arg){    TIMER_TypeDef *pre, *tim;    /* test if given timer device is valid */    if (dev >= TIMER_NUMOF) {        return -1;    }    /* save callback */    isr_ctx[dev].cb = callback;    /* get timers */    pre = timer_config[dev].prescaler.dev;    tim = timer_config[dev].timer.dev;    /* enable clocks */    CMU_ClockEnable(cmuClock_HFPER, true);    CMU_ClockEnable(timer_config[dev].prescaler.cmu, true);    CMU_ClockEnable(timer_config[dev].timer.cmu, true);    /* reset and initialize peripherals */    EFM32_CREATE_INIT(init_pre, TIMER_Init_TypeDef, TIMER_INIT_DEFAULT,        .conf.enable = false,        .conf.prescale = timerPrescale1    );    EFM32_CREATE_INIT(init_tim, TIMER_Init_TypeDef, TIMER_INIT_DEFAULT,        .conf.enable = false,        .conf.clkSel = timerClkSelCascade    );    TIMER_Reset(tim);    TIMER_Reset(pre);    TIMER_Init(tim, &init_tim.conf);    TIMER_Init(pre, &init_pre.conf);    /* configure the prescaler top value */    uint32_t freq_timer = CMU_ClockFreqGet(timer_config[dev].prescaler.cmu);    uint32_t top = (        freq_timer / TIMER_Prescaler2Div(init_pre.conf.prescale) / freq) - 1;    TIMER_TopSet(pre, top);    TIMER_TopSet(tim, 0xffff);    /* enable interrupts for the channels */    TIMER_IntClear(tim, TIMER_IFC_CC0 | TIMER_IFC_CC1 | TIMER_IFC_CC2);    TIMER_IntEnable(tim, TIMER_IEN_CC0 | TIMER_IEN_CC1 | TIMER_IEN_CC2);    NVIC_ClearPendingIRQ(timer_config[dev].irq);    NVIC_EnableIRQ(timer_config[dev].irq);    /* start the timers */    TIMER_Enable(tim, true);    TIMER_Enable(pre, true);    return 0;}
开发者ID:basilfx,项目名称:EFM2Riot,代码行数:58,


示例18: main

/**************************************************************************//** * @brief  Main function *****************************************************************************/int main(void){  uint16_t *frameBuffer;  bool     redraw;  /* Configure for 48MHz HFXO operation of core clock */  CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);  /* Setup SysTick Timer for 1 msec interrupts  */  if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000))  {    while (1) ;  }  /* Initialize EBI banks (Board Controller, external PSRAM, ..) */  BSP_Init(BSP_INIT_DEFAULT);  /* If first word of user data page is non-zero, enable eA Profiler trace */  BSP_TraceProfilerSetup();  /* Indicate we are waiting for AEM button state enable EFM32GG */  BSP_LedsSet(0x8001);  while (BSP_RegisterRead(&BC_REGISTER->UIF_AEM) != BC_UIF_AEM_EFM)  {    /* Show a short "strobe light" on DK LEDs, indicating wait */    BSP_LedsSet(0x8001);    Delay(200);    BSP_LedsSet(0x4002);    Delay(50);  }  /* Set frame buffer start address */  frameBuffer = (uint16_t *) EBI_BankAddress(EBI_BANK2);  /* Loop demo forever */  while (1)  {    redraw = TFT_DirectInit(&tftInit);    if (redraw)    {      /* Inidicate that we are in active drawing mode */      BSP_LedsSet(0x0000);      /* Update frame buffer */      TFT_DrawScreen(frameBuffer);      /* Wait slightly before next update */      Delay(100);    }    else    {      /* Sleep - no need to update display */      BSP_LedsSet(0x8001);      Delay(200);    }  }}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:60,


示例19: clock_init

void clock_init( ){	u_long nirq_Priority = 0;	current_clock = 0;	/* Setup SysTick Timer for 1 msec interrupts  */	if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000)) while (1) ;	nirq_Priority = NVIC_EncodePriority(INT_SYSTICK_nIRQ_GROUP, INT_SYSTICK_nIRQ_PREP, INT_SYSTICK_nIRQ_SUBP);	NVIC_SetPriority(SysTick_IRQn, nirq_Priority);}
开发者ID:zoulincheng,项目名称:stm32chip_project,代码行数:9,


示例20: setupTIMER

void setupTIMER( void ){	TIMER_Init_TypeDef init = TIMER_INIT_DEFAULT;	init.mode = timerModeUpDown;	TIMER_TopSet( TIMER0, CMU_ClockFreqGet(cmuClock_HFPER) / 22050 );	TIMER_Init( TIMER0, &init );}
开发者ID:havardh,项目名称:bitless,代码行数:10,


示例21: delayMs

/**************************************************************************//** * @brief Millisecond delay function * @param[in] usec Delay in milliseconds *****************************************************************************/static void delayMs( uint32_t msec ){  uint64_t totalTicks;  BITMAP_USBHandler();  totalTicks = (((uint64_t)CMU_ClockFreqGet(cmuClock_CORE)*msec)+500)/1000;  delayTicks( totalTicks );}
开发者ID:EnergyMicro,项目名称:EFM32LG_DK3650,代码行数:14,


示例22: init_analog_switches

static void init_analog_switches(void){  CMU_ClockEnable(cmuClock_GPIO, true);  CMU_ClockEnable(cmuClock_TIMER1, true);  port_init(analog_switches, sizeof(analog_switches)/sizeof(port_init_t));  TIMER_Init(T2_TIMER, & t2_timer_init);  TIMER_InitCC(T2_TIMER, T2_TIMER_CC, & t2_timer_cc_init);  T2_TIMER->ROUTE = TIMER_ROUTE_CC1PEN | (T2_TIMER_LOC << _TIMER_ROUTE_LOCATION_SHIFT);  T2_TIMER->CTRL |= TIMER_CTRL_RSSCOIST;  uint16_t t1_to_t2_delay = ROUND_F_TO_I(T1_TO_T2_DELAY * CMU_ClockFreqGet(cmuClock_TIMER1));  uint16_t timer_max_count = ROUND_F_TO_I((T1_TO_T2_DELAY + T2_PULSE_TIME) * CMU_ClockFreqGet(cmuClock_TIMER1));#if 0  printf("t1_to_t2_delay:  %" PRIu16 "/r/n", t1_to_t2_delay);  printf("timer_max_count: %" PRIu16 "/r/n", timer_max_count);#endif  TIMER_CompareSet(T2_TIMER, T2_TIMER_CC, t1_to_t2_delay);  TIMER_TopSet(T2_TIMER, timer_max_count);}
开发者ID:brouhaha,项目名称:eyeopener,代码行数:21,


示例23: 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,


示例24: hw_busy_wait

void hw_busy_wait(int16_t microseconds){    // note: uses core debugger cycle counter mechanism for now,    // may switch to timer later if more accuracy is needed.    uint32_t counter = microseconds * (CMU_ClockFreqGet(cmuClock_CORE) / 1000000);    CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;    DWT->CTRL        |= 1;    DWT->CYCCNT       = 0;    while (DWT->CYCCNT < counter) ;}
开发者ID:JeffreyThijs94,项目名称:dash7-ap-open-source-stack,代码行数:12,


示例25: USART_BaudrateSyncSet

/***************************************************************************//** * @brief *   Configure USART operating in synchronous mode to use a given baudrate *   (or as close as possible to specified baudrate). * * @details *   The configuration will be set to use a baudrate <= the specified baudrate *   in order to ensure that the baudrate does not exceed the specified value. * *   Fractional clock division is suppressed, although the HW design allows it. *   It could cause half clock cycles to exceed specified limit, and thus *   potentially violate specifications for the slave device. In some special *   situations fractional clock division may be useful even in synchronous *   mode, but in those cases it must be directly adjusted, possibly assisted *   by USART_BaudrateCalc(): * * @param[in] usart *   Pointer to USART peripheral register block. (Cannot be used on UART *   modules.) * * @param[in] refFreq *   USART reference clock frequency in Hz that will be used. If set to 0, *   the currently configured reference clock is assumed. * * @param[in] baudrate *   Baudrate to try to achieve for USART. ******************************************************************************/void USART_BaudrateSyncSet(USART_TypeDef *usart, uint32_t refFreq, uint32_t baudrate){#if defined(_USART_CLKDIV_DIV_MASK) && (_USART_CLKDIV_DIV_MASK >= 0x7FFFF8UL)  uint64_t clkdiv;#else  uint32_t clkdiv;#endif  /* Inhibit divide by 0 */  EFM_ASSERT(baudrate);  /*   * CLKDIV in synchronous mode is given by:   *   * CLKDIV = 256 * (fHFPERCLK/(2 * br) - 1)   */  /* HFPERCLK used to clock all USART/UART peripheral modules */  if (!refFreq)  {    refFreq = CMU_ClockFreqGet(cmuClock_HFPER);  }#if defined(_USART_CLKDIV_DIV_MASK) && (_USART_CLKDIV_DIV_MASK >= 0x7FFFF8UL)  /* Calculate and set CLKDIV without fractional bits */  clkdiv = 2 * baudrate;  clkdiv = (0x100ULL * (uint64_t)refFreq) / clkdiv;  /* Round up by not subtracting 256 and mask off fractional part */  clkdiv &= ~0xFF;#else  /* Calculate and set CLKDIV with fractional bits */  clkdiv  = 2 * refFreq;  clkdiv += baudrate - 1;  clkdiv /= baudrate;  clkdiv -= 4;  clkdiv *= 64;  /* Make sure we don't use fractional bits by rounding CLKDIV */  /* up (and thus reducing baudrate, not increasing baudrate above */  /* specified value). */  clkdiv += 0xc0;  clkdiv &= 0xffffff00;#endif  /* Verify that resulting clock divider is within limits */  EFM_ASSERT(!(clkdiv & ~_USART_CLKDIV_DIV_MASK));  /* If EFM_ASSERT is not enabled, make sure we don't write to reserved bits */  clkdiv &= _USART_CLKDIV_DIV_MASK;  BUS_RegMaskedWrite(&usart->CLKDIV, _USART_CLKDIV_DIV_MASK, clkdiv);}
开发者ID:1847123212,项目名称:USB-voltmeter,代码行数:79,


示例26: I2C_BusFreqGet

/***************************************************************************//** * @brief *   Get current configured I2C bus frequency. * * @details *   This frequency is only of relevance when acting as master. * * @param[in] i2c *   Pointer to I2C peripheral register block. * * @return *   Current I2C frequency in Hz. ******************************************************************************/uint32_t I2C_BusFreqGet(I2C_TypeDef *i2c){  uint32_t freqHfper;  uint32_t n;  /* Max frequency is given by freqScl = freqHfper/((Nlow + Nhigh)(DIV + 1) + I2C_CR_MAX)   * More details can be found in the reference manual,   * I2C Clock Generation chapter. */  freqHfper = CMU_ClockFreqGet(cmuClock_HFPER);  /* n = Nlow + Nhigh */  n        = (uint32_t)(i2cNSum[(i2c->CTRL & _I2C_CTRL_CLHR_MASK) >> _I2C_CTRL_CLHR_SHIFT]);  return (freqHfper / ((n * (i2c->CLKDIV + 1)) + I2C_CR_MAX));}
开发者ID:Engimusing,项目名称:engimusing-firmware,代码行数:27,


示例27: main

/**************************************************************************//** * @brief  Main function *****************************************************************************/int main(void){  /* Chip revision alignment and errata fixes */  CHIP_Init();  /* Initialize DVK board register access */  BSP_Init(BSP_INIT_DEFAULT);  /* If first word of user data page is non-zero, enable eA Profiler trace */  BSP_TraceProfilerSetup();  /* Setup SysTick Timer for 1 msec interrupts  */  if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000))  {    while (1) ;  }  /* "Silly" loop that just enables peripheral access to the EFM32, and then   * disables them again. Verify that DVK LEDs light up when access is enabled */  while (1)  {    BSP_PeripheralAccess(BSP_POTMETER, true); Delay(500);    BSP_PeripheralAccess(BSP_AMBIENT, true); Delay(500);    BSP_PeripheralAccess(BSP_IRDA, true); Delay(500);    BSP_PeripheralAccess(BSP_AUDIO_OUT, true); Delay(500);    BSP_PeripheralAccess(BSP_AUDIO_IN, true); Delay(500);    BSP_PeripheralAccess(BSP_ANALOG_SE, true); Delay(500);    BSP_PeripheralAccess(BSP_ANALOG_DIFF, true); Delay(500);    BSP_PeripheralAccess(BSP_RS232B, true); Delay(500);    BSP_PeripheralAccess(BSP_RS232A, true); Delay(500);    BSP_PeripheralAccess(BSP_ACCEL, true); Delay(500);    BSP_PeripheralAccess(BSP_SPI, true); Delay(500);    BSP_PeripheralAccess(BSP_I2C, true); Delay(500);    BSP_PeripheralAccess(BSP_POTMETER, false); Delay(500);    BSP_PeripheralAccess(BSP_AMBIENT, false); Delay(500);    BSP_PeripheralAccess(BSP_IRDA, false); Delay(500);    BSP_PeripheralAccess(BSP_AUDIO_OUT, false); Delay(500);    BSP_PeripheralAccess(BSP_AUDIO_IN, false); Delay(500);    BSP_PeripheralAccess(BSP_ANALOG_SE, false); Delay(500);    BSP_PeripheralAccess(BSP_ANALOG_DIFF, false); Delay(500);    BSP_PeripheralAccess(BSP_RS232B, false); Delay(500);    BSP_PeripheralAccess(BSP_RS232A, false); Delay(500);    BSP_PeripheralAccess(BSP_ACCEL, false); Delay(500);    BSP_PeripheralAccess(BSP_SPI, false); Delay(500);    BSP_PeripheralAccess(BSP_I2C, false); Delay(500);  }}
开发者ID:AndreMiras,项目名称:EFM32-Library,代码行数:51,



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


C++ CMU_ClockSelectSet函数代码示例
C++ CMU_ClockEnable函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。