summaryrefslogtreecommitdiff
path: root/uart/SConscript
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 17:05:36 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 17:05:36 +0200
commit9801227da93abb418d12804d2ceb56ce04d90c1d (patch)
tree7927fbc98a8ff870a34315d54cf8ad5a38fbb4b7 /uart/SConscript
parentcb486529482ef66902fd15bbd6e3a3b12ff4fa4b (diff)
uart: Generate instances from platform spec.
Diffstat (limited to 'uart/SConscript')
-rw-r--r--uart/SConscript21
1 files changed, 21 insertions, 0 deletions
diff --git a/uart/SConscript b/uart/SConscript
new file mode 100644
index 0000000..dcf6d3e
--- /dev/null
+++ b/uart/SConscript
@@ -0,0 +1,21 @@
+Import('env')
+
+headers = []
+instances = []
+sources = []
+aliases = {}
+
+periph = env['PLATFORM_SPEC'].get('periph', {})
+
+if 'stm32_uart' in periph:
+ headers.append('stm32_uart.h')
+ for name, data in periph['stm32_uart'].items():
+ instances.append({
+ 'type': 'STM32_UART_t<STM32_UART_reg_%s_t>' % data['type'],
+ 'name': name,
+ 'args': [data['offset']],
+ })
+
+env.Jinja2('uart.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases)
+
+Return('sources')