changed the usart code to return the number of bytes received in buffer