summaryrefslogtreecommitdiff
path: root/gpio/SConscript
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-09-16 23:50:26 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-09-16 23:50:26 +0200
commitd5fbedc24fdd41e7c30b2f9239f666f33893e065 (patch)
treed41c8b118a2c2e5822ee47e130550134458dc02e /gpio/SConscript
parentc7666a7cd83d590a067d8cbbe4a7e4eb93d155d6 (diff)
gpio: Generate instances from platform spec.
Diffstat (limited to 'gpio/SConscript')
-rw-r--r--gpio/SConscript25
1 files changed, 25 insertions, 0 deletions
diff --git a/gpio/SConscript b/gpio/SConscript
new file mode 100644
index 0000000..ea352cc
--- /dev/null
+++ b/gpio/SConscript
@@ -0,0 +1,25 @@
+Import('env')
+
+headers = []
+instances = []
+sources = []
+aliases = {}
+type_aliases = {}
+
+periph = env['PLATFORM_SPEC'].get('periph', {})
+
+if 'stm32_gpio' in periph:
+ headers.append('stm32_gpio.h')
+ for name, data in periph['stm32_gpio'].items():
+ instances.append({
+ 'type': 'STM32_GPIO_%s_t' % data['type'],
+ 'name': name,
+ 'args': [data['offset']],
+ })
+
+ type_aliases['Pin'] = 'STM32_GPIO_%s_t::Pin' % data['type']
+ type_aliases['PinArray'] = 'STM32_GPIO_%s_t::PinArray' % data['type']
+
+env.Jinja2('gpio.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases, type_aliases = type_aliases)
+
+Return('sources')