It’s easy, there are already AVR/Arduino boards like jD-IOBoard and
MinimOSD that does exactly this. Just take a look at source codes of those
boards and you find a lot more.
Am writing bespoke software for a uC based flight computer being used to manage avionics on a high altitude balloon. Just need to know what format the MAVlink packets are in so I can replicate that on our board (all written in C, not ArduinoScript).
Both boards are talking normal MAVLink protocol over UART. MAVLink libraries and sources are fully available but yes most of them are written in C. There are no other ways to talk with APM/Pixhawk autopilots than MAVLink.
For MAVLink telemetry ports it’s fixed to make sure that we are not overloading serial and that way crash whole autopilot. I could say that MAVLink packets etc are optimized for 57k speeds.