1.34.27.13 1.35.21.13 USARTx_ReceiverIsReady Function
C
/* x = USART instance number */
/* Blocking mode */
bool USARTx_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 USARTx_Read function even if the library is configured for blocking behavior. If this function returns true, calling the USARTx_Read function with a byte count of 1 will result in non-blocking behavior.
Precondition
USARTx_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(USART1_ReceiverIsReady() == true) { // At least one data is available in Receive FIFO, hence can read a byte rxData = USART1_ReadByte(); } else { //Receiver is empty }
Remarks
None.