Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/ics.m4

raw
1 divert(-1)
2
3 `Macros defining some integrated circuits and connectors for LaTeX'
4
5 `A sequence of pins along the east or west side of a chip:
6 lg_pinseq(initial pin no, final pin no,
7 e|w, initial offset, pinnum_root, Labelroot, [N])'
8 `e.g., lg_pinseq(1,8,w)'
9 define(`lg_pinseq',`for_($1,$2,1,
10 `lg_pin( Chip.s`$3'+(0,($4+m4x)*lg_pinsep),
11 $6`'m4x,Pin`'eval($5`'m4x),`$3'`$7',eval($5`'m4x))') ')
12
13 define(`ic_tiny',`iflatex(`\hbox{\tiny `$1'}',ifsvg(`svg_small(`$1')',`$1'))')
14 define(`ic_tilde',`iflatex(`{\raisebox{-0.5ex}{\char126}}',~)')
15
16 define(`m4_1',`regexp(`$1',^\([^:]*\):.*,\1)')
17 define(`m4_2',`regexp(`$1',^[^:]*:\([^:]*\):?.*,\1)')
18 define(`m4_3',`regexp(`$1',^[^:]*:[^:]*:\([^:]*\):?.*,\1)')
19 define(`m4_4',`regexp(`$1',^[^:]*:[^:]*:[^:]*:\([^:]*\):?.*,\1)')
20
21 `ic4017( keys )
22 keys: pinsep=expr; (lg_pinsep)
23 pincount=expr; (12 per side)
24 hght=expr; ((pincount+1)*pinsep)
25 wdth=expr; (0.6*hght)
26 box=attributes; (shaded light blue)'
27 define(`ic4017',`[ pushkeys_(`$1',`pinsep:lg_pinsep; pincount:12;
28 hght:(m4`'pincount+1)*m4`'pinsep; wdth:0.6*m4`'hght;
29 box:shaded LTtmpcolr:N')dnl
30 Chip: box wid m4wdth ht m4hght m4box "`4017'"
31 foreach_(`t',`ifelse(t,nul,,`lg_pin(
32 Chip.nw-(0,m4_1(t)*lg_pinsep),m4_2(t),Pin`'m4_3(t), w`'m4_4(t), m4_3(t))')',
33 1:CLK:14:E:, 2:CKEN:13:N:, 4:Reset:15)
34 foreach_(`t',`ifelse(t,nul,,`lg_pin(
35 Chip.ne-(0,m4_1(t)*lg_pinsep),m4_2(t),Pin`'m4_3(t), e`'m4_4(t), m4_3(t))')',
36 1:Q0:3:E, 2:Q1:2:N, 3:Q2:4, 4:Q3:7, 5:Q4:10, 6:Q5:1, 7:Q6:5, 8:Q7:6, 9:Q8:9,
37 10:Q9:11,12:C$_{\rm out}$:12)
38 lg_pin(Chip.n,VDD,Pin16,n,16)
39 lg_pin(Chip.s,VSS,Pin18,s,8)
40 `$2' popdef(`m4pinsep',`m4pincount',`m4hght',`m4wdth',`m4box') ]')
41
42 define(`ic6116',`[ Chip: box wid_ lg_chipwd ht_ 15*lg_pinsep
43 lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin12,w,12)
44 lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(CS),Pin18,wN,18)
45 lg_pinseq(0,2,w,4,9+,D)
46 lg_pinseq(3,7,w,4,10+,D)
47 lg_pin(Chip.sw_+(0,13*lg_pinsep),R/lg_bartxt(W),Pin21,w,21)
48 lg_pin(Chip.sw_+(0,14*lg_pinsep),V`'ic_tiny(CC),Pin24,w,24)
49 lg_pin(Chip.se_+(0,lg_pinsep),lg_bartxt(OE),Pin20,eN,20)
50 lg_pinseq(0,7,e,3,8-,A)
51 lg_pinseq(8,9,e,3,31-,A)
52 lg_pin(Chip.se_+(0,13*lg_pinsep),A10,Pin19,e,19)
53 `$1']')
54
55 define(`ic6502',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
56 lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),Pin21,w,21)
57 lg_pin(Chip.sw_+(0,2*lg_pinsep),V`'ic_tiny(SS),Pin1,w,1)
58 lg_pin(Chip.sw_+(0,4*lg_pinsep),R/lg_bartxt(W),Pin34,w,34)
59 lg_pinseq(0,7,w,6,33-,D)
60 lg_pin(Chip.sw_+(0,15*lg_pinsep),lg_bartxt(RESET),Pin40,wN,40)
61 lg_pin(Chip.sw_+(0,17*lg_pinsep),SYNC,Pin7,w,7)
62 lg_pin(Chip.sw_+(0,19*lg_pinsep),lg_bartxt(NMI),Pin6,wN,6)
63 lg_pin(Chip.sw_+(0,21*lg_pinsep),RDY,Pin2,w,2)
64 lg_pin(Chip.sw_+(0,22*lg_pinsep),SO,Pin38,w,38)
65 lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),Pin8,w,8)
66 lg_pin(Chip.se_+(0,lg_pinsep),CK`'ic_tiny(1)(in),Pin39,e,39)
67 lg_pin(Chip.se_+(0,4*lg_pinsep),
68 CK`'ic_tiny(2)(out),Pin37,e,37)
69 lg_pinseq(0,11,e,6,9+,A)
70 lg_pinseq(12,15,e,6,10+,A)
71 lg_pin(Chip.se+(0,23*lg_pinsep),lg_bartxt(IRQ),Pin4,eN,4)
72 `$1']')
73
74 define(`ic6522',`[ Chip: box wid_ lg_chipwd ht_ 24*lg_pinsep
75 lg_pin(Chip.sw_+(0,lg_pinsep),V`'ic_tiny(SS),Pin1,w,1)
76 lg_pin(Chip.sw_+(0,3*lg_pinsep),CS1,Pin24,w,24)
77 lg_pin(Chip.sw_+(0,4*lg_pinsep),CK,Pin25,w,25)
78 lg_pin(Chip.sw_+(0,5*lg_pinsep),lg_bartxt(CS2),Pin23,wN,23)
79 lg_pin(Chip.sw_+(0,7*lg_pinsep),RS0(A0),Pin38,w,38)
80 lg_pin(Chip.sw_+(0,8*lg_pinsep),RS1(A1),Pin37,w,37)
81 lg_pin(Chip.sw_+(0,9*lg_pinsep),RS2(A2),Pin36,w,36)
82 lg_pin(Chip.sw_+(0,10*lg_pinsep),RS3(A3),Pin35,w,35)
83 lg_pinseq(0,7,w,12,33-,D)
84 lg_pin(Chip.sw_+(0,21*lg_pinsep),R/lg_bartxt(W),Pin22,w,22)
85 lg_pin(Chip.sw_+(0,22*lg_pinsep),lg_bartxt(IRQ),Pin21,wN,21)
86 lg_pin(Chip.sw_+(0,23*lg_pinsep),V`'ic_tiny(CC),Pin20,w,20)
87 lg_pinseq(0,7,e,1,10+,PB)
88 lg_pinseq(1,2,e,8,17+,CB)
89 lg_pinseq(0,7,e,12,2+,PA)
90 lg_pinseq(1,2,e,19,41-,CA)
91 lg_pin(Chip.se_+(0,23*lg_pinsep),lg_bartxt(RESET),Pin34,eN,34)
92 `$1']')
93
94 define(`ic74LS138',`[ Chip: box wid_ lg_chipwd ht_ 11*lg_pinsep
95 lg_pin(Chip.sw_+(0,lg_pinsep),GND,Pin8,w,8)
96 lg_pin(Chip.sw_+(0,2*lg_pinsep),lg_bartxt(G2a),Pin4,wN,4)
97 lg_pin(Chip.sw_+(0,3*lg_pinsep),lg_bartxt(G2b),Pin5,wN,5)
98 lg_pin(Chip.sw_+(0,5*lg_pinsep),A,Pin1,w,1)
99 lg_pin(Chip.sw_+(0,6*lg_pinsep),B,Pin2,w,2)
100 lg_pin(Chip.sw_+(0,7*lg_pinsep),C,Pin3,w,3)
101 lg_pin(Chip.sw_+(0,9*lg_pinsep),G1,Pin6,w,6)
102 lg_pin(Chip.sw_+(0,10*lg_pinsep),V`'ic_tiny(CC),Pin16,w,16)
103 lg_pinseq(0,6,e,2,15-,Y,n)
104 lg_pin(Chip.se_+(0,9*lg_pinsep),Y7,Pin7,eN,7)
105 `$1']')
106
107 define(`ic555DIP',`[ Chip: DIP_chip_outline(8)
108 foreach_(`x',
109 `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)',
110 GND, TR, OUT, RESET)
111 foreach_(`x',
112 `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+4),e,eval(m4Lx+4))',
113 CTRL, THR, DIS, Vcc)
114 `$1']')
115
116 define(`ic4017DIP',`[ Chip: DIP_chip_outline(16)
117 foreach_(`x',
118 `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)',
119 PL, Q3, I3, I0, CLE, Q0, TC, GND)
120 foreach_(`x',
121 `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))',
122 MR, U/D, Q1, I1, I2, Q2, CLK, Vcc)
123 `$1']')
124
125 define(`ic4510DIP',`[ Chip: DIP_chip_outline(16)
126 foreach_(`x',
127 `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)',
128 PL, Q3, I3, I0, CLE, Q0, TC, GND)
129 foreach_(`x',
130 `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+8),e,eval(m4Lx+8))',
131 MR, U/D, Q1, I1, I2, Q2, CLK, Vcc)
132 `$1']')
133
134 define(`icVS1053DIP',`[ Chip: DIP_chip_outline(32)
135 foreach_(`x',
136 `lg_pin(Chip.nw-(0,lg_pinsep*m4Lx),x,Pin`'m4Lx,w,m4Lx)',
137 LOUT,ROUT,GBUF,AGND,AGND,DREG,Vcc,3V3,GND,MISO,MOSI,sclk,RST,CS,DCS,DCS)
138 foreach_(`x',
139 `lg_pin(Chip.se+(0,lg_pinsep*m4Lx),x,Pin`'eval(m4Lx+16),e,eval(m4Lx+16))',
140 SDCD,RX,TX,7,6,5,4,3,2,1,0,GND,3V3,AGND,MIC`$-$',MIC`$+$')
141 `$1']')
142
143 `DIP_chip_outline( pin count, wid )'
144 define(`DIP_chip_outline',
145 `[ pushdef(`m4pinct',`ifelse(`$1',,16,`$1')')dnl
146 pushdef(`m4chgw',`ifelse(`$2',,(18*L_unit),`$2')')dnl
147 Chip: box invis wid m4chgw ht lg_pinsep*eval((m4pinct)/2+1)
148 arcd(Chip.n, lg_pinsep/2, 180, 360)
149 { line to Chip.ne chop -linewid bp__/2 }
150 { line from last arc.start to Chip.nw chop -linewid bp__/2 }
151 line from Chip.nw to Chip.sw then to Chip.se then to Chip.ne
152 `$3'] popdef(`m4pinct',`m4chgw') ')
153
154 `DIP( pin count, attributes)
155 Dual in-line package
156 attributes=semicolon-separated list of optional terms:
157 bodywid=expr; (default 0.25 = 5*L_unit )
158 bodylen=expr; (default pin count/2 x pinpitch)
159 pinpitch=expr; (default 0.1)
160 pinwid=expr; (default 0.06)
161 pinlen=expr; (default 0.05)
162 direct=U|D|L|R;(default U for up)
163 type=I|Q; (default I for uniform-length pins;
164 Q: staggered) '
165 define(`DIP',`[ pinct= ifelse(`$1',,8,`$1')
166 setkeys_(`$2',
167 bodywid: 5*L_unit;
168 bodylen: m4pinpitch*int(pinct/2+0.5);
169 pinpitch:2*L_unit;
170 pinwid: 1.2*L_unit;
171 pinlen: L_unit;
172 direct:U:N;
173 type:I:N)
174 setdir_(m4direct,U)
175 Body: box ht_ m4bodywid wid_ m4bodylen
176 arcs = ifelse(m4_dir_,right,90,m4_dir_,up,180,m4_dir_,left,270,0)
177 arcd(Body.e_, 0.1/2, arcs,arcs+180)
178 np2 = int(pinct/2+0.5)
179 define(`m4bxht',`m4pinlen ifelse(m4type,Q,`*(1+(i%%2))')')dnl
180 for i=0 to np2-1 do {
181 exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \
182 with .s_ at (i+0.5)/np2 between Body.ne_ and Body.nw_",i+1) }
183 for i=np2+1 to pinct do {
184 exec sprintf("Pin%g: box ht_ m4bxht wid_ m4pinwid \
185 with .n_ at (i-np2-0.5)/(pinct-np2) between Body.sw_ and Body.se_",i) }
186 `$3'; resetdir_
187 popdef(`m4bodywid',`m4bodylen',`m4pinpitch',`m4pinwid',`m4pinlen',`m4direct',
188 `m4type') ]'))
189 `There is more than one way to draw an IC and
190 label its pins; here is one:'
191 `LT3724( keys ) IC in a [] block
192 keys: pinsep=expr; (0.25)
193 pincount=expr; (8 per side)
194 hght=expr; ((pincount+1)*pinsep)
195 wdth=expr; (0.6*hght)
196 box=attributes; (shaded light blue)
197 8 pins per side; pin labels
198 VIN, SHDN, CSS, BURST_EN, VFB, VC, SYNC, FSET,
199 SGND, SENSEM, SENSEP, PGND, VCC, SW, TG, BOOST'
200 define(`LT3724',`[ pushkeys_(`$1',`pinsep:0.25; pincount:8;
201 hght:(m4`'pincount+1)*m4`'pinsep; wdth:0.6*m4`'hght;
202 box:shaded LTtmpcolr:N')dnl
203 define LTtmpcolr {rgbstring(0.9,0.96,1)}
204 Chip: box wid m4wdth ht m4hght m4box "`LT3724'" ; undefine LTtmpcolr
205 foreach_(`m4hx',`ifelse(m4hx,nil,,
206 `patsubst(m4hx,^[^:]*:): Chip.nw-(0,m4Lx*m4hght/(m4pincount+1))
207 "patsubst(m4hx,:.*)" ljust at Chip.nw-(0,m4Lx*m4hght/(m4pincount+1))')',
208 V$_{\hbox{\tiny IN}}$:VIN, SHDN, C$_{\hbox{\tiny SS}}$:CSS,
209 BURST\_EN:BURST_EN, V$_{\hbox{\tiny FB}}$:VFB, V$_{\hbox{\tiny C}}$:VC, SYNC,
210 f$_{\hbox{\tiny SET}}$:FSET)
211 line right_ 23bp__ from SHDN+(textoffset,textht/2+4bp__)
212 foreach_(`m4hx',`ifelse(m4hx,nil,,
213 `patsubst(m4hx,^[^:]*:): Chip.se+(0,m4Lx*m4hght/(m4pincount+1))
214 "patsubst(m4hx,:.*)" rjust at Chip.se+(0,m4Lx*m4hght/(m4pincount+1))')',
215 SGND, SENSE$^-$:SENSEM, SENSE$^+$:SENSEP, PGND,
216 V$_{\hbox{\tiny CC}}$:VCC, SW, TG, BOOST)
217 `$2' popdef(`m4pinsep',`m4pincount',`m4hght',`m4wdth',`m4box') ]')
218
219 `Here is another way to draw an IC and
220 label its pins:'
221 `LT3757( keys ) IC in a [] block
222 keys: pinsep=expr; (0.25)
223 pincount=expr; (8 per side)
224 hght=expr; ((pincount+1)*pinsep)
225 wdth=expr; (0.6*hght)'
226 `8 pins per side; pin labels
227 top: VIN; left: SHU, SYNC, RT, SS;
228 right: GATE, SENSE, FBX;
229 bottom: VC, GND, INTVCC'
230 define(`LT3757',`[ pushkeys_(`$1',`pinsep:0.25; pincount:8;
231 hght:(m4`'pincount+1)*m4`'pinsep; wdth:0.6*m4`'hght')dnl
232 Chip: box wid m4wdth ht m4hght shaded rgbstring(0.9,0.96,1) "`LT3757'" above
233 VIN: Chip.n; "$V_{\hbox{\tiny IN}}$" at VIN below
234 foreach_(`LL',`m43757label(nw,sw,ljust, m4pincount, patsubst(LL,:,`,'))',
235 SHU:2:"SHDN/UVLO", SYNC:5, RT:7, SS:8)
236 line right_ 21bp__ from SHU+(textoffset,4bp__)
237 foreach_(`LL',`m43757label(se,ne,rjust, m4pincount,
238 patsubst(LL,:,`,'))', FBX:1, SENSE:3, GATE:5)
239 foreach_(`LL',`m43757label(sw,se,+(0,textht/3) above, m4pincount,
240 patsubst(LL,:,`,'))',
241 VC:1.5:"V$_{\hbox{\tiny C}}$", GND:5, INTVCC:7.5:"INTV$_{\hbox{\tiny CC}}$")
242 `$2' popdef(`m4pinsep',`m4pincount',`m4hght',`m4wdth') ]')
243 define(`m43757label',``$5': `$6'/(`$4'+1) between Chip.`$1' and Chip.`$2'
244 ifelse(`$7',,"`$5'",`$7') at `$5' `$3'')
245
246 `ArduinoUno( wid,ht,pinlen )'
247 define(`ArduinoUno',`[
248 pushdef(`m4bwid',`ifelse(`$1',,`24*L_unit',`$1')')dnl
249 pushdef(`m4bht',`ifelse(`$2',,`20*lg_pinsep',`$2')')dnl
250 #
251 Connector: box wid m4bwid ht m4bht
252 #
253 m4pl = ifelse(`$3',,`2*L_unit',`$3')
254 #
255 foreach_(`x',`ifelse(x,nul,,
256 `Pin`'eval(5+m4Lx): line left_ m4pl from Connector.nw-(0,(5+m4Lx)*lg_pinsep)
257 { "x" ljust at last line.start }')',
258 IOREF, RESET,$+${3}V3,$+${5}V, GND, GND, VIN,
259 nul, A0, A1, A2, A3, A4, A5)
260 #
261 foreach_(`x',`ifelse(x,nul,,
262 `Pin`'eval(22-m4Lx): line right_ m4pl from Connector.ne-(0,m4Lx*lg_pinsep)
263 { "x" rjust at last line.start }')',
264 SCL, SDA, AREF, GND, D13, D12, ic_tilde`'D11, ic_tilde`'D10, ic_tilde`'D9, D8,
265 nul, D7, ic_tilde`'D6, ic_tilde`'D5, D4, ic_tilde`'D3, D2, TX D1, RX D0)
266 #
267 `$4'] popdef(`m4bwid',`m4bht') ')
268
269 `ArduinoLeonardo( wid,ht,pinlen )'
270 define(`ArduinoLeonardo',`[
271 pushdef(`m4bwid',`ifelse(`$1',,`24*L_unit',`$1')')dnl
272 pushdef(`m4bht',`ifelse(`$2',,`20*lg_pinsep',`$2')')dnl
273 #
274 Connector: box wid m4bwid ht m4bht
275 #
276 m4pl = ifelse(`$3',,`2*L_unit',`$3')
277 #
278 foreach_(`x',`ifelse(x,nul,,
279 `Pin`'eval(5+m4Lx): line left_ m4pl from Connector.nw-(0,(5+m4Lx)*lg_pinsep)
280 { "x" ljust at last line.start }')',
281 IOREF, RESET,$+${3}V3,$+${5}V, GND, GND, VIN,
282 nul, A0, A1, A2, A3, A4, A5)
283 #
284 foreach_(`x',`ifelse(x,nul,,
285 `Pin`'eval(22-m4Lx): line right_ m4pl from Connector.ne-(0,m4Lx*lg_pinsep)
286 { "x" rjust at last line.start }')',
287 SCL, SDA, AREF, GND,
288 ic_tilde`'D13, D12, ic_tilde`'D11, ic_tilde`'D10, ic_tilde`'D9, D8,
289 nul, D7, ic_tilde`'D6, ic_tilde`'D5, D4, ic_tilde`'D3, D2, TX D1, RX D0)
290 #
291 `$4'] popdef(`m4bwid',`m4bht') ') # `ArduinoLeonardo'
292
293 `RPi( wid,ht,pinlen )' # Raspberry Pi connector
294 define(`RPi',`[
295 pushdef(`m4bwid',`ifelse(`$1',,`34*L_unit',`$1')')dnl
296 pushdef(`m4bht',`ifelse(`$2',,`21*lg_pinsep',`$2')')dnl
297 #
298 GPIO: box wid m4bwid ht m4bht
299 m4pl = ifelse(`$3',,`6*L_unit',`$3')
300 #
301 define A_LeftGPIO { dnl pin downcount, internal label , pin no above line
302 exec sprintf("Pin%g: line left_ m4pl from GPIO.nw-(0,%g)",\
303 2*(`$'1)-1,(`$'1)*lg_pinsep)
304 { "`$'3" ljust at last line.start }
305 "`$'2" at last line.c above }
306 #
307 foreach_(`x',`ifelse(x,nul,,`A_LeftGPIO(m4Lx,patsubst(x,;,`,'))')',
308 ;3V3,
309 2;SDA1, 3;SCL1, 4;GPIO\_GCLK,
310 ;GND,
311 17;GPIO\_GEN0, 27;GPIO\_GEN2, 22;GPIO\_GEN3,
312 ;3V3,
313 10;SPI\_MOSI, 9;SPI\_MISO, 11;SPI\_SCLK,
314 ;GND,
315 ;ID\_SD,
316 5;, 6;, 13;, 19;, 26;,
317 ;GND )
318 #
319 define A_RightGPIO { dnl pin downcount, internal label , pin no above line
320 exec sprintf("Pin%g: line right_ m4pl from GPIO.ne-(0,%g)",\
321 2*(`$'1),(`$'1)*lg_pinsep)
322 { "`$'3" rjust at last line.start }
323 "`$'2" at last line.c above }
324 #
325 foreach_(`x',`ifelse(x,nul,,`A_RightGPIO(m4Lx,patsubst(x,;,`,'))')',
326 ;5V,
327 ;5V,
328 ;GND,
329 14;TXD0, 15;RXD0, 18;GPIO\_GEN1,
330 ;GND,
331 23;GPIO\_GEN4, 24;GPIO\_GEN5,
332 ;GND,
333 25;GPIO\_GEN6, 8;SPI\_CEO\_N, 7;SPI\_CE1\_N,
334 ;ID\_SC,
335 ;GND,
336 12;,
337 ;GND,
338 16;, 20;, 21; )
339 #
340 `$4'] popdef(`m4bwid',`m4bht') ') # `RPi'
341
342 `USB_C_Socket( wid, ht, pinlen )'
343 define(`USB_C_Socket',`[
344 pushdef(`m4bwid',`ifelse(`$1',,`18*L_unit',`$1')')dnl
345 pushdef(`m4bht',`ifelse(`$2',,`14*lg_pinsep',`$2')')dnl
346 #
347 Base: box wid m4bwid ht m4bht rad 5/3*lg_pinsep
348 m4pl = ifelse(`$3',,`6*L_unit',`$3')
349 #
350 foreach_(`x',
351 `B`'eval(13-m4Lx): dnl
352 line left_ m4pl from Base.n-(m4bwid/2,(m4Lx+0.5)*lg_pinsep)
353 {"x" ljust at last line.start}',
354 GND, RX1`$+$', RX1`$-$', VBUS, SBU2, D`$-$', D`$+$', CC2, VBUS, TX2`$-$',
355 TX2`$+$', GND)
356 #
357 foreach_(`x',
358 `A`'m4Lx: line right_ m4pl from Base.n+(m4bwid/2,-(m4Lx+0.5)*lg_pinsep)
359 {"x" rjust at last line.start}',
360 GND, TX1`$+$', TX1`$-$', VBUS, CC1, D`$+$', D`$-$', SBU1, VBUS, RX2`$-$',
361 RX2`$+$', GND)
362 #
363 `$4'] popdef(`m4bwid',`m4bht') ')
364
365 `connDX( n,R|L|U|D|degrees,keys )'
366 `keys:
367 type=M|F;
368 lgth=expr;
369 wdth=expr; lgth*0.33
370 pindiam=expr; wdth/9
371 pin=attributes; '
372 define(`connDX',`pushdef(`m4n',`ifelse(`$1',,15,`$1')')dnl
373 pushkeys_(`$3',`type:M:N; lgth:(m4`'n+3)*dimen_/8;
374 wdth:m4`'lgth*0.33; pindiam:max(linewid*5bp__,m4`'wdth/9); pin::N;')dnl
375 [ setdir_(`$2')dnl
376 NW: vec_(0,m4lgth/2); SW: vec_(0,-m4lgth/2)
377 NE: vec_(m4wdth,m4lgth/2-m4wdth*sind(10))
378 SE: vec_(m4wdth,-m4lgth/2+m4wdth*sind(10))
379 W: 1/2 between SW and NW; move to W
380 arcto(NW,NE,m4wdth/5); arcto(NE,SE,m4wdth/5)
381 arcto(SE,SW,m4wdth/5); arcto(SW,W,m4wdth/5); line to W
382 np2 = int(m4n+1)/2
383 dv = m4lgth/(np2+1)
384 for i=1 to np2 do { M4X: SW+vec_(m4wdth/3,dv*i)
385 exec sprintf("T%g: dot(at M4X,circle=diam m4pindiam ifelse(m4type,M,
386 fill_(0)) m4pin,ifelse(m4type,M,0,1))",ifelse(m4type,M,i,np2+1-i)) }
387 for i=1 to np2-1 do { M4X: SW+vec_(m4wdth*2/3,dv*(i+1/2))
388 exec sprintf("T%g: dot(at M4X,circle=diam m4pindiam ifelse(m4type,M,
389 fill_(0)) m4pin,ifelse(m4type,M,0,1))",ifelse(m4type,M,np2+i,m4n+1-i)) }
390 resetdir_ ; `$4'] dnl
391 popdef(`m4n',`m4type',`m4lgth',`m4wdth', `m4pindiam', `m4pin' ) ')
392
393 `HDMI_micro( wid, ht, pinlen )'
394 define(`HDMI_micro',`[
395 pushdef(`m4bwid',`ifelse(`$1',,`16*L_unit',`$1')')dnl
396 pushdef(`m4bht',`ifelse(`$2',,`20*lg_pinsep+m4bwid*2/3',`$2')')dnl
397 #
398 Base:[line up m4bht/2 then right m4bwid*2/3 \
399 then right m4bwid/3 down m4bwid/3 \
400 then down m4bht-2*m4bwid/3 then down m4bwid/3 left m4bwid/3 \
401 then left m4bwid*2/3 then to Here]
402 m4pl = ifelse(`$3',,`6*L_unit',`$3')
403 #
404 foreach_(`x',
405 `Pin`'m4Lx: line left_ m4pl from Base.nw-(0,m4bwid/3+m4Lx*lg_pinsep)
406 {"x" ljust at last line.start}
407 "m4Lx" at last line.c above',
408 HPD, UTILITY, D2`$+$', D2\_SH, D2`$-$', D1`$+$', D1\_SH, D1`$-$',
409 D0`$+$', D0\_SH, D0`$-$', CLK`$+$', CLK\_SH, CLK`$-$',
410 CEC, GND, SCL, SDA,$+${5}V)
411 line from Base.nw+(m4bwid*2/3-lg_pinsep,0) up m4pl
412 r_text(,21,at last line.c+(-5bp__,0))
413 r_text(,SH2,at last line.start + (0,-10bp__))
414 line from Base.nw+(m4bwid*2/3-2*lg_pinsep,0) up m4pl
415 r_text(,20,at last line.c+(-5bp__,0))
416 r_text(,SH1,at last line.start + (0,-10bp__))
417 line from Base.sw+(m4bwid*2/3-lg_pinsep,0) down m4pl
418 r_text(,23,at last line.c+(-5bp__,0))
419 r_text(,SH4,at last line.start + (0, 10bp__))
420 line from Base.sw+(m4bwid*2/3-2*lg_pinsep,0) down m4pl
421 r_text(,22,at last line.c+(-5bp__,0))
422 r_text(,SH3,at last line.start + (0, 10bp__))
423 #
424 `$4'] popdef(`m4bwid',`m4bht') ')
425
426 divert(0)dnl
427 #efine LTtmpcolr {rgbstring(0.9,0.96,1)}
428 define LTtmpcolr {rgbstring(0.99,0.99,0.8)}