#include #include #include "usart.h" namespace usart { namespace { static FILE mystdout; } void init( unsigned long baud) { fdev_setup_stream(&mystdout, put_printf, NULL, _FDEV_SETUP_WRITE); stdout = &mystdout; const unsigned int ubrr = F_CPU/8/baud-1; /*Set baud rate */ #if defined __AVR_ATmega328P__ UBRR0H = (unsigned char)(ubrr>>8); UBRR0L = (unsigned char)ubrr; UCSR0A |= (1<>8); UBRRL = (unsigned char)ubrr; UCSRA |= (1<