1 //! MSP430F1612/1611 clock and I/O definitions
6 #include <util/delay.h>
9 unsigned char serial0_rx(){
10 while( !(UCSR0A & (1 << RXC0)) );
15 unsigned char serial1_rx(){
20 void serial0_tx(unsigned char x){
21 while (!(UCSR0A & (1<<UDRE0)) );
25 //! Transmit a byte on the second UART.
26 void serial1_tx(unsigned char x){
29 //! Set the baud rate.
30 void setbaud0(unsigned char rate){
31 //TODO support multiple rates.
54 #define F_CPU 8000000L
55 //#define BAUD 115200L
57 #include <util/setbaud.h>
61 UCSR0C = _BV(UCSZ01) | _BV(UCSZ00);
62 UCSR0B = _BV(RXEN0) | _BV(TXEN0);
67 //! Set the baud rate of the second uart.
68 void setbaud1(unsigned char rate){
69 //http://mspgcc.sourceforge.net/baudrate.html
91 void avr_init_uart0(){
94 _delay_ms(500); //takes a bit to stabilize
98 void avr_init_uart1(){