1.systick_config, 建立1ms(可以改)的系统时钟,包含计数值, 初始值,中断
2. 计数值 SystemCoreClock,对于STM32F4xx 系统时钟为168M, 那么假如168M为1S, /1000为1ms, /1000000为1us
3. SysTick_Handler,为对应的中断处理函数
/*
\brief configure systick
\param[in] none
\param[out] none
\retval none
/
void systick_config(void)
{
/ setup systick timer for 1000Hz interrupts /
if(SysTick_Config(SystemCoreClock/(1000))) //1ms
{
while(1);
}
/ 滴答定时器时钟源为AHB的1/8,同时转化为us */
usTick = SystemCoreClock / 1000000;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}
void SysTick_Handler(void)
{
static uint8_t timer_100ms = 0;
delay_decrement();
//Clk_1msCnt();
if(timer_1ms++ > 255)
{
timer_1ms = 0;
}
if(timer_100ms++ == 100)
{
TenHZTimerFunction();
timer_100ms = 0;
}
}