fix uart reconf

This commit is contained in:
matt
2020-09-16 17:13:08 +08:00
parent 124fa04737
commit ef9c296291
+4 -5
View File
@@ -30,8 +30,7 @@ void UART_reconf(UART_HandleTypeDef *huart,
uint32_t baud,
uint8_t wordlen,
uint8_t stopbits,
uint8_t parity,
)
uint8_t parity)
{
huart->Init.BaudRate = baud;
switch (wordlen)
@@ -131,7 +130,7 @@ void hal_uart_init_Outputs_wrapper(const uint32_T *baudrate,
UART_reconf(uart2_RS422_2_rx.huart,baudrate[0],wordlen[0], stopbits[0], parity[0]);
break;
case 2:
UART_reconf(uart3_DBG_rx.huart,baudrate[0],wordlen[0], stopbits[0], parity[0]);
UART_reconf(uart3_IMU_NAV_rx.huart,baudrate[0],wordlen[0], stopbits[0], parity[0]);
break;
case 3:
UART_reconf(uart4_TTL_1_rx.huart,baudrate[0],wordlen[0], stopbits[0], parity[0]);
@@ -159,8 +158,8 @@ void hal_uart_init_Outputs_wrapper(const uint32_T *baudrate,
{
uint8_t buff[6];
buff[0] = uart_id[0]-7;
buff[1] = ((bardrate[0])&0xFF);
buff[2] = ((bardrate[0] >> 8)&0xFF);
buff[1] = ((baudrate[0])&0xFF);
buff[2] = ((baudrate[0] >> 8)&0xFF);
buff[3] = wordlen[0];
buff[4] = stopbits[0];
buff[5] = parity[0];