global generateHeader gpio_map = { # Left side 1: None, # Vin 2: None, # GND 3: None, # RST 4: None, # EN 5: None, # 3V3 6: None, # GND 7: None, # CLK 8: None, # SD0 9: None, # CMD 10: None, # SD1 11: 'D9', # SD2 12: 'D10', # SD3 13: None, # RSV 14: None, # RSV 15: 'D0', # A0 # Right side 16: 'D16', 17: 'D5', 18: 'D4', 19: 'D0', 20: 'D2', 21: None, # 3V3 22: None, # Gnd 23: 'D14', 24: 'D12', 25: 'D13', 26: 'D15', 27: 'D3', 28: 'D1', 29: None, # GND 30: None, # 3V3 } usages = generateHeader.netlist.find_nets_using_ref(generateHeader.ref) entries = [] for usage in usages: if usage.name is None: continue node = usage.node_for_ref(generateHeader.ref) name = gpio_map.get(node.pin) if name is None: continue entries.append([usage.name, name]) generateHeader.println(""" namespace schematic { """) for x in sorted(entries, key=lambda e: e[0]): generateHeader.println("static const int " + x[0]+ " = " + x[1] + ";") generateHeader.println(""" } // namespace schematic """)