working on footprint for LCD selected for TirePyro
authorBdale Garbee <bdale@gag.com>
Sat, 24 Apr 2021 14:29:42 +0000 (08:29 -0600)
committerBdale Garbee <bdale@gag.com>
Sat, 24 Apr 2021 14:29:42 +0000 (08:29 -0600)
packages/NHD-C0216CZ.py [new file with mode: 0755]

diff --git a/packages/NHD-C0216CZ.py b/packages/NHD-C0216CZ.py
new file mode 100755 (executable)
index 0000000..62dfa38
--- /dev/null
@@ -0,0 +1,128 @@
+#!/usr/bin/python2
+# Copyright 2021 by Bdale Garbee <bdale@gag.com>.  GPLv3
+#
+# Program to emit PCB footprint for NHD-C0216CZ-FSW-FBW-3V3 2x16 text LCD
+#
+
+# dimensions in mm from NHD-C0216CZ-FSW-FBW-3V3.pdf datasheet
+BodyWidth = 41.4
+BodyHeight = 24.3
+BodyHeightOffset = -0.75       # pin row to body edge distance
+PinDiam = 0.7
+PinSpacing = 1.50
+Pins = 10
+ViewWidth = 34.22
+ViewHeight = 8.76
+ViewHCtr = 15.8 / 2 + 7.6 - BodyHeight / 2
+
+import sys
+
+# we're going to use the 1/100 of a mil fundamental unit form
+def mm2mils100( mm ):
+       return int( mm / 25.4 * 1000.0 * 100.0 + 0.5 )
+
+print '# author: Bdale Garbee'
+print '# email: bdale@gag.com'
+print '# dist-license: GPL 3'
+print '# use-license: unlimited'
+
+print 'Element[0x0 "NHD-C0216CZ" "" "" 0 0 0 0 0 100 0x0]'
+print "("
+
+# pins
+       # pin( x y thickness clearance mask drillhole name number flags)
+for pin in range (1,Pins+1):
+    if pin == 1:
+        Flags = '0x0101'
+    else:
+        Flags = '0x0001'
+
+    print '   Pin[',\
+       mm2mils100((pin - 5.5)*PinSpacing), \
+       mm2mils100(-BodyHeight/2), \
+       mm2mils100(PinDiam * 1.75), \
+       1200, \
+       mm2mils100(PinDiam * 1.75) + 600, \
+       mm2mils100(PinDiam), \
+       '"pin%i"' % (pin), '"%i"' % (pin), Flags, ']'
+
+print '   ElementLine[',\
+       -mm2mils100(BodyWidth/2), \
+       -mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       mm2mils100(BodyWidth/2), \
+       -mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+print '   ElementLine[',\
+       -mm2mils100(BodyWidth/2), \
+       -mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       -mm2mils100(BodyWidth/2), \
+       mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+print '   ElementLine[',\
+       -mm2mils100(BodyWidth/2), \
+       mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       mm2mils100(BodyWidth/2), \
+       mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+print '   ElementLine[',\
+       mm2mils100(BodyWidth/2), \
+       mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       mm2mils100(BodyWidth/2), \
+       -mm2mils100(BodyHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+# mark viewable area
+
+print '   ElementLine[',\
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print '   ElementLine[',\
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print '   ElementLine[',\
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print '   ElementLine[',\
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print '   ElementLine[',\
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print '   ElementLine[',\
+       mm2mils100(-ViewWidth/2), \
+       mm2mils100(ViewHCtr - ViewHeight/2-BodyHeightOffset), \
+       mm2mils100(ViewWidth/2), \
+       mm2mils100(ViewHCtr + ViewHeight/2-BodyHeightOffset), \
+       500, \
+       ']'
+
+print ")"