aboutsummaryrefslogtreecommitdiff
path: root/templates/arduino-uno.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-08-05 15:03:14 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-08-05 15:03:14 +0200
commit535d856a39b177642724bcfe6009985bf4262dbd (patch)
tree4162702b31cff209a859ad22de426c7b83d38830 /templates/arduino-uno.py
parentff87ea9045a6e0979311ae7b25055d6b53b0a13d (diff)
downloadkicad-utils-535d856a39b177642724bcfe6009985bf4262dbd.tar.gz
kicad-utils-535d856a39b177642724bcfe6009985bf4262dbd.tar.bz2
kicad-utils-535d856a39b177642724bcfe6009985bf4262dbd.tar.xz
kicad-utils-535d856a39b177642724bcfe6009985bf4262dbd.zip
o More flexible parsing. More rules needs to be updated.
Diffstat (limited to 'templates/arduino-uno.py')
-rw-r--r--templates/arduino-uno.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/templates/arduino-uno.py b/templates/arduino-uno.py
new file mode 100644
index 0000000..a7b4ec7
--- /dev/null
+++ b/templates/arduino-uno.py
@@ -0,0 +1,19 @@
+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
+""")