That's a very kind offer! I don't want to make you rush, I'm happy to add external synchronisation for right now, but I do need to make sure I know what I'm doing.
My project has grown a few threads, for sensor averaging and for control loops, and I hadn't really thought at the time about the implications of that for the shared hardware underneath it all.
So, for example, right now I have an i2c A2D with multiple inputs, and one thread per input polling and averaging that input. Which obviously means that several threads are contending for the same i2c device, and that probably explains an intermittent hang that I have yet to investigate.
I can also fix these things by adding external synchronisation, but to do that I need to be clear about exactly which resources I need to avoid contention on.
So, for example, I presume that I need one lock for each i2c bus ? Or do I need a single lock across all the i2c APIs ?
I realise I also need to worry about thread safety for things like
.BBBAnalogInput and BBBDigitalOutput and so on. Do you have any thoughts about that ?
Thanks again,
Richard