uC/AVR/PIO_Project/MainControlBoard/lib/uart/uart.c
void uart_putc(uint8_t uart_if, char c)
{
    if(uart_if > (N_UARTS-1)){
        return;                         // uart > 3 doesn't exist!
    }
    if(uarttx[uart_if].initialized == 0){    // check if already initialized
        uart_init(uart_if, DEFAULT_BAUD);
    }

    else{                                    // check if already initialized
        if(uarttx[uart_if].transmitting == 0)   // if not transmitting
        {
            uarttx[uart_if].transmitting = 1;
            switch(uart_if){                // feed directly into data register
                case 0:
                    UDR0 = c;
                    break;
                case 1:
                    UDR1 = c;
                    break;
                case 2: 
                    UDR2 = c;
                    break;
                case 3: 
                    UDR3 = c;
                    break;
                default:
                    return;         
            }
        }                                   // if not transmitting

        else{
            rbuffer_write(&uarttx[uart_if], c);
        }

    }   // check if already initialized
}
/**
 *  @brief transmit a byte string via a selected uart port in interrupt mode. Toes not check if it fits in tx buffer. if not, will trunctated.
 *  
 *  @param uart_if: select uart interface (0 - 3)
 *  @param c: char
 *  
 * */
@brief transmit a byte string via a selected uart port in interrupt mode. Toes not check if it fits in tx buffer. if not, will trunctated.

@param uart_if: select uart interface (0 - 3)
@param c: char
@brief transmit a byte string via a selected uart port in interrupt mode . Toes not check if it fits in tx buffer . if not will trunctated . @param uart_if : select uart interface ( 0 - 3 ) @param c : char
void uart_putc(uint8_t uart_if, char c)
{
    if(uart_if > (N_UARTS-1)){
        return;                         
    }
    if(uarttx[uart_if].initialized == 0){    
        uart_init(uart_if, DEFAULT_BAUD);
    }
    else{                                    
        if(uarttx[uart_if].transmitting == 0)   
        {
            uarttx[uart_if].transmitting = 1;
            switch(uart_if){                
                case 0:
                    UDR0 = c;
                    break;
                case 1:
                    UDR1 = c;
                    break;
                case 2: 
                    UDR2 = c;
                    break;
                case 3: 
                    UDR3 = c;
                    break;
                default:
                    return;         
            }
        }                                   
        else{
            rbuffer_write(&uarttx[uart_if], c);
        }
    }   
}
void uart_putc ( uint8_t uart_if , char c ) { if ( uart_if > ( N_UARTS - 1 ) ) { return ; } if ( uarttx [ uart_if ] . initialized == 0 ) { uart_init ( uart_if , DEFAULT_BAUD ) ; } else { if ( uarttx [ uart_if ] . transmitting == 0 ) { uarttx [ uart_if ] . transmitting = 1 ; switch ( uart_if ) { case 0 : UDR0 = c ; break ; case 1 : UDR1 = c ; break ; case 2 : UDR2 = c ; break ; case 3 : UDR3 = c ; break ; default : return ; } } else { rbuffer_write ( & uarttx [ uart_if ] , c ) ; } } }
@brief transmit a byte string via a selected uart port in interrupt mode.
@brief transmit a byte string via a selected uart port in interrupt mode .
// uart > 3 doesn't exist! // check if already initialized // check if already initialized // if not transmitting // feed directly into data register // if not transmitting // check if already initialized