circuitscript 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,50 +3,117 @@
3
3
  import lib
4
4
 
5
5
  def fuse(value):
6
+ width = 40
7
+ height = 20
6
8
  return create component:
7
9
  pins: 2
10
+ type: "F"
11
+ display: create graphic:
12
+ rect: 0, 0, width, height
13
+ pin: 1, -width/2-20, 0, -width/2, 0
14
+ pin: 2, width/2+20, 0, width/2, 0
15
+ hline: -width/2, 0, width
16
+ label: "refdes", -width/2, -height/2 - 5, "?"
17
+ label: "value", -width/2, height/2 + 2, "?", fontSize=8, vanchor="top"
8
18
  params:
9
19
  value: value
10
20
 
11
- def esd(value):
12
- return create component:
13
- pins: 2
21
+ def esd():
22
+ width = 40
23
+ height = 20
14
24
 
15
- def ind(value):
16
25
  return create component:
17
26
  pins: 2
18
- params:
19
- value: value
27
+ type: "Z"
28
+ display: create graphic:
29
+ fill: "#333"
30
+ triangle: -width/2, 0, 0, 0, 20
31
+ triangle: width/2, 0, 0, 0, 20
32
+ path: "M", 5, -height/2-5, "L", 0, -height/2, "L", 0, height/2, "L", -5, height/2+5
33
+ pin: 1, -width/2 - 20, 0, -width/2, 0
34
+ pin: 2, width/2+20, 0, width/2, 0
35
+ label: "refdes", 0, -height/2 - 10, "?", anchor="middle"
36
+ label: "mpn", 0, height/2 + 15, "PGB1010604", anchor="middle"
20
37
 
38
+
21
39
  def gnd_connect():
22
40
  return create component:
23
41
  pins: 2
24
42
 
25
- def diode():
26
- return create component:
27
- pins: 2
28
-
29
43
  def xtal(frequency):
44
+ width = 30
45
+ height = 10
46
+
30
47
  return create component:
31
- pins:
32
- 1: "XT1"
33
- 2: "XT2"
34
- 3: "GND"
35
- arrange:
36
- right: 1,2
37
- left: 3
48
+ type: "X"
49
+ pins: 3
50
+ display: create graphic:
51
+ rect: 0, 0, width, height
52
+ hline: -width/2 -2, -height/2-4, width + 4
53
+ hline: -width/2 -2, height/2+4, width + 4
54
+ hline: 0, -20, -10
55
+ vline: -10, -25, 10
56
+ vline: -15, -25, 10
57
+ hline: 0, 20, -10
58
+ vline: -10, 15, 10
59
+ vline: -15, 15, 10
60
+ hline: -15, -20, -25
61
+ hline: -15, 20, -25
62
+ vline: -40, -20, 40
63
+
64
+ label: "refdes", width/2 + 5, 0, "?"
65
+ label: "frequency", width/2 + 5, 10, "?"
66
+
67
+ pin: 1, 0, -20, 0, -height/2 - 4
68
+ pin: 2, 0, 20, 0, height/2 + 4
69
+ pin: 3, -60, 0, -40, 0
70
+
38
71
  params:
39
72
  frequency: frequency
40
73
 
74
+ def xtal_2(freq):
75
+ # only have 2 pins
76
+ width = 20
77
+ height = 40
78
+
79
+ return create component:
80
+ type: "X"
81
+ pins: 2
82
+ display: create graphic:
83
+ rect: 0, 0, width, height
84
+ fill: "#333"
85
+ rect: -width/2 - 5, 0, 1, height
86
+ rect: width/2 + 5, 0, 1, height
87
+ fill: "none"
88
+ pin: 1, -width/2 - 20, 0, -width/2-5, 0
89
+ pin: 2, width/2 + 20, 0, width/2+5, 0
90
+ label: "refdes", 0, -height/2 - 5, "?", anchor="middle"
91
+ label: "freq", 0, height/2 + 5, freq, vanchor="top", anchor="middle"
92
+ params:
93
+ freq: freq
94
+
41
95
  def solder_bridge():
96
+ width = 20
97
+ height = 20
98
+
42
99
  return create component:
100
+ type: "S"
43
101
  pins: 2
