1.1.13.7 1.8.24.5 1.10.23.7 1.11.23.7 1.12.24.7 1.13.22.7 1.14.17.7 1.15.18.7 1.16.25.7 1.17.20.7 1.18.21.7 1.19.21.7 1.20.25.7 1.21.26.7 1.22.28.7 1.23.27.7 1.24.23.7 1.27.26.5 1.34.26.5 1.35.20.5 UARTx_WriteCountGet Function
C
/* x = UART instance number */
/* Non-blocking and ring buffer mode */
size_t UARTx_WriteCountGet( void )
Summary
Non-blocking mode
Gets the byte count of processed bytes for a given UART write operation
Ring buffer mode
Returns the number of bytes pending to be transmitted out in the transmit buffer.
Description
Non-blocking mode
This function gets the count of processed bytes for an on-going or last completed UART Transmit operation. This function can be used to track the progress of the non-blocking transmit operation.
Ring buffer mode
This function returns the number of bytes of data pending for transmission.
Precondition
UARTx_Initialize must have been called for the associated UART instance.
Parameters
None.
Returns
Non-blocking mode
Returns count of bytes currently completed/processed from the current Transmit buffer for interrupt non-blocking mode. In 9-bit mode, it returns the number of 9-bit data processed.
Ring buffer mode
The API returns the number of bytes that are pending for transmission in the internal transmit buffer. If 9-bit mode is enabled, then the return value indicates the number of 9-bit data pending transmission.
Example
Non-blocking mode
size_t count; count = UART1_WriteCountGet(); if(count < COUNT_EXPECTED) { //More bytes are expected to transmit, wait }
Ring buffer mode
if (UART1_WriteCountGet() == 0)
{
// All the data has been transmitted out.
}
Remarks
None