Multiple timers

The functionality to have an array of timers is extremely valuable. However the example posted in timers.h has an error.

The original contains the following code to create a timer. This will attempt to create a timer with a tick period of 0, which will generate an error.

  for( x = 0; x < NUM_TIMERS; x++ )
  {
    xTimers[ x ] = xTimerCreate( "Timer",       // Just a text name, not used by the kernel.
                                 ( 100 * x ),   // The timer period in ticks.
                                 pdTRUE,        // The timers will auto-reload themselves when they expire.
                                 ( void * ) x,  // Assign each timer a unique id equal to its array index.
                                 vTimerCallback // Each timer calls the same callback when it expires.
                               );

The code should be

  for( x = 0; x < NUM_TIMERS; x++ )
  {
    xTimers[ x ] = xTimerCreate( "Timer",       // Just a text name, not used by the kernel.
                                 ( 100 * (x+1) ),   // The timer period in ticks.
                                 pdTRUE,        // The timers will auto-reload themselves when they expire.
                                 ( void * ) x,  // Assign each timer a unique id equal to its array index.
                                 vTimerCallback // Each timer calls the same callback when it expires.
                               );

Thank you for reporting this. Fixed in this PR - Fix code example in timers.h by aggarg · Pull Request #412 · FreeRTOS/FreeRTOS-Kernel · GitHub