Set a pin to HIGH/LOW for a Multiplexer

Hi,

I have multiple UART devices I want to connect to PX4, all to the same UART port (Serial 4; /dev/ttyS3). To do so, I also have a [Multiplexer], which requires me to set a pin to LOW or HIGH depending on which UART device I want to read from.

According to the [FMUv5_stm32_pinout] and the [Pixhawk4-Pinout] there is another I2C port on the same connector. Therefore, I want to utilize said I2C to set the selection pin of the Multiplexer to either LOW or HIGH. As there are no examples/tutorials on how to use I2C on PX4, I looked through some drivers but I couldn’t figure out how to just simply set a pin to LOW or HIGH.

I’d appreciate if one of you could point me in the right direction. Furthermore, if you know an easier way to read from at least two UARTs and distinguish from which device the data comes – no Tx needed – I’d also appreciate it.

Thanks!