summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/ConnectorsDPV.pic
blob: 1fe2aeabfac33f63a9b0920a7b9e6b770eb05ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
.PS
# ConnectorsDPV.m4
# log_init Version 10.1: SVG m4 macro settings.
  
  # gen_init Version 10.1: SVG m4 macro settings.
  

  define rpoint__ {
    rp_wid = last line.end.x-last line.start.x
    rp_ht = last line.end.y-last line.start.y
    rp_len = sqrt(abs((rp_wid)^2+(rp_ht)^2)); move to last line.start
    rp_ang = atan2(rp_ht,rp_wid) }

  rtod_ = 57.295779513082323;  dtor_ = 0.017453292519943295
  twopi_ = 6.2831853071795862;  pi_ = (twopi_/2)
  rp_ang = 0;  right
  
  
  linethick = 0.8
  arrowwid = 0.05*scale; arrowht = 0.1*scale
  
  
  # gen_init end


# log_init end



m4thtmp=textht;  dptextratio=0.71;     m4thtmp=textht; textht=(8.5*(scale/72))*dptextratio;   
command "<g style=\"font-family:sans-serif\"
>"
  
  
#vg_rot_init(test)

# svg_rot_init begin
 if dpicopt > 0 then { copy "/cygdrive/d/Dwight/lib/dpictools.pic" }
 
 
