This repository was archived by the owner on Dec 6, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ cfg = json.load(open(JSON_CFG))
2020cfg = cfg['platform']
2121
2222# UART device alias, used internally by bypass console driver
23- template_console_dev = 'static constexpr uart_channel console_channel = uart_channel::ch%d;'
23+ template_console_dev = '''static constexpr uart_channel UART{CHANNEL_INDEX}_channel = uart_channel::ch{CHANNEL_INDEX};
24+ using UART{CHANNEL_INDEX}_driver = uart<UART{CHANNEL_INDEX}_channel>;
25+ using platform_console = UART{CHANNEL_INDEX}_driver;'''
2426
2527# Gets string representation of UART theCore enum.
2628def get_uart_enum(uart_cfg):
@@ -47,9 +49,11 @@ for uart_cfg in uart_cfgs:
4749 # Avoid using begin and end comment section tokens
4850 cog.outl(('\n%s* ' + uart_cfg['comment'] + ' *%s') % ('/', '/'))
4951
50- cog.outl(template_console_dev % get_uart_enum(uart_cfg))
51- cog.outl('using platform_console = uart<console_channel>;')
52+ cog.outl(template_console_dev.format(CHANNEL_INDEX = get_uart_enum(uart_cfg)))
5253
54+ if 'alias' in uart_cfg:
55+ cog.outl('using {ALIAS_NAME} = UART{CHANNEL_INDEX}_driver;'.format(ALIAS_NAME = uart_cfg['alias'],
56+ CHANNEL_INDEX = get_uart_enum(uart_cfg)))
5357]]]*/
5458// [[[end]]]
5559
You can’t perform that action at this time.
0 commit comments