102
+ display: create graphic:
103
+ arc: -width/2+5, 0, 10, 90, 270
104
+ arc: width/2-5, 0, 10, 270, 90
105
+ vline: -width/2 + 5, -height/2, height
106
+ vline: width/2-5, -height/2, height
107
+ pin: 1, -width/2-20, 0, -width/2-5, 0
108
+ pin: 2, width/2+20, 0, width/2+5, 0
109
+ label: "refdes", 0, -width/2 - 5, "?", anchor="middle"
44
110
 
45
111
  gnd = dgnd()
46
112
  v3v3 = supply("3V3")
47
113
  v5v = supply("5V")
48
114
 
49
115
  atmega = create component:
116
+ type: "ic"
50
117
  pins:
51
118
  1: "XTAL1"
52
119
  2: "XTAL2"
@@ -58,7 +125,7 @@ atmega = create component:
58
125
  5: "PC2"
59
126
  26: "PC4"
60
127
  25: "PC5"
61
- 24: "PC6"
128
+ 23: "PC6"
62
129
  22: "PC7"
63
130
 
64
131
  6: "PD0"
@@ -94,9 +161,12 @@ atmega = create component:
94
161
  arrange:
95
162
  left: 24, [2], 2, [2], 1, [6], 32, 4, 3, [5], 27, 31, 30, 29, 28, [2], 100
96
163
  right: 21,20,19,18,17,16,15,14, [2], 22,23,25,26,5, [2], 13,12,11,10,9,8,7,6
164
+ params:
165
+ mpn: "ATMEGA8U2-MU"
97
166
 
98
167
 
99
168
  atmega8 = create component:
169
+ type: "ic"
100
170
  pins:
101
171
  1: "RESET"
102
172
 
@@ -137,56 +207,143 @@ atmega8 = create component:
137
207
  arrange:
138
208
  left: 1, [3], 10, [1], 9, [2], 21, 20, 22, [2], 7,8
139
209
  right: 19,18,17,16,15,14, [3], 28,27,26,25,24,23, [3], 13, 12, 11, 6,5,4,3,2
210
+ params:
211
+ mpn: "ATMEGA8"
140
212
 
141
213
  # Oscillator component
142
- osc1 = xtal(16000000)
143
- osc2 = xtal(16000000)
144
- osc3 = xtal(16000000)
214
+ osc1 = xtal("16MHz")
215
+ osc2 = xtal("16MHz")
216
+
217
+ def conn3x2():
218
+ width = 60
219
+ height = 80
220
+
221
+ return create component:
222
+ pins: 6
223
+ display: create graphic:
224
+ rect: 0, 0, width, height
225
+ pin: 1, "1", -width/2 - 20, -20, -width/2, -20
226
+ pin: 3, "3", -width/2 - 20, 0, -width/2, 0
227
+ pin: 5, "5", -width/2 - 20, 20, -width/2, 20
228
+ pin: 2, "2", width/2 + 20, -20, width/2, -20
229
+ pin: 4, "4", width/2 + 20, 0, width/2, 0
230
+ pin: 6, "6", width/2 + 20, 20, width/2, 20
231
+ label: "refdes", -width/2, -height/2 - 5, "?", fontSize=10, anchor="left", vanchor="bottom"
232
+ circle: -10, -20, 8
233
+ circle: -10, 0, 8
234
+ circle: -10, 20, 8
235
+ circle: 10, -20, 8
236
+ circle: 10, 0, 8
237
+ circle: 10, 20, 8
145
238
 
146
239
  # ICSP connector
147
- icsp_conn2 = create component:
148
- pins: 6
149
- arrange:
150
- left: 1,3,5
151
- right: 2,4,6
240
+ icsp_conn2 = conn3x2()
241
+ icsp_conn = conn3x2()
152
242
 
153
- icsp_conn = create component:
154
- pins: 6
155
- arrange:
156
- left: 1,3,5
157
- right: 2,4,6
243
+ def usb_conn_():
244
+ width = 40
245
+ height = 100
158
246
 
159
- # USB connector
160
- usb_conn = create component:
161
- pins:
162
- 1: 1
163
- 2: 2
164
- 3: 3
165
- 4: 4
166
- 5: "SHIELD1"
167
- 6: "SHIELD2"
168
- type: "conn"
169
- arrange:
170
- right: 1,2,3,4
171
- left: 5,6
247
+ return create component:
248
+ pins: 6
249
+ display: create graphic:
250
+ #rect: 0, 0, width, 100
251
+ path: "M", -20, -40, "L", 20, -40, "L", 20, 60, "L", -20, 60
172
252
 
