X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Flib%2Fatmega168.c;h=d8705ba40735dbd56fc15ae13b3a62608d6af40d;hp=1ed8840fed53e3cf99d88f024b95c4ed8f46e4a7;hb=b58937eb83447c1c3d073ed6343f5ac062f9f969;hpb=5ac4c1769e9976b39e919bb5f5ac9e97f62e7d0f diff --git a/firmware/lib/atmega168.c b/firmware/lib/atmega168.c index 1ed8840..d8705ba 100644 --- a/firmware/lib/atmega168.c +++ b/firmware/lib/atmega168.c @@ -51,15 +51,15 @@ void setbaud0(unsigned char rate){ break; } - uint16_t bittimer=( F_CPU / SPEED / 16 ) - 1; - UBRR0H = (unsigned char) (bittimer >> 8); - UBRR0L = (unsigned char) bittimer; +#define F_CPU 8000000L + //#define BAUD 115200L +#define BAUD 9600L +#include + UBRR0H = UBRRH_VALUE; + UBRR0L = UBRRL_VALUE; - - /* set the framing to 8N1 */ - UCSR0C = (3 << UCSZ00); - /* Engage! */ - UCSR0B = (1 << RXEN0) | (1 << TXEN0); + UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); + UCSR0B = _BV(RXEN0) | _BV(TXEN0); return; } @@ -88,22 +88,15 @@ void setbaud1(unsigned char rate){ } -void msp430_init_uart0(){ -} - - -void msp430_init_uart1(){ +void avr_init_uart0(){ + PORTD = _BV(PD2); + setbaud0(0); + _delay_ms(500); //takes a bit to stabilize } - -//! Initialization is correct. -void msp430_init_dco_done(){ - //Nothing to do for the AVR w/ xtal. +void avr_init_uart1(){ } -void msp430_init_dco() { - // -}