X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Flib%2Fatmega168.c;h=1ed8840fed53e3cf99d88f024b95c4ed8f46e4a7;hp=36795faf1c9177d5e0644d6928f7103dd3e4c0ae;hb=5ac4c1769e9976b39e919bb5f5ac9e97f62e7d0f;hpb=c291f2361f0588cab3bd9d179edbf0c095ffda6c diff --git a/firmware/lib/atmega168.c b/firmware/lib/atmega168.c index 36795fa..1ed8840 100644 --- a/firmware/lib/atmega168.c +++ b/firmware/lib/atmega168.c @@ -2,9 +2,13 @@ #include "platform.h" +#include +#include + //! Receive a byte. unsigned char serial0_rx(){ - return 0; + while( !(UCSR0A & (1 << RXC0)) ); + return UDR0; } //! Receive a byte. @@ -14,6 +18,8 @@ unsigned char serial1_rx(){ //! Transmit a byte. void serial0_tx(unsigned char x){ + while (!(UCSR0A & (1<> 8); + UBRR0L = (unsigned char) bittimer; + + + /* set the framing to 8N1 */ + UCSR0C = (3 << UCSZ00); + /* Engage! */ + UCSR0B = (1 << RXEN0) | (1 << TXEN0); + return; + } //! Set the baud rate of the second uart. @@ -79,11 +99,11 @@ void msp430_init_uart1(){ //! Initialization is correct. void msp430_init_dco_done(){ - //Nothing to do for the 1612. + //Nothing to do for the AVR w/ xtal. } void msp430_init_dco() { - + // }