253
+ label: "", 0, 15, "USB", anchor="middle", fontSize=20, angle=-90
173
254
 
174
- iol_conn = create component:
175
- pins: 8
176
- arrange:
177
- left: 8,7,6,5,4,3,2,1
255
+ pin: 1, width/2 + 20, -20, width/2, -20
256
+ pin: 2, width/2 + 20, 0, width/2, 0
257
+ pin: 3, width/2 + 20, 20, width/2, 20
258
+ pin: 4, width/2 + 20, 40, width/2, 40
178
259
 
179
- ad_conn = create component:
180
- pins: 6
181
- type: "conn"
182
- arrange:
183
- left: 6,5,4,3,2,1
260
+ pin: 5, -20, 60+ 20, -20, 60
261
+ pin: 6, 0, 60 + 20, 0, 60
184
262
 
185
- ioh_conn = create component:
186
- pins: 8
187
- type: "conn"
188
- arrange:
189
- left: 8,7,6,5,4,3,2,1
263
+ def conn8():
264
+ return create component:
265
+ type: "conn"
266
+ pins: 8
267
+ display: create graphic:
268
+ rect: 0, -70, 40, 180
269
+ circle: 0, 0, 8
270
+ circle: 0, -20, 8
271
+ circle: 0, -40, 8
272
+ circle: 0, -60, 8
273
+ circle: 0, -80, 8
274
+ circle: 0, -100, 8
275
+ circle: 0, -120, 8
276
+ circle: 0, -140, 8
277
+
278
+ label: "refdes", -20, -160-4, "?"
279
+ label: "mpn", -20, 20 + 4, "?", vanchor="top"
280
+
281
+ pin: 1, -40, 0, -20, 0
282
+ pin: 2, -40, -20, -20, -20
283
+ pin: 3, -40, -40, -20, -40
284
+ pin: 4, -40, -60, -20, -60
285
+ pin: 5, -40, -80, -20, -80
286
+ pin: 6, -40, -100, -20, -100
287
+ pin: 7, -40, -120, -20, -120
288
+ pin: 8, -40, -140, -20, -140
289
+
290
+ def conn6_flipped():
291
+ return create component:
292
+ type: "conn"
293
+ pins: 6
294
+ display: create graphic:
295
+ rect: 0, 2.5 * -20, 40, (6+1) * 20
296
+ circle: 0, 0, 8
297
+ circle: 0, -20, 8
298
+ circle: 0, -40, 8
299
+ circle: 0, -60, 8
300
+ circle: 0, -80, 8
301
+ circle: 0, -100, 8
302
+
303
+ label: "refdes", -20, 6 * -20 - 5, "?"
304
+ label: "mpn", -20, 20 + 4, "?", vanchor="top"
305
+
306
+ pin: 6, -40, 0, -20, 0
307
+ pin: 5, -40, -20, -20, -20
308
+ pin: 4, -40, -40, -20, -40
309
+ pin: 3, -40, -60, -20, -60
310
+ pin: 2, -40, -80, -20, -80
311
+ pin: 1, -40, -100, -20, -100
312
+
313
+ def conn6():
314
+ return create component:
315
+ type: "conn"
316
+ pins: 6
317
+ display: create graphic:
318
+ rect: 0, 2.5 * -20, 40, (6+1) * 20
319
+ circle: 0, 0, 8
320
+ circle: 0, -20, 8
321
+ circle: 0, -40, 8
322
+ circle: 0, -60, 8
323
+ circle: 0, -80, 8
324
+ circle: 0, -100, 8
325
+
326
+ label: "refdes", -20, 6 * -20 - 5, "?"
327
+ label: "mpn", -20, 20 + 4, "?", vanchor="top"
328
+
329
+ pin: 1, -40, 0, -20, 0
330
+ pin: 2, -40, -20, -20, -20
331
+ pin: 3, -40, -40, -20, -40
332
+ pin: 4, -40, -60, -20, -60
333
+ pin: 5, -40, -80, -20, -80
334
+ pin: 6, -40, -100, -20, -100
335
+
336
+ iol_conn = conn8()
337
+ iol_conn.mpn = "IOL"
338
+
339
+ ioh_conn = conn8()
340
+ ioh_conn.mpn = "IOH"
341
+
342
+ ad_conn = conn6()
343
+ ad_conn.mpn = "AD"
344
+
345
+ # USB connector
346
+ usb_conn = usb_conn_()
190
347
 
