> For the complete documentation index, see [llms.txt](https://sdk.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sdk.twelite.info/hw-api-ref/perifuraru/uart/serial-raiburari/tsuartopt.md).

# tsUartOpt

[SERIAL\_vInitEx](/hw-api-ref/perifuraru/uart/serial-raiburari/serial_vinitex.md)() によるオプションの指定を行います。この構造体は静的にメモリ確保する必要はありません。

{% hint style="danger" %}
これらオプションについては、原則としてサポート対象外です。利用にあたっては出力信号についてはオシロスコープなどで確認してください。標準的にサポートする通信設定は以下です。

* ハードフローなし
* パリティなし
* ストップビット 1bit
* データ長 8bit
  {% endhint %}

{% hint style="warning" %}
構造体は、必ず 0 クリアしてから利用します。
{% endhint %}

| bool\_t | bHwFlowEnabled | TRUE:ハードウェアフロー有効 FALSE:無効                                                   |
| ------- | -------------- | --------------------------------------------------------------------------- |
| bool\_t | bParityEnabled | TRUE: パリティ有効 FALSE:無効                                                       |
| uint8   | u8ParityType   | E\_AHI\_UART\_EVEN\_PARITY:偶数 E\_AHI\_UART\_ODD\_PARITY:奇数 (パリティ無効時は値の設定不要) |
| uint8   | u8StopBit      | E\_AHI\_UART\_1\_STOP\_BIT: 1bit, E\_AHI\_UART\_2\_STOP\_BIT: 1.5/2bit      |
| uint8   | u8WordLen      | 7: 7bit, 8: 8bit                                                            |

### サンプルコード

```c
tsUartOpt sUartOpt;
tsSerialPortSetup sSerPort;

void vInitSer() {
	memset(&sUartOpt, 0, sizeof(tsUartOpt));
	sUartOpt.bHwFlowEnabled = FALSE;
	sUartOpt.bParityEnabled = E_AHI_UART_PARITY_ENABLE;
	sUartOpt.u8ParityType = E_AHI_UART_EVEN_PARITY;
	sUartOpt.u8StopBit = E_AHI_UART_2_STOP_BITS;
	sUartOpt.u8WordLen = 7;
	
	/* Create the debug port transmit and receive queues */
	static uint8 au8SerialTxBuffer[256];
	static uint8 au8SerialRxBuffer[256];

	/* Initialise the serial port to be used for debug output */
	memset(&sSerPort, 0, sizeof(tsSerialPortSetup));
	sSerPort.pu8SerialRxQueueBuffer = au8SerialRxBuffer;
	sSerPort.pu8SerialTxQueueBuffer = au8SerialTxBuffer;
	sSerPort.u32BaudRate = u32Baud;
	sSerPort.u16AHI_UART_RTS_LOW = 0xffff;
	sSerPort.u16AHI_UART_RTS_HIGH = 0xffff;
	sSerPort.u16SerialRxQueueSize = sizeof(au8SerialRxBuffer);
	sSerPort.u16SerialTxQueueSize = sizeof(au8SerialTxBuffer);
	sSerPort.u8SerialPort = UART_PORT_SLAVE;
	sSerPort.u8RX_FIFO_LEVEL = E_AHI_UART_FIFO_LEVEL_1;
	
	SERIAL_vInitEx(&sSerPort, &sUartOpt);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/hw-api-ref/perifuraru/uart/serial-raiburari/tsuartopt.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.
