I create a stopwatch timer as follows:
stopwatchTimer = xTimerCreate(flshTmrStr,DUMMY_TIME_PERIOD,pdFALSE,
(void*)STOPWATCH_TIMER_ID, stopwatchCallback);
and in the task function:
stopwatchTimeExpired= pdFALSE;
xTimerChangePeriod(stopwatchTimer,delay*1000/portTICK_RATE_MS,0);
xTimerStart(stopwatchTimer,0);
while(stopwatchTimeExpired == pdFALSE)
{
//do some stuff till time expired (flag set true in timer callback)
}
in FreeRTOSConfig.h file:
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY 3
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
I’m using ATMEGA32 in WinAVR GCC compiler, thanks for your help…