191
348
  at atmega:
192
349
  32:
@@ -200,6 +357,7 @@ at atmega:
200
357
  to atmega pin 4
201
358
  wire left 40 down 20
202
359
  add cap(100n)
360
+ wire down 20
203
361
  to gnd
204
362
 
205
363
  3:
@@ -213,6 +371,8 @@ at atmega:
213
371
  wire left 20
214
372
 
215
373
  add solder_bridge() pin 2
374
+ ..refdes = "GROUND"
375
+
216
376
  wire left 20
217
377
  branch:
218
378
  wire auto
@@ -223,12 +383,12 @@ at atmega:
223
383
  24:
224
384
  wire left 40
225
385
  branch:
226
- wire left 240 up 200 right 40
386
+ wire left 160 up 200 right 20
227
387
  to icsp_conn2 pin 5
228
388
 
229
389
  branch:
230
390
  at v5v
231
- wire down 20 left 20
391
+ wire down 20 left 40
232
392
  to icsp_conn2 pin 2
233
393
  point tmp4
234
394
 
@@ -244,7 +404,7 @@ at atmega:
244
404
  17:
245
405
  wire right 20
246
406
  add label("MISO2")
247
- wire right 60 up 200 left 640 auto
407
+ wire right 60 up 200 left 560 auto
248
408
  to icsp_conn2 pin 1
249
409
 
250
410
  16:
@@ -256,7 +416,7 @@ at atmega:
256
416
  15:
257
417
  wire right 20
258
418
  add label("SCK2")
259
- wire right 100 up 260 left 660 auto
419
+ wire right 100 up 260 left 580 auto
260
420
  to icsp_conn2 pin 3
261
421
 
262
422
  at icsp_conn2 pin 6
@@ -269,7 +429,7 @@ at atmega:
269
429
  wire left 20
270
430
  to osc1 pin 1
271
431
 
272
- wire up 40 left 240 wire down 20
432
+ wire up 40 left 160 wire down 20
273
433
  add res(1M) ..angle=90
274
434
  point tmp5
275
435
 
@@ -293,18 +453,18 @@ at atmega:
293
453
  wire left 100
294
454
  add label("USBVCC")
295
455
 
296
- wire left 280 up 220 left 100
456
+ wire left 160 up 220 left 60
297
457
  add fuse(500m) pin 2
298
458
  wire left 100 down 40 left 60
299
459
  add label("XUSB")
300
- wire left 20
460
+ wire left 80
301
461
  to usb_conn pin 1
302
462
 
303
463
  30:
304
464
  wire left 100
305
465
  add label("RD-")
306
466
 
307
- wire left 300 up 180 left 40
467
+ wire left 180 up 180 left 40
308
468
  add res(22) pin 2
309
469
  wire left 20
310
470
  add label("D-")
@@ -314,7 +474,7 @@ at atmega:
314
474
  to usb_conn pin 2
315
475
 
316
476
  wire down 100
317
- add diode() ..angle=90
477
+ add esd() ..angle=90
318
478
  wire down 20 left 80
319
479
  point tmp3
320
480
 
@@ -322,7 +482,7 @@ at atmega:
322
482
  wire left 100
323
483
  add label("RD+")
324
484
 
325
- wire left 320 up 140 left 20
485
+ wire left 200 up 140 left 20
326
486
  add res(22) pin 2
327
487
  wire left 20
328
488
  add label("D+")
@@ -333,27 +493,27 @@ at atmega:
333
493
  wire auto
334
494
  to usb_conn pin 3
335
495
  wire down 80
336
- add diode() ..angle=90
496
+ add esd() ..angle=90
337
497
  wire auto
338
498
  to tmp3
339
499
 
340
500
  27:
341
501
  wire left 100
342
502
  add label("VUCAP")
343
- wire left 160
344
- wire down 80
503
+ wire left 80 down 80
345
504
  add cap(1u)
505
+ wire down 20
346
506
  wire auto
347
507
  to tmp
348
508
 
