Avoid namespace pollution, don't typedef ringbuf.
Replace hardcoding with generic UART interface.

Also, macro shenanigans.