X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Flib%2Fatmega168.c;h=a5e8cb742ef21a4b7cc662990ed87b4b06240941;hb=06d93d3f05cbb24e09513714fcdbc72f6f379da9;hp=36795faf1c9177d5e0644d6928f7103dd3e4c0ae;hpb=21ff17d2af1e50542d9343d7177269a8910ebbe3;p=goodfet diff --git a/firmware/lib/atmega168.c b/firmware/lib/atmega168.c index 36795fa..a5e8cb7 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< + UBRR0H = UBRRH_VALUE; + UBRR0L = UBRRL_VALUE; + + UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); + UCSR0B = _BV(RXEN0) | _BV(TXEN0); + return; + } //! Set the baud rate of the second uart. @@ -68,22 +87,13 @@ void setbaud1(unsigned char rate){ } -void msp430_init_uart0(){ +void avr_init_uart0(){ + setbaud0(0); } -void msp430_init_uart1(){ +void avr_init_uart1(){ } -//! Initialization is correct. -void msp430_init_dco_done(){ - //Nothing to do for the 1612. -} - - -void msp430_init_dco() { - -} -