cleaned up uart_driver.c state machines to be easier to understand