I have a simple single task FreeRTOS application which can turn the built in LED on and off. This works perfectly if the values of the pin number and the on/off period are hard coded with the task.
I now want to use multiple instances of a single task to control multiple digital outputs and so I am passing a pin number and on/off period as a strut input to the task. The struct is defined as below:
struct beacon_params {
TickType_t cycleTime;
uint8_t pinNumber;
};
When the task method is called, the first member of the struct has the correct value, the second does not have the correct value. If I swap the order of the elements of the struct, then what is now the first parameter is correct.
The issue is the same on Micro, Uno and Mega 2560 and whether I use Visual Studio with VMicro extension or the Arduino UI.
The issue is something to do with alignment of the struct elements but I can't seem to get any pragmas or compiler options to get both parameters into the beacon task function with the correct value.
Any help / suggestions would be very much apreciated.
The complete sketch is attached and the required and actual value are written to the serial port during sketch exection.
struct-issue.ino (1.69 KB)