349
509
  at usb_conn:
350
510
  5:
351
- wire left 20 down 20
511
+ wire down 20
352
512
  branch:
353
- wire right 20
513
+ wire auto_
354
514
  to usb_conn pin 6
355
515
 
356
- wire down 100
516
+ wire down 20
357
517
  add label("USHIELD") ..angle=90
358
518
  wire auto_
359
519
  to tmp3
@@ -374,9 +534,13 @@ at usb_conn:
374
534
 
375
535
  at atmega:
376
536
  8:
377
- wire right 100 down 220 right 600
537
+ wire right 40
538
+ add label("M8TXD")
539
+ wire right 60 down 160 right 540
540
+ add label("M8TXD")
541
+ wire right 60
378
542
  add res(1k)
379
- wire right 100 up 200
543
+ wire right 100 up 140
380
544
  branch:
381
545
  wire left 40
382
546
  to atmega8 pin 3
@@ -385,22 +549,26 @@ at atmega:
385
549
  to iol_conn pin 2
386
550
 
387
551
  9:
388
- wire right 120 down 200 right 580
552
+ wire right 40
553
+ add label("M8RXD")
554
+ wire right 80 down 140 right 520
555
+ add label("M8RXD")
556
+ wire right 60
389
557
  add res(1k)
390
558
  wire right 80 auto_
391
559
  to atmega8 pin 2
392
560
 
393
- wire right 100
561
+ wire auto
394
562
  to iol_conn pin 1
395
563
 
396
564
  10:
397
565
  wire right 40
398
566
  add label("RXLED")
399
- wire right 100 down 100 right 60
567
+ wire right 100 down 40 right 60
400
568
  add led("yellow") pin 2 right
401
569
  wire right 20
402
570
  add res(1k)
403
- wire right 20 up 80
571
+ wire right 20 up 60
404
572
  point tmp6
405
573
  wire up 20
406
574
  to v5v
@@ -408,18 +576,20 @@ at atmega:
408
576
  11:
409
577
  wire right 40
410
578
  add label("TXLED")
411
- wire right 120 down 40 right 40
579
+ wire right 120 right 40
412
580
  add led("yellow") pin 2 right
413
581
  wire right 20
414
582
  add res(1k)
415
583
  wire auto
416
584
  to tmp6
417
585
 
418
- power_conn2 = create component:
419
- pins: 6
420
- arrange:
421
- left: 1,2,3,4,5,6
586
+ #power_conn2 = create component:
587
+ # pins: 6
588
+ # arrange:
589
+ # left: 1,2,3,4,5,6
422
590
 
591
+ power_conn2 = conn6_flipped()
592
+ power_conn2.mpn = "POWER"
423
593
 
424
594
  at power_conn2:
425
595
  2:
@@ -445,14 +615,16 @@ at power_conn2:
445
615
  at atmega8:
446
616
 
447
617
  1:
448
- wire left 160
618
+ wire left 20
619
+ point atmega8_1
620
+ wire left 120
449
621
  branch:
450
622
  wire up 20
451
623
  add res(10k) pin 2 ..angle=90
452
624
  wire up 20
453
625
  to v5v
454
626
  branch:
455
- wire left 40 up 420 right 120
627
+ wire left 40 up 460 right 120
456
628
  to power_conn2 pin 1
457
629
 
458
630
  wire left 40
@@ -462,6 +634,7 @@ at atmega8:
462
634
  branch:
463
635
  wire left 20
464
636
  add solder_bridge() pin 2
637
+ ..refdes = "RESET-EN"
465
638
  point tmp7
466
639
  wire down 40 left 180
467
640
  branch:
@@ -474,6 +647,7 @@ at atmega8:
474
647
  branch:
475
648
  wire right 20
476
649
  add solder_bridge()
650
+ ..refdes = "UBOOT"
477
651
  wire right 20 down 20 to gnd
478
652
 
479
653
  wire auto
@@ -602,7 +776,7 @@ at ioh_conn:
602
776
  wire up 20
603
777
  point tmp8
604
778
  wire up 20
605
- add diode() ..angle=-90
779
+ add led("yellow") ..angle=-90
606
780
  wire up 40 right 40 down 20
607
781
  to gnd
608
782
 
@@ -618,11 +792,33 @@ at ioh_conn:
618
792
  wire left 80
