I need to pass an array of tasks
structs to the Loop_Task()
function, but I have already defined each task. An error occurred when forming the tasks
array,
This is the code for defining the struct task
:
static __code DynamicLED_Params params1={hello,8,1,20};
static __code DynamicLED_Params params2={kunkun,8,8,15};
static LoopFunction_t dmled1 ={Dynamic_MatrixLED,¶ms1,END};
static LoopFunction_t dmled2 ={Dynamic_MatrixLED,¶ms2,END};
static __code UartControl_Params uart_params={{&dmled1,&dmled2},2};
static LoopFunction_t uart_task ={Uart1_MainFunction,&uart_params,RUNNING};
This is the code for defining struct array tasks
:
static __code LoopFunction_t tasks[] =
{
dmled1,
dmled2,
uart_task
};
This is a compile-time error message, always saying that I don’t have curly braces:
src\main.c:33: error 69: struct/union/array 'tasks': initialization needs curly braces
Why is that happening? I have tried many methods and keep getting errors