static FILE mystdout = FDEV_SETUP_STREAM(USART_Transmit, getch,_FDEV_SETUP_RW);
static char getch(void) {
while ( !(UCSR0A & (1<<RXC0)) );
return UDR0;
}
void USART_Transmit( unsigned char data ) {
/* Wait for empty transmit buffer */
while ( !( UCSR0A & (1<<UDRE0)) ) ;
/* Put data into buffer, sends the data */
UDR0 = data;
}
void init() {
PRR = _BV(PRTWI) | _BV(PRTIM2) | _BV(PRTIM0) | _BV(PRTIM1) | _BV(PRSPI); // min
PORTC &= ~_BV(PC4); // min
//XBEE_ON;
USART_Init(); // min
stdout = &mystdout;
_delay_ms(5);