1.2.21.4 1.3.25.4 1.4.21.4 1.5.25.4 1.6.22.4 1.7.23.4 1.9.19.4 1.29.23.4 1.30.18.4 1.31.18.4 1.32.26.4 1.33.16.4 1.37.18.4 1.38.21.4 1.39.18.4 1.40.20.4 SERCOMx_USART_WriteFreeBufferCountGet Function

C

/* x = SERCOM instance number */

/* Ring buffer mode */

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

SERCOMx_USART_Initialize must have been called for the associated SERCOM_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 (SERCOM0_USART_WriteFreeBufferCountGet() >= 10)
{
    SERCOM0_USART_Write((uint8_t*)txBuffer, 10);
}

Remarks

None