Skip to content

Commit 5233716

Browse files
bugobliteratortridge
authored andcommitted
AP_HAL_ChibiOS: add support hiding Serial parameters for unlisted IOMCU and Empty serial ports
1 parent 3d5f925 commit 5233716

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py

+10
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,10 @@ def get_extra_bylabel(self, label, name, default=None):
16711671
def write_UART_config(self, f):
16721672
'''write UART config defines'''
16731673
serial_list = self.get_config('SERIAL_ORDER', required=False, aslist=True)
1674+
hide_iomcu_uart = False
1675+
if 'IOMCU_UART' in self.config:
1676+
hide_iomcu_uart = self.config['IOMCU_UART'][0] not in serial_list
1677+
16741678
if 'IOMCU_UART' in self.config and self.config['IOMCU_UART'][0] not in serial_list:
16751679
serial_list.append(self.config['IOMCU_UART'][0])
16761680
if serial_list is None:
@@ -1682,10 +1686,16 @@ def write_UART_config(self, f):
16821686
# write out which serial ports we actually have
16831687
nports = 0
16841688
for idx, serial in enumerate(serial_list):
1689+
if hide_iomcu_uart and self.config['IOMCU_UART'][0] == serial:
1690+
# IOMCU UART is not to be displayed in the serial parameters
1691+
f.write('#define HAL_HAVE_SERIAL%u 1\n' % idx)
1692+
f.write('#define HAL_HAVE_SERIAL%u_PARAMS 0\n' % idx)
1693+
continue
16851694
if serial == 'EMPTY':
16861695
f.write('#define HAL_HAVE_SERIAL%u 0\n' % idx)
16871696
else:
16881697
f.write('#define HAL_HAVE_SERIAL%u 1\n' % idx)
1698+
f.write('#define HAL_HAVE_SERIAL%u_PARAMS 1\n' % idx)
16891699
nports = nports + 1
16901700
f.write('#define HAL_NUM_SERIAL_PORTS %u\n' % nports)
16911701

0 commit comments

Comments
 (0)