HAL_ChibiOS: added uart for sbus out in IOMCU

This commit is contained in:
Andrew Tridgell 2018-10-29 13:12:42 +11:00
parent af4340d1d1
commit b3946fc458
2 changed files with 22 additions and 7 deletions

View File

@ -24,11 +24,22 @@ STM32_VDD 330U
# order of UARTs
UART_ORDER EMPTY
define HAL_USE_UART TRUE
define STM32_UART_USE_USART2 TRUE
# UART connected to FMU, uses DMA
PA2 USART2_TX USART2
PA3 USART2_RX USART2
define STM32_UART_USE_USART2 TRUE
define STM32_UART_USE_USART3 FALSE
# UART for SBUS out, and RC in, no DMA
define HAL_USE_SERIAL TRUE
PB4 SBUS_OUT_EN OUTPUT LOW GPIO(1)
PB10 USART3_TX USART3
PB11 USART3_RX USART3
define STM32_SERIAL_USE_USART2 FALSE
define STM32_SERIAL_USE_USART3 TRUE
PA0 TIM2_CH1 TIM2 PWM(1) GPIO(101)
PA1 TIM2_CH2 TIM2 PWM(2) GPIO(102)
PB8 TIM4_CH3 TIM4 PWM(3) GPIO(103)
@ -72,7 +83,6 @@ define STM32_RCIN_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
#DMA Channel Not relevant for F1 series
define STM32_RCIN_DMA_CHANNEL 0
define STM32_SERIAL_USE_USART2 TRUE
define HAL_USE_EMPTY_STORAGE 1
define HAL_STORAGE_SIZE 16384
@ -83,10 +93,8 @@ define HAL_NO_GPIO_IRQ
define CH_CFG_ST_TIMEDELTA 0
define TIMER_THD_WA_SIZE 256
define RCIN_THD_WA_SIZE 768
define DEFAULT_TX_BUF_SIZE 0
define DEFAULT_RX_BUF_SIZE 0
#define CH_CFG_USE_DYNAMIC FALSE
define SERIAL_BUFFERS_SIZE 0
define SERIAL_BUFFERS_SIZE 32
define HAL_USE_EMPTY_IO TRUE
define PORT_INT_REQUIRED_STACK 64

View File

@ -773,7 +773,11 @@ def write_UART_config(f):
(dev, dev, rts_line))
f.write('#define HAL_UART_DEVICE_LIST %s\n\n' % ','.join(devlist))
if not need_uart_driver and not args.bootloader:
f.write('#define HAL_USE_SERIAL FALSE\n')
f.write('''
#ifndef HAL_USE_SERIAL
#define HAL_USE_SERIAL FALSE
#endif
''')
def write_UART_config_bootloader(f):
'''write UART config defines'''
@ -1119,7 +1123,10 @@ def write_peripheral_enable(f):
f.write('// peripherals enabled\n')
for type in sorted(bytype.keys()):
if type.startswith('USART') or type.startswith('UART'):
f.write('#define STM32_SERIAL_USE_%-6s TRUE\n' % type)
dstr = 'STM32_SERIAL_USE_%-6s' % type
f.write('#ifndef %s\n' % dstr)
f.write('#define %s TRUE\n' % dstr)
f.write('#endif\n')
if type.startswith('SPI'):
f.write('#define STM32_SPI_USE_%s TRUE\n' % type)
if type.startswith('OTG'):