Can't understand what example does


Can anybody explain what the following example, from FreeRTOS Demos, does, please:

I do not understand:

  1. Why vStartLEDFlashTasks always generates 8 tasks. I do not see task suspend or another exit from for();
  2. How pvParameters passes from vStartLEDFlashTasks to vLEDFlashTask ?. Without any sync vLEDFlashTask can operate with gabage in heap, I think
  1. Why 8 ? Because it’s just an example with 8 tasks defined by uxNumOfLEDs :wink:
    Also vStartLEDFlashTasks is just an init function called by e.g. main.
    Why should it suspend a / the calling task ?
  2. Each LED task instance gets it’s own unique xLEDParameters struct (allocated from heap). That’s perfectly right.

But maybe I didn’t get your point.

Sorry In fact I see garbadge in my port, and I was mistake about 1 point
And this is about 2 point and vParTestToggleLED function

That is a very old demo file which I think, if I recall correctly, served two purposes:

1: have some LEDs flashing in the board for visual confirmation the scheduler was running and with roughly the right frequency tick.

2: demonstrate creating multiple instances of the same task, along with the task parameter.

Thanks to all!
Now I understand!