主要介绍空闲钩子函数的基本使用。
windows VS2012 调试效果:
1、头文件定义及启动任务
#include "FreeRTOS.h"
#include "task.h"
#include "supporting_functions.h"
void vTaskFunction( void *pvParameters );
static uint32_t ulIdleCycleCount = 0UL;
const char *pcTextForTask1 = "Task 1 is running\r\n";
const char *pcTextForTask2 = "Task 2 is running\r\n";
int main( void )
{
// 创建任务
xTaskCreate( vTaskFunction, "Task 1", 1000, (void*)pcTextForTask1, 1, NULL );
xTaskCreate( vTaskFunction, "Task 2", 1000, (void*)pcTextForTask2, 2, NULL );
// 开始调度任务
vTaskStartScheduler();
for( ;; );
return 0;
}