Running code on rpi 4b inside blueos

Hello. I am running BlueOS on an RPi 4B, and I need to output digital signals from 4 GPIO pins on the RPi (preferably triggered by pressing a button on the controller). Alternatively, if possible, I can also do this via the Pixhawk 2.4.8, but my main preference is to do it through the RPi. Is this possible, and if so, how can I achieve it?