4 #define BIT(n) (1<<(n))
6 void serial_init(uint16_t baud)
8 DDRD = (DDRD&~0x03) | 0x02;
11 baud = (F_CPU/16+baud/2)/baud-1;
14 UCSR0C = BIT(UCSZ00) | BIT(UCSZ01); // 8N1
15 UCSR0B = BIT(RXEN0) | BIT(TXEN0) | BIT(RXCIE0);
18 void serial_write(uint8_t c)
20 while(!(UCSR0A&(1<<UDRE0))) ;