Custom bi-directional UART communication with motor driver board

Hi, I am trying to make my own UART protocol with motor driver board. It should recieve data about steering and FC should recieve data from hall sensors. I know how does UART protocol works in ardurover FW but I don`t know where I should put this UART code. I think about 50HZ loop, but there is no such loop in Rover.cpp. Any suggestions how to accomplish task like this? Thanks in advance.

Your easiest option would be to write a lua script to send serial commands to your controller.

I know, but I need to run this code w/o lua scripts, cuz in future I want to implement more complex features. So unfortunately no lua scripts and Mavlink protocols. However thanks for responding:)

I find out that newer ardurover FW has a bit different implementation of loops, so I need to make a 50Hz scheduled task in Rover.cpp. Right now I am trying to send just one byte. I will post all updates for anyone who wonders.

upd: Yeap, that worked fine, u have to set baud rate in system.cpp file, add function in Rover.h and call it in 50Hz loop using scheduler in Rover.cpp file.