From 018ac68061ed2e33295605833c95d21f0711a4c8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 5 Nov 2021 14:17:40 +1100 Subject: [PATCH] AP_HAL_Linux: support up to 9 UARTs --- libraries/AP_HAL_Linux/HAL_Linux_Class.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp b/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp index 0d4551901e..4710f63257 100644 --- a/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp +++ b/libraries/AP_HAL_Linux/HAL_Linux_Class.cpp @@ -72,6 +72,7 @@ static UARTDriver uartFDriver(false); static UARTDriver uartGDriver(false); static UARTDriver uartHDriver(false); static UARTDriver uartIDriver(false); +static UARTDriver uartJDriver(false); static I2CDeviceManager i2c_mgr_instance; static SPIDeviceManager spi_mgr_instance; @@ -247,6 +248,7 @@ HAL_Linux::HAL_Linux() : &uartGDriver, &uartHDriver, &uartIDriver, + &uartJDriver, &i2c_mgr_instance, &spi_mgr_instance, &qspi_mgr_instance, @@ -271,7 +273,7 @@ HAL_Linux::HAL_Linux() : void _usage(void) { - printf("Usage: -A uartAPath -B uartBPath -C uartCPath -D uartDPath -E uartEPath -F uartFPath -G uartGpath -H uartHpath -I uartIpath\n"); + printf("Usage: -A uartAPath -B uartBPath -C uartCPath -D uartDPath -E uartEPath -F uartFPath -G uartGpath -H uartHpath -I uartIpath -J uartJpath\n"); printf("Options:\n"); printf("\tserial:\n"); printf(" -A /dev/ttyO4\n"); @@ -319,6 +321,7 @@ void HAL_Linux::run(int argc, char* const argv[], Callbacks* callbacks) const {"uartG", true, 0, 'G'}, {"uartH", true, 0, 'H'}, {"uartI", true, 0, 'I'}, + {"uartJ", true, 0, 'J'}, {"log-directory", true, 0, 'l'}, {"terrain-directory", true, 0, 't'}, {"storage-directory", true, 0, 's'}, @@ -364,6 +367,9 @@ void HAL_Linux::run(int argc, char* const argv[], Callbacks* callbacks) const case 'I': uartIDriver.set_device_path(gopt.optarg); break; + case 'J': + uartJDriver.set_device_path(gopt.optarg); + break; case 'l': utilInstance.set_custom_log_directory(gopt.optarg); break;