#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void vTaskFunction( void * pvParameters );
const char * pcTextForTask1 = "Task 1 is running\n";
const char * pcTextForTask2 = "Task 2 is running\n";
void app_main( void )
{
xTaskCreate( vTaskFunction, /* Pointer to the function that implements the task. */
"Task 1", /* Text name for the task. This is to facilitate debugging only. */
2048, /* Stack depth - most small microcontrollers will use much less stack than this. */
( void * ) pcTextForTask1, /* Pass the text to be printed in as the task parameter. */
2, /* This task will run at priority 1. */
NULL ); /* We are not using the task handle. */
xTaskCreate( vTaskFunction, "Task 2", 2048, ( void * ) pcTextForTask2, 3, NULL );
// vTaskStartScheduler();
// for( ; ; )
// {
// vTaskDelay(portMAX_DELAY);
// // vTaskDelay(1000 / portTICK_PERIOD_MS);
// }
}
/*-----------------------------------------------------------*/
void vTaskFunction( void * pvParameters )
{
char * pcTaskName;
TickType_t xLastWakeTime; //
const TickType_t xDelay250ms = pdMS_TO_TICKS( 250UL );
pcTaskName = ( char * ) pvParameters;
xLastWakeTime = xTaskGetTickCount(); //
for( ; ; )
{
// vPrintString( pcTaskName );
// printf(pcTaskName);
printf("%s", pcTaskName);
fflush(stdout);
// vTaskDelay( xDelay250ms );
vTaskDelayUntil( &xLastWakeTime, xDelay250ms );
}
}