summaryrefslogtreecommitdiff
path: root/gpio/SConscript
blob: cf33ad4b9ac1168db43f1b956cdb8672608241ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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():
        # Default to v2, ie, everyone but f1
        real_type = data.get('type', 'v2')
        instances.append({
            'type': 'STM32_GPIO_%s_t' % real_type,
            'name': name,
            'args': [data['offset']],
        })

        type_aliases['Pin'] = 'STM32_GPIO_%s_t::Pin' % real_type
        type_aliases['PinArray'] = 'STM32_GPIO_%s_t::PinArray' % real_type

env.Jinja2('gpio.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases, type_aliases = type_aliases)

Return('sources')