Skip to content

Commit d15cc3d

Browse files
authored
Merge pull request #710 from wuxx/feature-uart
add support for even/odd check on hic_hal stm32
2 parents cdbc7d2 + 8b0e68f commit d15cc3d

File tree

1 file changed

+5
-1
lines changed
  • source/hic_hal/stm32/stm32f103xb

1 file changed

+5
-1
lines changed

source/hic_hal/stm32/stm32f103xb/uart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ int32_t uart_set_configuration(UART_Configuration *config)
170170

171171
//Only 8 bit support
172172
configuration.DataBits = UART_DATA_BITS_8;
173-
uart_handle.Init.WordLength = UART_WORDLENGTH_8B;
173+
if (uart_handle.Init.Parity == HAL_UART_PARITY_ODD || uart_handle.Init.Parity == HAL_UART_PARITY_EVEN) {
174+
uart_handle.Init.WordLength = UART_WORDLENGTH_9B;
175+
} else {
176+
uart_handle.Init.WordLength = UART_WORDLENGTH_8B;
177+
}
174178

175179
// No flow control
176180
configuration.FlowControl = UART_FLOW_CONTROL_NONE;

0 commit comments

Comments
 (0)