From 78640707f40f31f408f159ad88a585e47bb5b2c2 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 9 Jun 2012 22:28:58 -0300 Subject: [PATCH] components/: generate for connectors CONN_1 to CONN_40X2 (in gencon.lib) This creates name collisions with manually created connectors in con.lib, which we may want to resolve. --- components/EXPAND | 81 +++++++++++++++++++++++++++++++++++++++ components/Makefile | 13 +++++-- components/components.pro | 1 + components/gencon.pl | 39 +++++++++++++++++++ 4 files changed, 130 insertions(+), 4 deletions(-) create mode 100755 components/gencon.pl diff --git a/components/EXPAND b/components/EXPAND index 09eb00d..fbd3572 100644 --- a/components/EXPAND +++ b/components/EXPAND @@ -27,6 +27,87 @@ Codec Audio wm9707scft/v Connector + Generated + conn_1 + conn_2 + conn_3 + conn_4 + conn_5 + conn_6 + conn_7 + conn_8 + conn_9 + conn_10 + conn_11 + conn_12 + conn_13 + conn_14 + conn_15 + conn_16 + conn_17 + conn_18 + conn_19 + conn_20 + conn_21 + conn_22 + conn_23 + conn_24 + conn_25 + conn_26 + conn_27 + conn_28 + conn_29 + conn_30 + conn_31 + conn_32 + conn_33 + conn_34 + conn_35 + conn_36 + conn_37 + conn_38 + conn_39 + conn_40 + conn_1x2 + conn_2x2 + conn_3x2 + conn_4x2 + conn_5x2 + conn_6x2 + conn_7x2 + conn_8x2 + conn_9x2 + conn_10x2 + conn_11x2 + conn_12x2 + conn_13x2 + conn_14x2 + conn_15x2 + conn_16x2 + conn_17x2 + conn_18x2 + conn_19x2 + conn_20x2 + conn_21x2 + conn_22x2 + conn_23x2 + conn_24x2 + conn_25x2 + conn_26x2 + conn_27x2 + conn_28x2 + conn_29x2 + conn_30x2 + conn_31x2 + conn_32x2 + conn_33x2 + conn_34x2 + conn_35x2 + conn_36x2 + conn_37x2 + conn_38x2 + conn_39x2 + conn_40x2 Generic TESTPOINT conn_2 diff --git a/components/Makefile b/components/Makefile index 3377813..1724e19 100644 --- a/components/Makefile +++ b/components/Makefile @@ -4,6 +4,8 @@ # Note that we don't have the concept of a "library of everything" so far. # +GEN = gencon.lib + .PHONY: all sch catalog view upload missing clean spotless all: sch @@ -11,13 +13,13 @@ all: sch # @echo "make what ? targets: sch loe" # @exit 1 -sch: +sch: $(GEN) eeschema `pwd`/components.sch DESCR-dcm: *.dcm ../scripts/dcm2desc -L . >$@ || { rm -f $@; exit 1; } -catalog catalog.pdf: EXPAND DESCR-dcm *.lib +catalog catalog.pdf: EXPAND DESCR-dcm *.lib $(GEN) genex -p -L . EXPAND DESCR-dcm >catalog.pdf || \ { rm -f catalog.pdf; exit 1; } @@ -27,9 +29,12 @@ view: catalog.pdf upload: catalog.pdf qippl catalog.pdf tmp/kicad-libs-components.pdf -missing: +missing: $(GEN) ../scripts/missing-in-tree -L . EXPAND +%.lib: %.pl + ./$< >$@ || { rm -f $@; exit 1; } + #loe: # ./mkloe @@ -37,4 +42,4 @@ clean: rm -f DESCR-dcm spotless: clean - rm -f catalog.pdf + rm -f catalog.pdf $(GEN) diff --git a/components/components.pro b/components/components.pro index d40650c..4c24883 100644 --- a/components/components.pro +++ b/components/components.pro @@ -137,3 +137,4 @@ LibName65=./con LibName66=./hole LibName67=./diode LibName68=./powered +LibName69=./gencon diff --git a/components/gencon.pl b/components/gencon.pl new file mode 100755 index 0000000..7918bb9 --- /dev/null +++ b/components/gencon.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +# +# gencon.pl - Generate generic connectors +# +# Copyright 2012 by Werner Almesberger +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# + +print "EESchema-LIBRARY Version 2.3 Date: `date`\n"; +print "#encoding utf-8\n"; +for ($x = 1; $x <= 40; $x++) { + for ($y = 1; $y <= 2; $y++) { + $name = "CONN_$x"; + $name .= "X$y" if $y > 1; + print "#\n# $name\n#\n"; + print "DEF $name CON 0 40 Y N 1 F N\n"; + $h = $x/2*100; + print "F0 \"CON\" 0 ".($h+50)." 60 H V C CNN\n"; + print "F1 \"$name\" 0 ".(-$h-50)." 60 H V C CNN\n"; + print "DRAW\n"; + print "S -100 -$h 100 $h 0 1 0 N\n"; + $n = 1; + for ($px = 1; $px <= $x; $px++) { + for ($py = 1; $py <= $y; $py++) { + print "X $n $n ".(400*($py-1.5)*2)." ". + ($h-$px*100+50)." 300 ". + ("?", "R", "L")[$py]." 50 50 1 1 P\n"; + $n++; + } + } + print "ENDDRAW\n"; + print "ENDDEF\n"; + } +} +print "#\n#End Library\n";