1.27.5.4 FLEXCOMx_USART_WriteFreeBufferCountGet Function

C

/* x = FLEXCOM instance number */

/* Ring buffer mode */

size_t FLEXCOMx_USART_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

FLEXCOMx_USART_Initialize must have been called for the associated FLEXCOM_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 (FLEXCOM0_USART_WriteFreeBufferCountGet() >= 10)
{
    FLEXCOM0_USART_Write((uint8_t*)txBuffer, 10);
}

Remarks

None