#                           Extract from the .svg file the x= y= coordinates
#                           that appear after each transform="rotate(.." line
 retcode = ( sh "awk -e \"/transform=\\"rotate/ { r=1 };       /x=\\".*y=\\"/ { if(r==1){ print; r=0 } }\" ConnectorsDPV.tmp   | sed -e \"s/x=\\"\([0-9.]*\)\\" y=\\"\([0-9.]*\)\\".*/\1 \2/\"   > ConnectorsDPV.cor" )
 if retcode != 0 then { print "
   Awk failure.
   Awk and sed are required by svg_rot to rotate svg text.
   " } 
 svgrot_k = 0
 define svg_rotcoords { if "$1" != "" then { svgrot_k += 1
   svg_rx[svgrot_k] = $1; svg_ry[svgrot_k] = $2 }
   }
 copythru(svg_rotcoords, ConnectorsDPV.cor)
 sh "rm -f ConnectorsDPV.tmp ConnectorsDPV.cor"
 svgrot_i = 0

 
#                          `svg_rot(degrees,"text",[at position]) 
#                           Rotate text degrees ccw
#                           Requires svg_rot_init(filename)
#                           which uses both awk and sed.
#                           The source must be processed twice by m4 and dpic.'
 define svg_rot { if retcode != 0 then {$2} else {
  if "$1" != "" then { svg_rang = -($1) } else { svg_rang = -90 }
  if svgrot_k != 0 then { svgrot_i +=1
    command sprintf("<g transform=\"rotate(%g %g %g)\">",svg_rang,\
      svg_rx[svgrot_i]+textht/2*sin((svg_rang)*dtor_),\
      svg_ry[svgrot_i]+textht/2*(1-cos((svg_rang)*dtor_))) }\
  else { command sprintf("<g transform=\"rotate(%g)\">",svg_rang) }
  if "$3"=="" then { $2 } \
  else { $2 $3 - (sin((svg_rang)*dtor_),(cos((svg_rang)*dtor_)-1))*textht/2 }
 command "</g>" } }
 
 
# svg_rot_init end
 

# ArduinoUno
# "Arduino Uno Rev 3" at last [].Connector.s below
 Ar:  [
  #
 Connector: box wid 24*(linewid/10) ht 20*(3*(linewid/10))
#
 plen = 2*(linewid/10)
#
Pin6: line  left plen from Connector.nw-(0,(5+1)*(3*(linewid/10)))
  { "IOREF" ljust at last line.start }
Pin7: line  left plen from Connector.nw-(0,(5+2)*(3*(linewid/10)))
  { "RESET" ljust at last line.start }
Pin8: line  left plen from Connector.nw-(0,(5+3)*(3*(linewid/10)))
  { "<tspan font-style=\"italic\">+</tspan>3V3" ljust at last line.start }
Pin9: line  left plen from Connector.nw-(0,(5+4)*(3*(linewid/10)))
  { "<tspan font-style=\"italic\">+</tspan>5V" ljust at last line.start }
Pin10: line  left plen from Connector.nw-(0,(5+5)*(3*(linewid/10)))
  { "GND" ljust at last line.start }
Pin11: line  left plen from Connector.nw-(0,(5+6)*(3*(linewid/10)))
  { "GND" ljust at last line.start }
Pin12: line  left plen from Connector.nw-(0,(5+7)*(3*(linewid/10)))
  { "VIN" ljust at last line.start }

Pin14: line  left plen from Connector.nw-(0,(5+9)*(3*(linewid/10)))
  { "A0" ljust at last line.start }
Pin15: line  left plen from Connector.nw-(0,(5+10)*(3*(linewid/10)))
  { "A1" ljust at last line.start }
Pin16: line  left plen from Connector.nw-(0,(5+11)*(3*(linewid/10)))
  { "A2" ljust at last line.start }
Pin17: line  left plen from Connector.nw-(0,(5+12)*(3*(linewid/10)))
  { "A3" ljust at last line.start }
Pin18: line  left plen from Connector.nw-(0,(5+13)*(3*(linewid/10)))
  { "A4" ljust at last line.start }
Pin19: line  left plen from Connector.nw-(0,(5+14)*(3*(linewid/10)))
  { "A5" ljust at last line.start }

#
Pin21: line  right plen from Connector.ne-(0,1*(3*(linewid/10)))
  { "SCL" rjust at last line.start }
Pin20: line  right plen from Connector.ne-(0,2*(3*(linewid/10)))
  { "SDA" rjust at last line.start }
Pin19: line  right plen from Connector.ne-(0,3*(3*(linewid/10)))
  { "AREF" rjust at last line.start }
Pin18: line  right plen from Connector.ne-(0,4*(3*(linewid/10)))
  { "GND" rjust at last line.start }
Pin17: line  right plen from Connector.ne-(0,5*(3*(linewid/10)))
  { "~D13" rjust at last line.start }
Pin16: line  right plen from Connector.ne-(0,6*(3*(linewid/10)))
  { "D12" rjust at last line.start }
Pin15: line  right plen from Connector.ne-(0,7*(3*(linewid/10)))
  { "~D11" rjust at last line.start }
Pin14: line  right plen from Connector.ne-(0,8*(3*(linewid/10)))
  { "~D10" rjust at last line.start }
Pin13: line  right plen from Connector.ne-(0,9*(3*(linewid/10)))
  { "~D9" rjust at last line.start }
Pin12: line  right plen from Connector.ne-(0,10*(3*(linewid/10)))
  { "D8" rjust at last line.start }

Pin10: line  right plen from Connector.ne-(0,12*(3*(linewid/10)))
  { "D7" rjust at last line.start }
Pin9: line  right plen from Connector.ne-(0,13*(3*(linewid/10)))
  { "~D6" rjust at last line.start }
Pin8: line  right plen from Connector.ne-(0,14*(3*(linewid/10)))
  { "~D5" rjust at last line.start }
Pin7: line  right plen from Connector.ne-(0,15*(3*(linewid/10)))
  { "D4" rjust at last line.start }
Pin6: line  right plen from Connector.ne-(0,16*(3*(linewid/10)))
  { "~D3" rjust at last line.start }
Pin5: line  right plen from Connector.ne-(0,17*(3*(linewid/10)))
  { "D2" rjust at last line.start }
Pin4: line  right plen from Connector.ne-(0,18*(3*(linewid/10)))
  { "TX D1" rjust at last line.start }
Pin3: line  right plen from Connector.ne-(0,19*(3*(linewid/10)))
  { "RX D0" rjust at last line.start }

#
 ]  #with .sw at last [].se+(0.25,0)
  "Arduino Leonardo" at last [].Connector.s below

 RPI: [
      #
 GPIO: box wid 34*(linewid/10) ht 21*(3*(linewid/10))
 plen = 6*(linewid/10)
#
define A_LeftGPIO {
 exec sprintf("Pin%g: line  left plen from GPIO.nw-(0,%g)",\
  2*($1)-1,($1)*(3*(linewid/10)))
  { "$3" ljust at last line.start }
  "$2" at last line.c above }
#
A_LeftGPIO(1,,3V3)
A_LeftGPIO(2,2,SDA1)
A_LeftGPIO(3,3,SCL1)
A_LeftGPIO(4,4,GPIO_GCLK)
A_LeftGPIO(5,,GND)
A_LeftGPIO(6,17,GPIO_GEN0)
A_LeftGPIO(7,27,GPIO_GEN2)
A_LeftGPIO(8,22,GPIO_GEN3)
A_LeftGPIO(9,,3V3)
A_LeftGPIO(10,10,SPI_MOSI)
A_LeftGPIO(11,9,SPI_MISO)
A_LeftGPIO(12,11,SPI_SCLK)
A_LeftGPIO(13,,GND)
A_LeftGPIO(14,,ID_SD)
A_LeftGPIO(15,5,)
A_LeftGPIO(16,6,)
A_LeftGPIO(17,13,)
A_LeftGPIO(18,19,)
A_LeftGPIO(19,26,)
A_LeftGPIO(20,,GND )

#
define A_RightGPIO {
 exec sprintf("Pin%g: line  right plen from GPIO.ne-(0,%g)",\
  2*($1),($1)*(3*(linewid/10)))
  { "$3" rjust at last line.start }
  "$2" at last line.c above }
#
A_RightGPIO(1,,5V)
A_RightGPIO(2,,5V)
A_RightGPIO(3,,GND)
A_RightGPIO(4,14,TXD0)
A_RightGPIO(5,15,RXD0)
A_RightGPIO(6,18,GPIO_GEN1)
A_RightGPIO(7,,GND)
A_RightGPIO(8,23,GPIO_GEN4)
A_RightGPIO(9,24,GPIO_GEN5)
A_RightGPIO(10,,GND)
A_RightGPIO(11,25,GPIO_GEN6)
A_RightGPIO(12,8,SPI_CEO_N)
A_RightGPIO(13,7,SPI_CE1_N)
A_RightGPIO(14,,ID_SC)
A_RightGPIO(15,,GND)
A_RightGPIO(16,12,)
A_RightGPIO(17,,GND)
A_RightGPIO(18,16,)
A_RightGPIO(19,20,)
A_RightGPIO(20,21, )
 
#
 ]  with .sw at last [].se+(0.25,0)
  "Raspberry Pi 4 GPIO" at last [].GPIO.s below

 HD: [
  #
 Base:[line up 19*(3*(linewid/10))+16*(linewid/10)*2/3/2 then right 16*(linewid/10)*2/3 \
  then right 16*(linewid/10)/3 down 16*(linewid/10)/3 \
  then down 19*(3*(linewid/10))+16*(linewid/10)*2/3-2*16*(linewid/10)/3 then down 16*(linewid/10)/3 left 16*(linewid/10)/3 \
  then left 16*(linewid/10)*2/3 then to Here]
 plen = 6*(linewid/10)
#
 Pin1: line  left plen from Base.nw-(0,16*(linewid/10)/3+(1-1/2)*(3*(linewid/10)))
   {"HPD" ljust at last line.start}
   "1" at last line.c above
Pin2: line  left plen from Base.nw-(0,16*(linewid/10)/3+(2-1/2)*(3*(linewid/10)))
   {"UTILITY" ljust at last line.start}
   "2" at last line.c above
Pin3: line  left plen from Base.nw-(0,16*(linewid/10)/3+(3-1/2)*(3*(linewid/10)))
   {"D2<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
   "3" at last line.c above
Pin4: line  left plen from Base.nw-(0,16*(linewid/10)/3+(4-1/2)*(3*(linewid/10)))
   {"D2_SH" ljust at last line.start}
   "4" at last line.c above
Pin5: line  left plen from Base.nw-(0,16*(linewid/10)/3+(5-1/2)*(3*(linewid/10)))
   {"D2<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
   "5" at last line.c above
Pin6: line  left plen from Base.nw-(0,16*(linewid/10)/3+(6-1/2)*(3*(linewid/10)))
   {"D1<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
   "6" at last line.c above
Pin7: line  left plen from Base.nw-(0,16*(linewid/10)/3+(7-1/2)*(3*(linewid/10)))
   {"D1_SH" ljust at last line.start}
   "7" at last line.c above
Pin8: line  left plen from Base.nw-(0,16*(linewid/10)/3+(8-1/2)*(3*(linewid/10)))
   {"D1<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
   "8" at last line.c above
Pin9: line  left plen from Base.nw-(0,16*(linewid/10)/3+(9-1/2)*(3*(linewid/10)))
   {"D0<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
   "9" at last line.c above
Pin10: line  left plen from Base.nw-(0,16*(linewid/10)/3+(10-1/2)*(3*(linewid/10)))
   {"D0_SH" ljust at last line.start}
   "10" at last line.c above
Pin11: line  left plen from Base.nw-(0,16*(linewid/10)/3+(11-1/2)*(3*(linewid/10)))
   {"D0<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
   "11" at last line.c above
Pin12: line  left plen from Base.nw-(0,16*(linewid/10)/3+(12-1/2)*(3*(linewid/10)))
   {"CLK<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
   "12" at last line.c above
Pin13: line  left plen from Base.nw-(0,16*(linewid/10)/3+(13-1/2)*(3*(linewid/10)))
   {"CLK_SH" ljust at last line.start}
   "13" at last line.c above
Pin14: line  left plen from Base.nw-(0,16*(linewid/10)/3+(14-1/2)*(3*(linewid/10)))
   {"CLK<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
   "14" at last line.c above
Pin15: line  left plen from Base.nw-(0,16*(linewid/10)/3+(15-1/2)*(3*(linewid/10)))
   {"CEC" ljust at last line.start}
   "15" at last line.c above
Pin16: line  left plen from Base.nw-(0,16*(linewid/10)/3+(16-1/2)*(3*(linewid/10)))
   {"GND" ljust at last line.start}
   "16" at last line.c above
Pin17: line  left plen from Base.nw-(0,16*(linewid/10)/3+(17-1/2)*(3*(linewid/10)))
   {"SCL" ljust at last line.start}
   "17" at last line.c above
Pin18: line  left plen from Base.nw-(0,16*(linewid/10)/3+(18-1/2)*(3*(linewid/10)))
   {"SDA" ljust at last line.start}
   "18" at last line.c above
Pin19: line  left plen from Base.nw-(0,16*(linewid/10)/3+(19-1/2)*(3*(linewid/10)))
   {"<tspan font-style=\"italic\">+</tspan>5V" ljust at last line.start}
   "19" at last line.c above

L1: line from Base.nw+(16*(linewid/10)*2/3-(3*(linewid/10)),0) up plen
 svg_rot(90,"21",at last line.c +(-4*(scale/72),0))
 svg_rot(90,"SH2",at last line.start + (4*(scale/72),-8*(scale/72)))
 line from Base.nw+(16*(linewid/10)*2/3-2*(3*(linewid/10)),0) up plen
 svg_rot(90,"20",at last line.c+(-4*(scale/72),0))
 svg_rot(90,"SH1",at last line.start + (4*(scale/72),-8*(scale/72)))
 line from Base.sw+(16*(linewid/10)*2/3-(3*(linewid/10)),0) down plen
 svg_rot(90,"23",at last line.c+(-4*(scale/72),0))
 svg_rot(90,"SH4",at last line.start + (4*(scale/72),14*(scale/72)))
 line from Base.sw+(16*(linewid/10)*2/3-2*(3*(linewid/10)),0) down plen
 svg_rot(90,"22",at last line.c+(-4*(scale/72),0))
 svg_rot(90,"SH3",at last line.start + (4*(scale/72),14*(scale/72)))
#
 ] with .nw at last [].ne+(0.25,0.5)
  "Micro" rjust at HD.Base.sw "HDMI" rjust

 S: [
  #
 Base: box wid 18*(linewid/10) ht 14*(3*(linewid/10)) rad 5/3*(3*(linewid/10))
 plen = 6*(linewid/10)
#
 B12:   line  left plen from Base.n-(18*(linewid/10)/2,(1+0.5)*(3*(linewid/10)))
   {"GND" ljust at last line.start}
B11:   line  left plen from Base.n-(18*(linewid/10)/2,(2+0.5)*(3*(linewid/10)))
   {"RX1<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
B10:   line  left plen from Base.n-(18*(linewid/10)/2,(3+0.5)*(3*(linewid/10)))
   {"RX1<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
B9:   line  left plen from Base.n-(18*(linewid/10)/2,(4+0.5)*(3*(linewid/10)))
   {"VBUS" ljust at last line.start}
B8:   line  left plen from Base.n-(18*(linewid/10)/2,(5+0.5)*(3*(linewid/10)))
   {"SBU2" ljust at last line.start}
B7:   line  left plen from Base.n-(18*(linewid/10)/2,(6+0.5)*(3*(linewid/10)))
   {"D<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
B6:   line  left plen from Base.n-(18*(linewid/10)/2,(7+0.5)*(3*(linewid/10)))
   {"D<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
B5:   line  left plen from Base.n-(18*(linewid/10)/2,(8+0.5)*(3*(linewid/10)))
   {"CC2" ljust at last line.start}
B4:   line  left plen from Base.n-(18*(linewid/10)/2,(9+0.5)*(3*(linewid/10)))
   {"VBUS" ljust at last line.start}
B3:   line  left plen from Base.n-(18*(linewid/10)/2,(10+0.5)*(3*(linewid/10)))
   {"TX2<tspan font-style=\"italic\">-</tspan>" ljust at last line.start}
B2:   line  left plen from Base.n-(18*(linewid/10)/2,(11+0.5)*(3*(linewid/10)))
   {"TX2<tspan font-style=\"italic\">+</tspan>" ljust at last line.start}
B1:   line  left plen from Base.n-(18*(linewid/10)/2,(12+0.5)*(3*(linewid/10)))
   {"GND" ljust at last line.start}

#
 A1: line  right plen from Base.n+(18*(linewid/10)/2,-(1+0.5)*(3*(linewid/10)))
   {"GND" rjust at last line.start}
A2: line  right plen from Base.n+(18*(linewid/10)/2,-(2+0.5)*(3*(linewid/10)))
   {"TX1<tspan font-style=\"italic\">+</tspan>" rjust at last line.start}
A3: line  right plen from Base.n+(18*(linewid/10)/2,-(3+0.5)*(3*(linewid/10)))
   {"TX1<tspan font-style=\"italic\">-</tspan>" rjust at last line.start}
A4: line  right plen from Base.n+(18*(linewid/10)/2,-(4+0.5)*(3*(linewid/10)))
   {"VBUS" rjust at last line.start}
A5: line  right plen from Base.n+(18*(linewid/10)/2,-(5+0.5)*(3*(linewid/10)))
   {"CC1" rjust at last line.start}
A6: line  right plen from Base.n+(18*(linewid/10)/2,-(6+0.5)*(3*(linewid/10)))
   {"D<tspan font-style=\"italic\">+</tspan>" rjust at last line.start}
A7: line  right plen from Base.n+(18*(linewid/10)/2,-(7+0.5)*(3*(linewid/10)))
   {"D<tspan font-style=\"italic\">-</tspan>" rjust at last line.start}
A8: line  right plen from Base.n+(18*(linewid/10)/2,-(8+0.5)*(3*(linewid/10)))
   {"SBU1" rjust at last line.start}
A9: line  right plen from Base.n+(18*(linewid/10)/2,-(9+0.5)*(3*(linewid/10)))
   {"VBUS" rjust at last line.start}
A10: line  right plen from Base.n+(18*(linewid/10)/2,-(10+0.5)*(3*(linewid/10)))
   {"RX2<tspan font-style=\"italic\">-</tspan>" rjust at last line.start}
A11: line  right plen from Base.n+(18*(linewid/10)/2,-(11+0.5)*(3*(linewid/10)))
   {"RX2<tspan font-style=\"italic\">+</tspan>" rjust at last line.start}
A12: line  right plen from Base.n+(18*(linewid/10)/2,-(12+0.5)*(3*(linewid/10)))
   {"GND" rjust at last line.start}

#
 ] with .sw at (HD.e.x+0.25,RPI.s.y)
 "USB-C Socket" at S.Base.s below
 "B12" at S.B12.end above ljust
 "B1" at S.B1.end above ljust
 "A1" at S.A1.end above rjust
 "A12" at S.A12.end above rjust

 command "</g>"

.PE