I am designing an I/O board based on the RP2040. One of the design requirements states that I/O terminals must be isolated hence I'm going for optocoupled I/O using something like 6N137S1 or similar.
Now, the RP2040 provides 30 multifunction software configurable GPIO. My design has 16 optocoupled digital output and 8 optocoupled digital input, leaving the rest of GPIOs available for comms and some other services.
Given the configurable nature of the RP2040 I am toying with the idea of keeping all 24 GPIO I need as multifunction.
Now the question is how to set them up in a way that the configurable GPIO circuit remains opto isolated and how to configure it as input or output.
A simple way to configure the GPIO circuit might be with micro jumpers, so jumpers in pos 1 will set the optocoupler as an output and jumpers in pos 2 will set the optocoupler as an input.
An alternative way would be to do that via software configuration of a switch or similar.
Is there any common design pattern for this use case?
What would be a good design for such a circuit?