rtel wrote on Saturday, February 04, 2012:
The code contained in timerdemo.c is very comprehensive and used also to test the timer functionality. Consequently, it loads the processor up and uses quite a lot of resources.
If you want a simple time demo then I suggest something along the following.
1) Ensure timers.h is included in your C file and timers.c is included in your build.
2) Ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h, and that the associated timers configuration constants have sensible values (they are explained here http://www.freertos.org/RTOS-software-timer.html )
3) rite a very simple callback function along the lines of:
static void prvTimerCallback( xTimerHandle xTimer );
static void prvTimerCallback( xTimerHandle xTimer )
ToggleLED(); /* However that is implemented. */
4) Create and start the timer using something like:
xTimerHandle xTimer = NULL;
xTimer = xTimerCreate( ( const signed char * ) “Timer”, /* A text name, purely to help debugging. */
( 200 / portTICK_RATE_MS ), /* The timer period in ticks, this should be 200ms )
pdTRUE, /* Auto reload the timer. */
( void * ) 0, /* The ID is not used, so can be set to anything. */
prvTimerCallback /* The callback function. */
if( xTimer != NULL )
xTimerStart( xTimer, 0 );