diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-08-07 22:20:45 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-08-07 22:21:31 +0200 |
commit | fd0e6e3aa0e7523a36011a2f0264737772aa5e24 (patch) | |
tree | 9ada25e6f4d072e2fc01ca62120cc416af8fc716 /templates | |
parent | 535d856a39b177642724bcfe6009985bf4262dbd (diff) | |
download | kicad-utils-fd0e6e3aa0e7523a36011a2f0264737772aa5e24.tar.gz kicad-utils-fd0e6e3aa0e7523a36011a2f0264737772aa5e24.tar.bz2 kicad-utils-fd0e6e3aa0e7523a36011a2f0264737772aa5e24.tar.xz kicad-utils-fd0e6e3aa0e7523a36011a2f0264737772aa5e24.zip |
templates: nodemcu-arduino: NodeMCU with Arduino.
o Moving headers so they match the namespace they declare.
o Reducing debug logging.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/arduino-uno.py | 4 | ||||
-rw-r--r-- | templates/intel-quark-d2000.py | 3 | ||||
-rw-r--r-- | templates/nodemcu-arduino.py | 65 | ||||
-rw-r--r-- | templates/nodemcu.py | 19 |
4 files changed, 69 insertions, 22 deletions
diff --git a/templates/arduino-uno.py b/templates/arduino-uno.py index a7b4ec7..ada59a3 100644 --- a/templates/arduino-uno.py +++ b/templates/arduino-uno.py @@ -4,7 +4,7 @@ generateHeader.println(""" namespace schematic { """) -usages = generateHeader.netlist.find_usages_of(generateHeader.ref) +usages = generateHeader.netlist.find_nets_using_ref(generateHeader.ref) for usage in usages: node = usage.node_for_ref(generateHeader.ref) @@ -12,7 +12,7 @@ for usage in usages: if 7 <= node.pin <= 12: generateHeader.println("static const int ANALOG_" + usage.name + " = " + str(node.pin - 7) + ";") elif 13 <= node.pin <= 26: - generateHeader.println("static const int ANALOG_" + usage.name + " = " + str(node.pin - 13) + ";") + generateHeader.println("static const int " + usage.name + " = " + str(node.pin - 13) + ";") generateHeader.println(""" } // namespace schematic diff --git a/templates/intel-quark-d2000.py b/templates/intel-quark-d2000.py index 85572c5..5bc69e0 100644 --- a/templates/intel-quark-d2000.py +++ b/templates/intel-quark-d2000.py @@ -1,4 +1,5 @@ global generateHeader + gpio_map = { 2: '10', 3: '11', @@ -40,7 +41,7 @@ enum schematic_direction { }; """) -usages = generateHeader.netlist.find_usages_of(generateHeader.ref) +usages = generateHeader.netlist.find_nets_using_ref(generateHeader.ref) for usage in usages: node = usage.node_for_ref(generateHeader.ref) diff --git a/templates/nodemcu-arduino.py b/templates/nodemcu-arduino.py new file mode 100644 index 0000000..1f258e6 --- /dev/null +++ b/templates/nodemcu-arduino.py @@ -0,0 +1,65 @@ +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: '9', # SD2 + 12: '10', # SD3 + 13: None, # RSV + 14: None, # RSV + 15: '0', # A0 + + # Right side + 16: '16', + 17: '5', + 18: '4', + 19: '0', + 20: '2', + 21: None, # 3V3 + 22: None, # Gnd + 23: '14', + 24: '12', + 25: '13', + 26: '15', + 27: '3', + 28: '1', + 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 +""") diff --git a/templates/nodemcu.py b/templates/nodemcu.py deleted file mode 100644 index a7b4ec7..0000000 --- a/templates/nodemcu.py +++ /dev/null @@ -1,19 +0,0 @@ -global generateHeader - -generateHeader.println(""" -namespace schematic { -""") - -usages = generateHeader.netlist.find_usages_of(generateHeader.ref) - -for usage in usages: - node = usage.node_for_ref(generateHeader.ref) - - if 7 <= node.pin <= 12: - generateHeader.println("static const int ANALOG_" + usage.name + " = " + str(node.pin - 7) + ";") - elif 13 <= node.pin <= 26: - generateHeader.println("static const int ANALOG_" + usage.name + " = " + str(node.pin - 13) + ";") - -generateHeader.println(""" -} // namespace schematic -""") |