libs/avr_lib/uart.c
void UART_init(void)
{
    // set up the baud rate
    UBRRnH = UBRRH_VALUE; /* defined in setbaud.h */
    UBRRnL = UBRRL_VALUE;
#if USE_2X
    UCSRnA |= (1 << U2Xn);
#else
    UCSRnA &= ~(1 << U2Xn);
#endif

    /* Enable USART transmitter/receiver and receiver interupt*/
    UCSRnB = (1 << TXENn) | (1 << RXENn);

#ifdef UART_RX_INTERUPT
    UCSRnB |= (1 << RXCIEn);
#endif
#ifdef UART_TX_INTERUPT
    UCSRnB |= (1 << TXCIEn);
#endif

    UCSRnC = (1 << UCSZn1) | (1 << UCSZn0); /* 8 data bits, 1 stop bit */

#ifdef UART_INIT_STDOUT
    stdout = &uart_stream;
#endif
#ifdef UART_INIT_STDIN
    stdin = &uart_stream;
#endif
}
/**
 * @brief Initialize the UART using baud defined and enabling the tx and rx
 * interupts as defined.
 * Also assign the stdout, stderr, and stdin as defined.
 *
 */
@brief Initialize the UART using baud defined and enabling the tx and rx
interupts as defined.
Also assign the stdout, stderr, and stdin as defined.
@brief Initialize the UART using baud defined and enabling the tx and rx interupts as defined . Also assign the stdout stderr and stdin as defined .
void UART_init(void)
{
    UBRRnH = UBRRH_VALUE; 
    UBRRnL = UBRRL_VALUE;
#if USE_2X
    UCSRnA |= (1 << U2Xn);
#else
    UCSRnA &= ~(1 << U2Xn);
#endif
    UCSRnB = (1 << TXENn) | (1 << RXENn);
#ifdef UART_RX_INTERUPT
    UCSRnB |= (1 << RXCIEn);
#endif
#ifdef UART_TX_INTERUPT
    UCSRnB |= (1 << TXCIEn);
#endif
    UCSRnC = (1 << UCSZn1) | (1 << UCSZn0); 
#ifdef UART_INIT_STDOUT
    stdout = &uart_stream;
#endif
#ifdef UART_INIT_STDIN
    stdin = &uart_stream;
#endif
}
void UART_init ( void ) { UBRRnH = UBRRH_VALUE ; UBRRnL = UBRRL_VALUE ; #if USE_2X UCSRnA |= ( 1 << U2Xn ) ; #else UCSRnA &= ~ ( 1 << U2Xn ) ; #endif UCSRnB = ( 1 << TXENn ) | ( 1 << RXENn ) ; #ifdef UART_RX_INTERUPT UCSRnB |= ( 1 << RXCIEn ) ; #endif #ifdef UART_TX_INTERUPT UCSRnB |= ( 1 << TXCIEn ) ; #endif UCSRnC = ( 1 << UCSZn1 ) | ( 1 << UCSZn0 ) ; #ifdef UART_INIT_STDOUT stdout = & uart_stream ; #endif #ifdef UART_INIT_STDIN stdin = & uart_stream ; #endif }
@brief Initialize the UART using baud defined and enabling the tx and rx
 interupts as defined.
@brief Initialize the UART using baud defined and enabling the tx and rx interupts as defined .
// set up the baud rate /* defined in setbaud.h */ /* Enable USART transmitter/receiver and receiver interupt*/ /* 8 data bits, 1 stop bit */