FreeRTOS and call fuctions

Hello, First I apologize for my bad english.

I need help. My project use freeRTOS code. The more simple srtructure of FreeRTOS is that (for example):


#include <Arduino_FreeRTOS.h>
void TaskBlink( void *pvParameters );

void setup(){
pinMode(5, OUTPUT);
xTaskBlink(
Blink2
, (const portCHAR *) "Blink"
, 128
, NULL
, 1
, NULL );
}

void TaskBlink(void *pvParameters){

for (;;){

// my code

}
}

Well, I need have a fuctions declared into "for(;;)" like "void first(int a)" or "int second(char *b)". And execute calls from these fuctions declared. Always, both functions as calls to these, into for(;:wink:

I have a problem becouse it doesn't allow define a fuction inside other fuction(the fuction declared for FreeRTOS structure)

I need a solution but I dont want a switch, case 0, case 1, etc becouse these system is very hard for my large code. I have, i.e, a fuction wich compares strings and I use these fuction constantly in many moments.

Thanksssss

I cannot see your code or your question because of the smileys that you did not intend to put there. Please post correctly next time.

============================================================================
To post code and/or error messages:

  1. Use CTRL-T in the Arduino IDE to autoformat your code.
  2. Paste the autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.
  3. Paste the complete error message between code tags (the </> button)
    so that we can easily see and deal with your messages.

Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.

If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a photograph of the wiring.

Good Luck!

In general programming for C or C++, functions should be declared in a .h file and defined in a .c or .cpp file.

In the Arduino world, the IDE creates and provides the declaration of the functions (most of the time) and you provide the definition in your .ino or .pde file. In your case, you appear to have provided both the declaration and the definition in some file. This should be satisfactory.

What is your question? What error message did you get? How did you use pvParameters? Where is the loop() function?

wargadex:
I have a problem because it doesn't allow [me to] define a fuction inside [an]other fuction.

I don't understand why you think you need to define a function inside another function.

If you want a set of functions that can share data but don't share that data with other functions you can put them in a separate .cpp source file and use the 'static' keyword on the global variables to keep them local to that file.

Did you try to create a regular global C function and call it from within your RTOS task?

johnwasser:
I don't understand why you think you need to define a function inside another function.

If you want a set of functions that can share data but don't share that data with other functions you can put them in a separate .cpp source file and use the 'static' keyword on the global variables to keep them local to that file.

Yes, I thinked in this option. Thanks, but at the moment I am following research any extra solution.

Thans so much

KeithRB:
Did you try to create a regular global C function and call it from within your RTOS task?

I dont know about regular global c fuction. However I am going to investigate about that. Can you givem a easy example?

Thanks so much

Just a regular C function, just like TaskBlink() in your example.

But be careful, if you have too many tasks with a lot of function levels you can run out of RAM really fast since each task will require a separate stack.