FreeRTOS里的Tick定时器在哪里配置的
Posted 快乐的老鼠
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FreeRTOS里的Tick定时器在哪里配置的相关的知识,希望对你有一定的参考价值。
int main(void)
{
nvic_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);
xTaskCreate(GUI_Task, "GUI_Task", configMINIMAL_STACK_SIZE * 8, NULL, tskIDLE_PRIORITY + 1, NULL);
/* start scheduler */
vTaskStartScheduler();
while (1) {
}
}
FreeRTOS10.1版本
从main函数看非常的简洁以至于我都不知道在哪儿开启了Tick定时器
跟踪vTaskStartScheduler() -> vPortSetupTimerInterrupt()
void vPortSetupTimerInterrupt( void )
{
/* Calculate the constants required to configure the tick interrupt. */
#if( configUSE_TICKLESS_IDLE == 1 )
{
ulTimerCountsForOneTick = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ );
xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;
ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );
}
#endif /* configUSE_TICKLESS_IDLE */
/* Stop and clear the SysTick. */
portNVIC_SYSTICK_CTRL_REG = 0UL;
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;
/* Configure SysTick to interrupt at the requested rate. */
portNVIC_SYSTICK_LOAD_REG = ( configSYSTICK_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;
portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT );
}
以上是关于FreeRTOS里的Tick定时器在哪里配置的的主要内容,如果未能解决你的问题,请参考以下文章