Merge pull request #2022 from whj4674672/master

[BSP]stm32f107 fix usart3
This commit is contained in:
Bernard Xiong 2018-12-03 17:41:04 +08:00 committed by GitHub
commit 9757f6b405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -59,19 +59,19 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
USART_InitStructure.USART_BaudRate = cfg->baud_rate; USART_InitStructure.USART_BaudRate = cfg->baud_rate;
if (cfg->data_bits == DATA_BITS_8){ if (cfg->data_bits == DATA_BITS_8) {
USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_WordLength = USART_WordLength_8b;
} else if (cfg->data_bits == DATA_BITS_9) { } else if (cfg->data_bits == DATA_BITS_9) {
USART_InitStructure.USART_WordLength = USART_WordLength_9b; USART_InitStructure.USART_WordLength = USART_WordLength_9b;
} }
if (cfg->stop_bits == STOP_BITS_1){ if (cfg->stop_bits == STOP_BITS_1) {
USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_StopBits = USART_StopBits_1;
} else if (cfg->stop_bits == STOP_BITS_2){ } else if (cfg->stop_bits == STOP_BITS_2) {
USART_InitStructure.USART_StopBits = USART_StopBits_2; USART_InitStructure.USART_StopBits = USART_StopBits_2;
} }
if (cfg->parity == PARITY_NONE){ if (cfg->parity == PARITY_NONE) {
USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_Parity = USART_Parity_No;
} else if (cfg->parity == PARITY_ODD) { } else if (cfg->parity == PARITY_ODD) {
USART_InitStructure.USART_Parity = USART_Parity_Odd; USART_InitStructure.USART_Parity = USART_Parity_Odd;
@ -295,6 +295,7 @@ static void RCC_Configuration(void)
#if defined(RT_USING_UART3) #if defined(RT_USING_UART3)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOC, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOC, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);
GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE);
#endif /* RT_USING_UART3 */ #endif /* RT_USING_UART3 */
} }