Error: using typedef-name 'xTaskGetInfoResult' after 'struct'
ashleycox opened this issue · 1 comments
ashleycox commented
I'm trying to compile the notification example given in the documentation but am getting the error: "exit status 1 using typedef-name 'xTaskGetInfoResult' after 'struct'". My code is below but all looks correct, can anyone tell me where I'm going wrong? Compiling for an Arduino Nano with IDE 1.8.15.
#include <HeliOS_Arduino.h>
//Our first task checks the state of the mp3 player
void taskA(int id_) {
/*
Obtain the task id of task "B" using its friendly name
since it should not be assumed that task "B" will always
have a task id of 2.
Then check the status of the MP3 player
pass a 4-byte notification containing the player state to the playAudio task
*/
xTaskNotify(xTaskGetId("TASKB"), 4, "test");
} //end player state function
/*
Create the second task "B"
*/
void taskB(int id_) {
/*
Obtain the notification bytes and value from the xTaskGetInfoResult
structure by first making a call to the xTaskGetInfo() function call
using the task's id stored in id_.
*/
struct xTaskGetInfoResult* res = xTaskGetInfo(id_);
/* Because xTaskInfo() can return a null pointer, always check
that the structure's pointer is not null before accessing
its members.
*/
if (res) {
/*
res->notificationBytes contains the notification bytes
res->notificationValue contains the notification value
*/
}
/* Always call xMemFree() to free the managed memory allocated by
xTaskGetInfo();
*/
xMemFree(res);
}
void setup() {
/*
xHeliOSSetup() must be the first function call
made to initialize HeliOS and its data structures
*/
xHeliOSSetup();
/*
Declare and initialize an int to temporarily hold the
task id.
*/
int id = 0;
/*
Pass the task friendly name and function to xTaskAdd()
to add the task to HeliOS. xTaskAdd() will return a
task id greater than zero if the task is added unsuccessfully.
*/
id = xTaskAdd("TASKA", &taskA);
/*
Pass the task id of the task to set its state from stopped
to running.
*/
xTaskSart(id);
/*
Pass the task friendly name and function to xTaskAdd()
to add the task to HeliOS. xTaskAdd() will return a
task id greater than zero if the task is added unsuccessfully.
*/
id = xTaskAdd("TASKB", &taskB);
/*
Pass the task id of the task to set its state from stopped
to waiting.
*/
xTaskWait(id);
}
void loop() {
/*
Pass control to the the HeliOS scheduler. xHeliOSLoop() should
be the only code inside the microcontroller project's
main loop.
*/
xHeliOSLoop();
}
ashleycox commented
Figured it out. There is an error in the example. Changed struct xTaskGetInfoResult* res = xTaskGetInfo(id_);
to xTaskGetInfoResult res = xTaskGetInfo(id_);