619
793
  add label("MOSI")
620
794
 
621
- reset_button = create component:
622
- pins: 5
623
- arrange:
624
- left: 1,2,5
625
- right: 3,4
795
+ def reset_btn():
796
+ return create component:
797
+ pins: 5
798
+ display: create graphic:
799
+
800
+ hline: 0, 0, 20
801
+ hline: 0, -40, 20
802
+ vline: 20, -30, 20
803
+ path: "M", 20, -20, "L", 40, -20, "L", 40, 0
804
+ path: "M", -15, -30, "L", -20, -30, "L", -20, -10, "L", -15, -10
805
+ hline: -20, -20, 3
806
+ hline: -15, -20, 3
807
+ hline: -10, -20, 3
808
+ hline: -5, -20, 2
809
+ path: "M", 0, 0, "L", -5, -30
810
+
811
+ fill: "#333"
812
+ circle: 0, 0, 2
813
+ fill: "none"
814
+
815
+ pin: 1, 0, 20, 0, 0
816
+ pin: 2, 20, 20, 20, 0
817
+ pin: 5, 40, 20, 40, 0
818
+ pin: 3, 0, -60, 0, -40
819
+ pin: 4, 20, -60, 20, -40
820
+
821
+ reset_button = reset_btn()
626
822
 
627
823
  at icsp_conn:
628
824
  6:
@@ -636,25 +832,28 @@ at icsp_conn:
636
832
  wire left 140
637
833
  branch:
638
834
  wire auto_
639
- to atmega8 pin 1
640
- wire left 100 up 80
835
+ to atmega8_1
836
+ wire left 60 up 20
641
837
  branch:
642
- wire up 20 right 20
838
+ wire up 20
643
839
  to reset_button pin 1
644
- wire right 20
840
+ wire auto_
645
841
  to reset_button pin 2
646
842
 
647
843
  at reset_button pin 4
648
- wire right 20 up 20
844
+ wire up 20
845
+
649
846
  branch:
650
- wire left 20
847
+ wire auto_
651
848
  to reset_button pin 3
652
- wire up 40 right 40 down 20
849
+
850
+ wire up 20 right 40 down 20
653
851
  to gnd
654
852
 
655
853
 
656
854
  # 3V3 output converter
657
855
  dcdc_3v3 = create component:
856
+ type: "ic"
658
857
  pins:
659
858
  1: "IN"
660
859
  2: "GND"
@@ -668,6 +867,7 @@ dcdc_3v3 = create component:
668
867
  right: 5, [1], 4
669
868
 
670
869
  dcdc_5V = create component:
870
+ type: "ic"
671
871
  pins:
672
872
  1: input, "ADJ"
673
873
  2: power, "VO"
@@ -679,6 +879,7 @@ dcdc_5V = create component:
679
879
  manufacturer_pn: "MC33269D-5.0"
680
880
 
681
881
  dcdc_5V_2 = create component:
882
+ type: "ic"
682
883
  pins:
683
884
  1: power, "GND"
684
885
  2: power, "OUT"
@@ -690,27 +891,65 @@ dcdc_5V_2 = create component:
690
891
  params:
691
892
  manufacturer_pn: "MC33269ST-5.0T3"
692
893
 
894
+ def opamp():
895
+ width = 60
896
+ height = 60
897
+
898
+ return create component:
899
+ type: "ic"
900
+ pins: 3
901
+ params:
902
+ manufacturer_pn: "LM358D"
903
+ display: create graphic:
904
+ triangle: -width/2, 0, width/2, 0, height
905
+ pin: 1, width/2 + 20, 0, width/2, 0
906
+ pin: 2, "-", -width/2 - 20, 20, -width/2, 20
907
+ pin: 3, "+", -width/2 - 20, -20, -width/2, -20
908
+ label: "refdes", 0, -height/2, "?"
909
+ label: "manufacturer_pn", 0, height/2, "?"
910
+
693
911
  # Block for power
