mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Addressed compiler warnings and handle non-supported devices properly.
This commit is contained in:
parent
c149b26dd4
commit
9924c4f425
@ -135,8 +135,8 @@ static int open_uart(const char *device, struct termios *uart_config_original)
|
||||
}
|
||||
|
||||
/* Get the appropriate GPIO pin and control register */
|
||||
uint32_t gpio_uart;
|
||||
uint32_t uart_cr3;
|
||||
uint32_t gpio_uart = GPIO_USART2_TX;;
|
||||
uint32_t uart_cr3 = STM32_USART2_CR3;
|
||||
|
||||
switch (device[strlen(device) - 1]) {
|
||||
case '0':
|
||||
@ -149,16 +149,16 @@ static int open_uart(const char *device, struct termios *uart_config_original)
|
||||
uart_cr3 = STM32_USART2_CR3;
|
||||
break;
|
||||
|
||||
case '2':
|
||||
sprintf(msg, "/dev/ttyS3 is not supported.\n", device);
|
||||
close(uart);
|
||||
FATAL_MSG(msg);
|
||||
break;
|
||||
|
||||
case '3':
|
||||
gpio_uart = GPIO_USART6_TX;
|
||||
uart_cr3 = STM32_USART6_CR3;
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf(msg, "%s is not supported.\n", device);
|
||||
close(uart);
|
||||
FATAL_MSG(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Change the TX port to be open-drain */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user