Advice on STM32F103 GPIO port sharing
First, the "atomic" port ODR issue when more than one function or task may use the same GPIO port. Is the best thing to do ALWAYS to use BRR and/or BSRR to change the ODR values? From what I've read we need to be wary of an interrupt or other task changing an ODR value behind our backs if we are using Read-Modify-Write methods. I don't forsee painting myself into this corner, but better safe than sorry I guess.
Second "atomic" problem, what do we do about changing port configuration? If we need to switch some pins from in to out, or out to in, do we then disable interrupts while doing so? I don't see another solution.
Finally, about this input-output port re-configuration. If I want to write to a device dangling off a port, I can see that I should select one of the push-pull modes and write the data (strobing the external part as needed). To change the port to now read from it, do I select Hi-Z and then set the ODR bits high? Then strobe/read? Is there an order of occurrence or other gotcha I should be on the lookout for? Obviously I want to avoid contention on the pins and also keep the speed up.