694
- opamp_1 = create component:
695
- pins:
696
- 1: "OUT"
697
- 2: "-"
698
- 3: "+"
699
- arrange:
700
- left: 3,[1],2
701
- right: [1], 1
702
- width: 40
703
- param:
704
- manufacturer_pn: "LM358D"
912
+ opamp_1 = opamp()
913
+
914
+ def fet_():
915
+ return create component:
916
+ pins: 3
917
+ type: "T"
918
+ display: create graphic:
919
+ hline: -15, -5, 35
920
+ fill: "#333"
921
+ rect: 0, 0, 10, 3
922
+ rect: 15, 0, 10, 3
923
+ rect: -15, 0, 10, 3
924
+ vline: 15, 0, 20
925
+ vline: -15, 0, 20
926
+ vline: 0, 0, 20
927
+ triangle: 0, 15, 0, 20, 5
928
+ hline: 0, 20, 20
929
+ hline: -20, 20, 5
930
+ path: "M", -20, 20, "L", -20, 30, "L", 20, 30, "L", 20, 20
931
+ triangle: -2.5, 30, 2.5, 30, 5
932
+ vline: 2.5, 30-4, 8
933
+
934
+ label: "refdes", 0, 45, "?", anchor="middle"
935
+ label: "manufacturer_pn", 0, 55, "?", anchor="middle"
936
+
937
+ pin: 1, -40, 20, -20, 20
938
+ pin: 2, 40, 20, 20, 20
939
+ pin: 3, 20, -20, 20, -5
940
+ params:
941
+ manufacturer_pn: "FDN304V"
705
942
 
706
- fet = create component:
943
+ fetx = create component:
707
944
  pins: 3
708
945
  arrange:
709
946
  left: 1
710
947
  right: 2,3
711
- param:
948
+ params:
712
949
  manufacturer_pn: "FDN304V"
713
950
 
951
+ fet = fet_()
952
+
714
953
  frame:
715
954
  ..title = "Supply generation"
716
955
  ..direction = "row"
@@ -756,7 +995,7 @@ frame:
756
995
 
757
996
  at dcdc_3v3:
758
997
  2:
759
- wire left 20 down 20
998
+ wire left 20 down 40
760
999
  to gnd
761
1000
 
762
1001
  5:
@@ -766,6 +1005,7 @@ frame:
766
1005
  to v3v3
767
1006
  wire down 20
768
1007
  add cap(1u)
1008
+ wire down 20
769
1009
  to gnd
770
1010
 
771
1011
 
@@ -774,16 +1014,20 @@ frame:
774
1014
 
775
1015
  # Block for 5V power
776
1016
  power_conn = create component:
1017
+ type: "conn"
777
1018
  pins: 3
778
- arrange:
779
- left: 1,3
780
- right: 2
1019
+ display: create graphic:
1020
+ rect: 0, 0, 80, 40
1021
+ pin: 1, -20, 40, -20, 20
1022
+ pin: 2, 20, 40, 20, 20
1023
+ pin: 3, 60, 0, 40, 0
1024
+ label: "refdes", -40, -20 - 4, "?"
781
1025
 
782
1026
  at power_conn:
783
1027
  1:
784
- wire left 20 down 20
1028
+ wire down 20
785
1029
  branch:
786
- wire auto
1030
+ wire auto_
787
1031
  to power_conn pin 3
788
1032
  wire down 20
789
1033
  to gnd
@@ -792,7 +1036,7 @@ frame:
792
1036
  add label("PWRIN")
793
1037
  wire right 40
794
1038
  add diode()
795
- wire right 40
1039
+ wire right 20
796
1040
  branch:
797
1041
  wire down 20
798
1042
  add cap(47u)
@@ -865,3 +1109,29 @@ frame:
865
1109
  add res(1k)
866
1110
  wire auto_
867
1111
  to tmp9
1112
+
1113
+ def osc_block(frequency, net1, net2):
1114
+ at xtal_2(frequency):
1115
+ 1:
1116
+ wire left 40
1117
+ add label(net1)
1118
+ wire left 20 down 20
1119
+ add cap(22p)
1120
+ wire down 20
1121
+ point tmp
1122
+ wire down 20
1123
+ to gnd
1124
+ 2:
1125
+ wire right 20
1126
+ add label(net2)
1127
+ wire right 20 down 20
1128
+ add cap(22p)
1129
+ wire auto
1130
+ to tmp
1131
+
1132
+ frame:
1133
+ ..title = "Alternative XTALs"
1134
+ ..direction = "row"
1135
+
1136
+ osc_block("16MHz", "XT2", "XT1")
1137
+ osc_block("16MHz", "XTAL2", "XTAL1")