本文整理汇总了C++中SysTick_CLKSourceConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ SysTick_CLKSourceConfig函数的具体用法?C++ SysTick_CLKSourceConfig怎么用?C++ SysTick_CLKSourceConfig使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SysTick_CLKSourceConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prvSetupHardware
static void prvSetupHardware( void )
{
/* Start with the clocks in their expected state. */
RCC_DeInit();
/* Enable HSE (high speed external clock). */
RCC_HSEConfig( RCC_HSE_ON );
/* Wait till HSE is ready. */
while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET )
{
}
/* 2 wait states required on the flash. */
*( ( unsigned long * ) 0x40022000 ) = 0x02;
/* HCLK = SYSCLK */
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
/* PCLK2 = HCLK */
RCC_PCLK2Config( RCC_HCLK_Div1 );
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config( RCC_HCLK_Div2 );
/* PLLCLK = (25MHz / 2 ) * 5 = 62.5 MHz. */
RCC_PLLConfig( RCC_PLLSource_HSE_Div2, RCC_PLLMul_5 );
/* Enable PLL. */
RCC_PLLCmd( ENABLE );
/* Wait till PLL is ready. */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Select PLL as system clock source. */
RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK );
/* Wait till PLL is used as system clock source. */
while( RCC_GetSYSCLKSource() != 0x08 )
{
}
/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );
/* Set the Vector Table base address at 0x08000000 */
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
/* Configure HCLK clock as SysTick clock source. */
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
/* Initialise the IO used for the LED outputs. */
vParTestInitialise();
}
示例2: prvSetupHardware
static void prvSetupHardware( void )
{
/* RCC system reset(for debug purpose). */
RCC_DeInit ();
/* Enable HSE. */
RCC_HSEConfig( RCC_HSE_ON );
/* Wait till HSE is ready. */
while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);
/* HCLK = SYSCLK. */
RCC_HCLKConfig( RCC_SYSCLK_Div1 );
/* PCLK2 = HCLK. */
RCC_PCLK2Config( RCC_HCLK_Div1 );
/* PCLK1 = HCLK/2. */
RCC_PCLK1Config( RCC_HCLK_Div2 );
/* ADCCLK = PCLK2/4. */
RCC_ADCCLKConfig( RCC_PCLK2_Div4 );
/* Flash 2 wait state. */
*( volatile unsigned long * )0x40022000 = 0x01;
/* PLLCLK = 8MHz * 9 = 72 MHz */
RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );
/* Enable PLL. */
RCC_PLLCmd( ENABLE );
/* Wait till PLL is ready. */
while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
/* Select PLL as system clock source. */
RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);
/* Wait till PLL is used as system clock source. */
while (RCC_GetSYSCLKSource() != 0x08);
/* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );
/* Set the Vector Table base address at 0x08000000. */
NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
/* Configure HCLK clock as SysTick clock source. */
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
/* Initialise the IO used for the LED outputs. */
vParTestInitialise();
/* SPI2 Periph clock enable */
RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE );
}
示例3: initSysTick
/* init System Ticker with 1ms ----------------------------------------------*/
void initSysTick()
{
// config for systick - delay
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
SysTick_SetReload(72000);
SysTick_ITConfig(ENABLE);
SysTick_CounterCmd(SysTick_Counter_Enable);
}
示例4: SysTick_init
void SysTick_init(void)
{
RCC_ClocksTypeDef RCC_Clocks;
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
NVIC_SetPriority(SysTick_IRQn, 0x03);
}
示例5: Delay_init
void Delay_init(uint32_t interval){
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //set clock source
SysTick->LOAD = interval; //set reload value
SysTick->VAL = 0; //set counter value to 0
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk; //set clock and enable
}
示例6: SysTick_Init
/**************************************************************************************************************
函数描述 : SysTick初始化,8分频,分频后每计1个数为0.111us
***************************************************************************************************************/
void SysTick_Init(void)
{
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //计数器时钟源 == AHB(HCLK)/8 = 72MHz/8 = 9MHz
SysTick->LOAD = 0xFFFFFE; //装载计数器初始值
SysTick->VAL = 0; //重新装载
SysTick->CTRL &= ~(SYSTICK_TICKINT<<1); //禁止中断
}
示例7: InitDelay
//SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8)
// Reload Value = SysTick Counter Clock (Hz) x Desired Time base (s)
//
// - Reload Value is the parameter to be passed for SysTick_Config() function
// - Reload Value should not exceed 0xFFFFFF
void InitDelay(__IO uint32_t BaseTime)
{
RCC_ClocksTypeDef RCC_Clocks;
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
if(SysTick_Config((uint32_t)(BaseTime*(RCC_Clocks.HCLK_Frequency))/1000000))
while(1); // capture an error
}
示例8: systick_init
/*==================================================================================
* 函 数 名: systick_init
* 参 数: None
* 功能描述: 初始化系统嘀嗒定时器
* 返 回 值: None
* 备 注: 此函数调用的SysTick_CLKSourceConfig()设定定时器的输入时钟,可是不知道为
什么更改SysTick_CLKSource_HCLK_Div8和SysTick_CLKSource_HCLK两个输入参数
,定时周期一样,有待考证。
* 作 者: gaodb
* 创建时间: 2012.10
==================================================================================*/
static void systick_init(void)
{
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
if (SysTick_Config(72000))
{
while (1);
}
}
示例9: start_timer
void start_timer() {
RCC_ClocksTypeDef RCC_Clocks;
/* Configure Systick clock source as HCLK */
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
/* SystTick configuration: an interrupt every 10ms */
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(RCC_Clocks.HCLK_Frequency / 100);
}
示例10: Delay
/********************************************************************************************
*函数名称:void Delay(u32 nTime)
*
*入口参数:u32 nTime:延时时间
*
*出口参数:无
*
*功能说明:SYSTICK滴答延时配置
*******************************************************************************************/
void Delay(u32 nTime)
{
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //时钟源选择
SysTick_Config(72000); //调置产生中断的计数个数
TimingDelay = nTime;
while(TimingDelay != 0);
}
示例11: systick_init
void systick_init(void)
{
//72MHz / 8 = 9MHz
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
SysTick -> CTRL = 0x02; //开启SysTick中断
SysTick -> LOAD = 9000; //重载值
systick_value = 0;
SYSTICK_START
}
示例12: RCC_Configuration
void RCC_Configuration(void)
{
SystemInit();
SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK );
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
// enable usb
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
}
示例13: SysTick_Initial
void SysTick_Initial(void)
{
RCC_ClocksTypeDef RCC_Clocks;
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
factor_us = SystemCoreClock/8000000;
factor_ms = factor_us * 1000;
}
示例14: delay_init
/*******************************************************************************
* Function Name : delay_init
* Description :
* Input : None
* Output : None
* Return : None
* Attention :
*******************************************************************************/
void delay_init(void)
{
RCC_ClocksTypeDef RCC_ClocksStatus;
RCC_GetClocksFreq(&RCC_ClocksStatus);
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);
SysTick_ITConfig(DISABLE);
delay_fac_us = RCC_ClocksStatus.HCLK_Frequency / 8000000;
delay_fac_ms = RCC_ClocksStatus.HCLK_Frequency / 8000;
}
示例15: SysTick_Configuration
void SysTick_Configuration(void)
{
/* Configure HCLK clock as SysTick clock source */
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
SysTick_SetReload(72000);
/* Enable the SysTick Interrupt */
SysTick_ITConfig(ENABLE);
/* Enable the SysTick Counter */
SysTick_CounterCmd(SysTick_Counter_Enable);
}