1.2.21.13 1.3.25.13 1.4.21.13 1.5.25.13 1.6.22.13 1.7.23.13 1.9.19.13 1.29.23.13 1.30.18.13 1.31.18.13 1.32.26.13 1.33.16.13 1.37.18.13 1.38.21.13 1.39.18.13 1.40.20.13 SERCOMx_USART_ReceiverIsReady Function
C
/* x = SERCOM instance number */
/* Blocking mode */
bool SERCOMx_USART_ReceiverIsReady( void )
Summary
Returns the hardware status of the USART Receiver
Description
This function returns the hardware status associated with the Receive hardware FIFO of the given USART peripheral instance. When Receiver is ready, user can read the available data. This function is available only in blocking (non-interrupt) mode of operation. It can be used to achieve non-blocking behavior of SERCOMx_USART_Read() function even if the library is configured for blocking behavior. If this function returns true, calling the SERCOMx_USART_Read() function with a byte count of 1 will result in non-blocking behavior.
Precondition
SERCOMx_USART_Initialize must have been called for the associated USART instance.
Parameters
None.
Returns
Param | Description |
---|---|
true | Receive hardware FIFO has at least one data available to read |
false | Receive hardware FIFO is empty |
Example
char rxData;
if(SERCOM0_USART_ReceiverIsReady() == true)
{
// At least one data is available in Receive FIFO, hence can read a byte
SERCOM0_USART_Read(&rxData, 1);
}
else
{
//Receiver is empty
}
Remarks
None