libs/avr_lib/uart.c
bool UART_ReceiveByte(uint8_t *c, bool blocking)
{
    // TODO: could pack these into two conditions...
#ifdef UART_RX_INTERUPT
    if (blocking)
    {
        while (BUFFER_empty(&rxbuff))
        {
            ;
        }
        *c = BUFFER_dequeue(&rxbuff);
        return true;
    }
    else if (BUFFER_empty(&rxbuff))
    {
        return false;
    }
    else
    {
        *c = BUFFER_dequeue(&rxbuff);
        return true;
    }

#else
    if (blocking)
    {
        loop_until_bit_is_set(UCSRnA, RXCn); /* Wait for incoming data */
        *c = UDRn;                           /* return register value */
        return true;
    }
    else if (bit_is_clear(UCSRnA, RXCn))
    {
        return false;
    }
    else
    {
        *c = UDRn;
        return true;
    }

#endif
}
/**
 * @brief Low level routine for receiving a byte of data through the UART
 * Method utilized is dependant on if interupt driven transfers are used.
 *
 * @return uint8_t
 */
@brief Low level routine for receiving a byte of data through the UART
Method utilized is dependant on if interupt driven transfers are used.


@brief Low level routine for receiving a byte of data through the UART Method utilized is dependant on if interupt driven transfers are used .
bool UART_ReceiveByte(uint8_t *c, bool blocking)
{
#ifdef UART_RX_INTERUPT
    if (blocking)
    {
        while (BUFFER_empty(&rxbuff))
        {
            ;
        }
        *c = BUFFER_dequeue(&rxbuff);
        return true;
    }
    else if (BUFFER_empty(&rxbuff))
    {
        return false;
    }
    else
    {
        *c = BUFFER_dequeue(&rxbuff);
        return true;
    }
#else
    if (blocking)
    {
        loop_until_bit_is_set(UCSRnA, RXCn); 
        *c = UDRn;                           
        return true;
    }
    else if (bit_is_clear(UCSRnA, RXCn))
    {
        return false;
    }
    else
    {
        *c = UDRn;
        return true;
    }
#endif
}
bool UART_ReceiveByte ( uint8_t * c , bool blocking ) { #ifdef UART_RX_INTERUPT if ( blocking ) { while ( BUFFER_empty ( & rxbuff ) ) { ; } * c = BUFFER_dequeue ( & rxbuff ) ; return true ; } else if ( BUFFER_empty ( & rxbuff ) ) { return false ; } else { * c = BUFFER_dequeue ( & rxbuff ) ; return true ; } #else if ( blocking ) { loop_until_bit_is_set ( UCSRnA , RXCn ) ; * c = UDRn ; return true ; } else if ( bit_is_clear ( UCSRnA , RXCn ) ) { return false ; } else { * c = UDRn ; return true ; } #endif }
@brief Low level routine for receiving a byte of data through the UART
 Method utilized is dependant on if interupt driven transfers are used.
@brief Low level routine for receiving a byte of data through the UART Method utilized is dependant on if interupt driven transfers are used .
// TODO: could pack these into two conditions... /* Wait for incoming data */ /* return register value */