/* Standard includes */ #include // prototype declarations for I/O functions /* Scheduler includes */ #include "FreeRTOS.h" #include "task.h" void prvTaskA (void* pvParameters) { (void) pvParameters; // Just to stop compiler warnings. for (;;) { vTaskDelay(500); printf("Task A\n"); //vTaskDelay(500); } } void prvTaskB (void* pvParameters) { (void) pvParameters; // Just to stop compiler warnings. for (;;) { printf("Task B\n"); vTaskDelay(1000); } } int main (void) { portTickType xNextWakeTime; xNextWakeTime = xTaskGetTickCount(); xTaskCreate( prvTaskA, ( signed char * ) "TaskA", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); xTaskCreate( prvTaskB, ( signed char * ) "TaskB", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); vTaskStartScheduler(); //should never get here printf("ERORR: vTaskStartScheduler returned!"); for (;;); } void vApplicationIdleHook( void ) { const unsigned long ulMSToSleep = 5; /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are tasks waiting to be terminated by the idle task. */ Sleep( ulMSToSleep ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { /* Can be implemented if required, but probably not required in this environment and running this demo. */ } /*-----------------------------------------------------------*/ void vApplicationStackOverflowHook( void ) { /* Can be implemented if required, but not required in this environment and running this demo. */ } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { /* Call the periodic timer test, which tests the timer API functions that can be called from an ISR. */ // vTimerPeriodicISRTests(); } /*-----------------------------------------------------------*/ void vAssertCalled( void ) { taskDISABLE_INTERRUPTS(); for( ;; ); }