Updated CircularBuffer and UART code.

Previous code had a read/write conflict during interrupts.