AP_HAL_ChibiOS: support up to 9 UARTs

This commit is contained in:
Andrew Tridgell 2021-11-05 14:17:39 +11:00 committed by Peter Barker
parent bcee8b56ee
commit fc6a82de1b
3 changed files with 8 additions and 5 deletions

View File

@ -46,6 +46,7 @@ static HAL_UARTF_DRIVER;
static HAL_UARTG_DRIVER;
static HAL_UARTH_DRIVER;
static HAL_UARTI_DRIVER;
static HAL_UARTJ_DRIVER;
#else
static Empty::UARTDriver uartADriver;
static Empty::UARTDriver uartBDriver;
@ -56,6 +57,7 @@ static Empty::UARTDriver uartFDriver;
static Empty::UARTDriver uartGDriver;
static Empty::UARTDriver uartHDriver;
static Empty::UARTDriver uartIDriver;
static Empty::UARTDriver uartJDriver;
#endif
#if HAL_USE_I2C == TRUE && defined(HAL_I2C_DEVICE_LIST)
@ -131,6 +133,7 @@ HAL_ChibiOS::HAL_ChibiOS() :
&uartGDriver,
&uartHDriver,
&uartIDriver,
&uartJDriver,
&i2cDeviceManager,
&spiDeviceManager,
#if HAL_USE_WSPI == TRUE && defined(HAL_QSPI_DEVICE_LIST)

View File

@ -25,8 +25,8 @@
#define RX_BOUNCE_BUFSIZE 64U
#define TX_BOUNCE_BUFSIZE 64U
// enough for uartA to uartI, plus IOMCU
#define UART_MAX_DRIVERS 10
// enough for uartA to uartJ, plus IOMCU
#define UART_MAX_DRIVERS 11
class ChibiOS::UARTDriver : public AP_HAL::UARTDriver {
public:

View File

@ -1460,7 +1460,7 @@ def write_UART_config(f):
f.write('\n// UART configuration\n')
# write out driver declarations for HAL_ChibOS_Class.cpp
devnames = "ABCDEFGHI"
devnames = "ABCDEFGHIJ"
sdev = 0
idx = 0
for dev in uart_list:
@ -1586,8 +1586,8 @@ def write_UART_config(f):
num_uarts = len(devlist)
if 'IOMCU_UART' in config:
num_uarts -= 1
if num_uarts > 9:
error("Exceeded max num UARTs of 9 (%u)" % num_uarts)
if num_uarts > 10:
error("Exceeded max num UARTs of 10 (%u)" % num_uarts)
f.write('#define HAL_UART_NUM_SERIAL_PORTS %u\n' % num_uarts)