1.34.27.4 1.35.21.4 USARTx_WriteFreeBufferCountGet Function

C

/* x = USART instance number */

/* Ring buffer mode */
size_t USARTx_WriteFreeBufferCountGet(void)

Summary

Returns the number of bytes of free space available in the internal transmit buffer

Description

This function returns the number of bytes of free space available in the internal transmit buffer

Precondition

USARTx_Initialize must have been called for the associated USART instance.

Parameters

None

Returns

The API returns the number of bytes of free space in the transmit buffer. If 9-bit mode is enabled, then the return value indicates the number of 9-bit data that can be copied into the ring buffer.

Example

uint8_t txBuffer[10];

// Check if there is space for writing at-least 10 characters to the transmit buffer
if (USART1_WriteFreeBufferCountGet() >= 10)
{
    USART1_Write((uint8_t*)txBuffer, 10);
}

Remarks

None