make script better conform to clang-format style

This commit is contained in:
Jeff Epler 2020-12-01 19:44:41 -06:00
parent 5668a80450
commit d73ab01598

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3
def defines(name, suffix):
print(f'const can_function {name} [] = {{')
print(f'const can_function {name}[] = {{')
for instance in (0, 1):
for function in 'HI':
for port in 'ABCD':
@ -9,21 +9,20 @@ def defines(name, suffix):
pin = f'P{port}{idx:02d}'
pinmux = f'PINMUX_{pin}{function}_CAN{instance}_{suffix}'
print(f'''\
#if defined({pinmux}) && ! defined(IGNORE_PIN_{pin})
#if defined({pinmux}) && !defined(IGNORE_PIN_{pin})
{{PIN_{pin} >> 5, PIN_{pin} & 0x1f, {instance}, {pinmux} & 0xf}},
#endif''')
print(f'}};')
print()
print('''\
struct can_function {
unsigned port:3;
unsigned pin:5;
unsigned instance:1;
unsigned mux:4;
unsigned port : 3;
unsigned pin : 5;
unsigned instance : 1;
unsigned mux : 4;
};
''')
defines('can_rx', 'RX')
print()
defines('can_tx', 'TX')