How do I wait for data to be pushed to the RX buffer of the UART channel?

Hello,

I am trying to implement a system where the board waits for a character to be pushed to the RX buffer before reading it. The character would be sent by another microcontroller and used to set  a filter. That part works as expected when the character is already on the buffer or hardcoded into the software, but obviously this is not sufficient for the final product. What I am looking for is away to detect if there is anything on the buffer ready to be read. This would be similar to the Serial.available() function on Arduinos. 

Related