1# -*- m4 -*-
2#
3#                            COPYRIGHT
4#
5#   PCB, interactive printed circuit board design
6#   Copyright (C) 2003, 2005 Dan McMahill
7#
8#   This program is free software; you can redistribute it and/or modify
9#   it under the terms of the GNU General Public License as published by
10#   the Free Software Foundation; either version 2 of the License, or
11#   (at your option) any later version.
12#
13#   This program is distributed in the hope that it will be useful,
14#   but WITHOUT ANY WARRANTY; without even the implied warranty of
15#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#   GNU General Public License for more details.
17#
18#   You should have received a copy of the GNU General Public License along
19#   with this program; if not, write to the Free Software Foundation, Inc.,
20#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21#
22#
23#
24#  Bourns Specific Footprints
25
26
27# Surface mount trim pots, such as the 3224 series.
28#
29# $1: canonical name
30# $2: name on PCB
31# $3: value
32# $4: pin 1,3 width (1/100 mm)     width is in the direction parallel to the
33# $5: pin 1,3 length (1/100 mm)    line which intersects pins 1 and 3
34# $6: pin 2 width (1/100 mm)
35# $7: pin 2 length (1/100 mm)
36# $8: spacing from pad center to pad center between 2 and 1,3 (1/100 mm)
37# $9: spacing from pad center to pad center between 1 and 3 (1/100 mm)
38# $10: package width (1/100 mm)
39
40define(`PKG_BOURNS_GENERIC_POT',
41       `
42	# pin 1,3 width, length (1/100 mm)
43	define(`W13',  `$4')
44	define(`L13',  `$5')
45
46	# pin 2 width, length (1/100 mm)
47	define(`W2',  `$6')
48	define(`L2',  `$7')
49
50	# spacing from pad center to pad center between 2 and 1,3 (1/100 mm)
51	define(`S12', `$8')
52	# spacing from pad center to pad center between 1 and 3 (1/100 mm)
53	define(`S13', `$9')
54
55	# package width (1/100 mm)
56	define(`WIDTH', `$10')
57
58	# silkscreen width (mils)
59	define(`SILKW', `10')
60
61	# how much space to leave around the part before the
62	# silk screen (mils)
63	define(`SILKS', `8')
64	# lower right corner for silk screen (mil)
65	ifelse(eval(L2 > L13), 1
66		define(`SILKX', `eval((S12+L2)*50/254 + SILKS + SILKW/2)'),
67		define(`SILKX', `eval((S12+L13)*50/254 + SILKS + SILKW/2)')
68	)
69	define(`SILKY', `eval((WIDTH/2)*100/254 + SILKS + SILKW/2)')
70
71	# refdes text size (mil)
72	define(`TEXTSIZE', 100)
73	# x,y coordinates for refdes label (mil)
74	define(`TEXTX', -SILKX)
75	define(`TEXTY', `eval(-SILKY - 10 - TEXTSIZE/2)')
76
77Element(0x00 "$1" "`$2'" "$3" TEXTX TEXTY 0 TEXTSIZE 0x00)
78(
79
80# pin 1
81ifelse(0, eval(W13>L13),
82	# Pads which have the perpendicular pad dimension less
83	# than or equal to the parallel pad dimension
84	Pad(eval( (S12 - L13 + W13)*50/254) eval( S13*50/254)
85            eval( (S12 + L13 - W13)*50/254) eval( S13*50/254) eval(W13*100/254) "1" 0x100)
86        ,
87	# Pads which have the perpendicular pad dimension greater
88	# than or equal to the parallel pad dimension
89	Pad(eval( (S12 + L13)*50/254) eval((-S13 - W13 + L13)*50/254)
90            eval( (S12 + L13)*50/254) eval((-S13 + W13 - L13)*50/254) eval(L13*100/254) "1" 0x100)
91	)
92
93# pin 2
94ifelse(0, eval(W2>L2),
95	# Pads which have the perpendicular pad dimension less
96	# than or equal to the parallel pad dimension
97	Pad(eval( (-S12 - L2 + W2)*50/254) 0
98            eval( (-S12 + L2 - W2)*50/254) 0 eval(W2*100/254) "2" 0x100)
99        ,
100	# Pads which have the Y (width) pad dimension greater
101	# than or equal to the X (length) pad dimension
102	Pad(eval( -S12*50/254) eval((- W2 + L2)*50/254)
103            eval( -S12*50/254) eval((  W2 - L2)*50/254) eval(L2*100/254) "2" 0x100)
104	)
105
106# pin 3
107ifelse(0, eval(W13>L13),
108	# Pads which have the perpendicular pad dimension less
109	# than or equal to the parallel pad dimension
110	Pad(eval( (S12 - L13 + W13)*50/254) eval(-S13*50/254)
111            eval( (S12 + L13 - W13)*50/254) eval(-S13*50/254) eval(W13*100/254) "3" 0x100)
112        ,
113	# Pads which have the perpendicular pad dimension greater
114	# than or equal to the parallel pad dimension
115	Pad(eval( (S12 + L13)*50/254) eval((-S13 - W13 + L13)*50/254)
116            eval( (S12 + L13)*50/254) eval((-S13 + W13 - L13)*50/254) eval(L13*100/254) "3" 0x100)
117	)
118
119# Silk screen around package
120ElementLine( SILKX  SILKY  SILKX -SILKY SILKW)
121ElementLine( SILKX -SILKY -SILKX -SILKY SILKW)
122ElementLine(-SILKX -SILKY -SILKX  SILKY SILKW)
123ElementLine(-SILKX  SILKY  SILKX  SILKY SILKW)
124
125# Mark at the center of the part
126Mark(0 0)
127)')
128
129# -------------------------------------------------------------------
130
131# EXTRACT_BEGIN
132
133
134#
135##  Bourns 3224 Series SMT Trim Pot
136#
137
138define(`PKG_BOURNS_3224G',  `PKG_BOURNS_GENERIC_POT(`$1',`$2',`$3',
139	`127', `127', `200', `127', `520', `230', `480')')
140define(`PKG_BOURNS_3224J',  `PKG_BOURNS_GENERIC_POT(`$1',`$2',`$3',
141	`130', `200', `200', `200', `400', `230', `480')')
142define(`PKG_BOURNS_3224W',  `PKG_BOURNS_GENERIC_POT(`$1',`$2',`$3',
143	`130', `160', `200', `160', `290', `254', `480')')
144define(`PKG_BOURNS_3224X',  `PKG_BOURNS_GENERIC_POT(`$1',`$2',`$3',
145	`132', `190', `200', `190', `510', `254', `480')')
146
147# EXTRACT_END
148
149