# SERIAL\_vFlush()

## Explanation

Wait until the output request has been completed by the SERIAL library.

{% hint style="info" %}
Use this if you want to output all messages before going to sleep. Normally, it is recommended to keep a sufficient FIFO buffer for output and to avoid calling the process as much as possible.
{% endhint %}

{% hint style="warning" %}
Waiting for output to complete may cause instability. In this case, remove this waiting process and check the operation.

If the waiting process is omitted and the output is interrupted, an extra FIFO memory is allocated for the output.
{% endhint %}

## Argument <a href="#yin-shu" id="yin-shu"></a>

| Type  | Name         | Remark                                                               |
| ----- | ------------ | -------------------------------------------------------------------- |
| uint8 | u8SerialPort | Serial port (E\_AHI\_UART\_0 or E\_AHI\_UART\_1 should be specified) |

## Returns

None

## Sample code

```c
void cbToCoNet_vMain(void) {
	while (!SERIAL_bRxQueueEmpty(sSerPort.u8SerialPort)) {
		int16 i16Char;
​		i16Char = SERIAL_i16RxChar(sSerPort.u8SerialPort);
​		vfPrintf(&sSerStream, "\n\r# [%c] --> ", i16Char);
	    SERIAL_vFlush(sSerStream.u8Device);
		...
	}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdk.twelite.info/en/hw-api-ref/perifuraru/uart/serial-raiburari/serial_vflush.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
