这个声明函数
void TimingDelay_Decrement(void);
void Systick_Delay(uint32_t delayTime);
void SysTick_Configuration(uint32_t Reload);
配置systick
void SysTick_Configuration(uint32_t Reload)
{
/*before initializtion,disable systick timer*/
SYSTICK_Cmd (FALSE);
SYSTICK_Reload_Config(Reload);
/*write ST_CV any valer,clear ST_CV*/
SYSTICK_Counter_Updata();
/*select SCLK as the clock source of the system tick timer */
SYSTICK_Clock_Config(SYSTICK_SYS_CLOCK_DIV_1);
/*enable system timer IRQ&interrupt flag*/
SYSTICK_Systick_INT_Enable(TRUE);
/*Configuration system timer Interrupt Priority*/
INT_Interrupt_Priority_Config(INT_SysTick,2,0);
/*enable systick timer*/
SYSTICK_Cmd(TRUE);
/*enable system timer Interrupt*/
INT_Interrupt_Enable(INT_SysTick,TRUE);
INT_All_Enable (TRUE);
}
void TimingDelay_Decrement(void)
{
if (TimingDelay != 0x00)
{
TimingDelay--;
}
}
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] :Inserts a delay time.
* @param in : delayTime: specifies the delay time length, in milliseconds.
* @param out :None
* @retval :None
*/
void Systick_Delay(uint32_t delayTime)
{
TimingDelay = delayTime;
while(TimingDelay != 0);
}
|