Good day all

I was wanting some advice on data handling for a UAV project I am trying. My background is in Microcontrollers but I have never had exposure to "sound" programming practice, so please be forgiving :P

I have got 2 microcontrollers to drive a UAV craft I've made. One "firmware" micro collects all the sensor data and then passes it to the other "application" micro for control processing. Once decisions have been made this is sent back to the "firmware" micro so that actions are taken.

So in essence I am sharing a raw data chunk periodically between the 2 processors that has outputs and feedback data. For the moment this is captured as one big buffer array on either micro after receiving. For easier structure I thought of bouncing this buffer that contains all sensor information and control variables between the 2 processors (visualize a ping pong game with all the possible variables from both micros - bandwidth between the micros is not a limitation) There are quite a few modules that want to access information from this buffer and write control actions back to it.

I was thinking of constructing a struct on both micros to access this "raw data" from the buffer and set it up with variable names so that it is easier for functions to read info and write controls back.

But this would mean that the data is accessible to every function, and there is the fear that some functions will write to the input data or write to control variables that they should not have access to. I also need to reduce memory copies and the like due to limited memory on each micro.

Apologies for the verbose description. I would like to get a discussion going. Any feedback and suggestions would be greatly appreciated