circuitscript 0.0.21 → 0.0.24
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.
- package/dist/cjs/antlr/CircuitScriptLexer.js +288 -0
- package/dist/cjs/antlr/CircuitScriptParser.js +4905 -0
- package/dist/cjs/antlr/CircuitScriptVisitor.js +6 -0
- package/{src/draw_symbols.ts → dist/cjs/draw_symbols.js} +303 -614
- package/dist/cjs/execute.js +780 -0
- package/{src/export.ts → dist/cjs/export.js} +34 -56
- package/dist/cjs/fonts.js +4 -0
- package/dist/cjs/geometry.js +430 -0
- package/dist/cjs/globals.js +60 -0
- package/dist/cjs/helpers.js +99 -0
- package/dist/cjs/index.js +29 -0
- package/{src/layout.ts → dist/cjs/layout.js} +413 -1002
- package/dist/cjs/lexer.js +114 -0
- package/dist/cjs/logger.js +17 -0
- package/dist/cjs/main.js +87 -0
- package/dist/cjs/objects/ClassComponent.js +142 -0
- package/dist/cjs/objects/ExecutionScope.js +134 -0
- package/dist/cjs/objects/Frame.js +22 -0
- package/{src/objects/Net.ts → dist/cjs/objects/Net.js} +9 -24
- package/dist/cjs/objects/ParamDefinition.js +42 -0
- package/dist/cjs/objects/PinDefinition.js +31 -0
- package/dist/cjs/objects/PinTypes.js +11 -0
- package/dist/cjs/objects/Wire.js +9 -0
- package/dist/cjs/objects/types.js +9 -0
- package/dist/cjs/parser.js +299 -0
- package/dist/cjs/regenerate-tests.js +23 -0
- package/dist/cjs/render.js +155 -0
- package/{src/server.ts → dist/cjs/server.js} +15 -21
- package/dist/cjs/sizing.js +105 -0
- package/{src/utils.ts → dist/cjs/utils.js} +25 -35
- package/{src/visitor.ts → dist/cjs/visitor.js} +392 -948
- package/{build/src/antlr/CircuitScriptLexer.js → dist/esm/antlr/CircuitScriptLexer.mjs} +90 -91
- package/{build/src/antlr/CircuitScriptParser.js → dist/esm/antlr/CircuitScriptParser.mjs} +138 -136
- package/{build/src/draw_symbols.js → dist/esm/draw_symbols.mjs} +11 -11
- package/{build/src/execute.js → dist/esm/execute.mjs} +9 -8
- package/{build/src/export.js → dist/esm/export.mjs} +2 -2
- package/{build/src/geometry.js → dist/esm/geometry.mjs} +3 -7
- package/{build/src/helpers.js → dist/esm/helpers.mjs} +27 -7
- package/dist/esm/index.mjs +13 -0
- package/{build/src/layout.js → dist/esm/layout.mjs} +11 -11
- package/{build/src/lexer.js → dist/esm/lexer.mjs} +2 -2
- package/{build/src/main.js → dist/esm/main.mjs} +5 -5
- package/{build/src/objects/ClassComponent.js → dist/esm/objects/ClassComponent.mjs} +3 -3
- package/{build/src/objects/PinDefinition.js → dist/esm/objects/PinDefinition.mjs} +1 -1
- package/dist/esm/parser.mjs +269 -0
- package/{build/src/regenerate-tests.js → dist/esm/regenerate-tests.mjs} +1 -1
- package/{build/src/render.js → dist/esm/render.mjs} +7 -24
- package/{build/src/sizing.js → dist/esm/sizing.mjs} +22 -8
- package/{build/src/visitor.js → dist/esm/visitor.mjs} +10 -29
- package/dist/types/antlr/CircuitScriptLexer.d.ts +71 -0
- package/dist/types/antlr/CircuitScriptParser.d.ts +675 -0
- package/dist/types/antlr/CircuitScriptVisitor.d.ts +115 -0
- package/dist/types/draw_symbols.d.ts +162 -0
- package/dist/types/execute.d.ts +85 -0
- package/dist/types/export.d.ts +2 -0
- package/dist/types/fonts.d.ts +1 -0
- package/dist/types/geometry.d.ts +84 -0
- package/dist/types/globals.d.ts +50 -0
- package/dist/types/helpers.d.ts +9 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/layout.d.ts +147 -0
- package/dist/types/lexer.d.ts +19 -0
- package/dist/types/logger.d.ts +6 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/objects/ClassComponent.d.ts +40 -0
- package/dist/types/objects/ExecutionScope.d.ts +64 -0
- package/dist/types/objects/Frame.d.ts +15 -0
- package/dist/types/objects/Net.d.ts +10 -0
- package/dist/types/objects/ParamDefinition.d.ts +20 -0
- package/dist/types/objects/PinDefinition.d.ts +24 -0
- package/dist/types/objects/PinTypes.d.ts +7 -0
- package/dist/types/objects/Wire.d.ts +11 -0
- package/dist/types/objects/types.d.ts +49 -0
- package/dist/types/parser.d.ts +38 -0
- package/dist/types/regenerate-tests.d.ts +1 -0
- package/dist/types/render.d.ts +10 -0
- package/dist/types/server.d.ts +1 -0
- package/dist/types/sizing.d.ts +15 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types/visitor.d.ts +135 -0
- package/package.json +30 -12
- package/.editorconfig +0 -15
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -27
- package/.gitlab-ci.yml +0 -81
- package/.prettierignore +0 -8
- package/.prettierrc +0 -16
- package/__tests__/expectedResults.ts +0 -657
- package/__tests__/helpers.ts +0 -82
- package/__tests__/parseScripts.ts +0 -593
- package/__tests__/renderData/script1.cst +0 -58
- package/__tests__/renderData/script1.cst.svg +0 -1
- package/__tests__/renderData/script2.cst +0 -16
- package/__tests__/renderData/script2.cst.svg +0 -1
- package/__tests__/renderData/script3.cst +0 -30
- package/__tests__/renderData/script3.cst.svg +0 -1
- package/__tests__/renderData/script4.cst +0 -54
- package/__tests__/renderData/script4.cst.svg +0 -1
- package/__tests__/renderData/script5.cst +0 -23
- package/__tests__/renderData/script5.cst.svg +0 -1
- package/__tests__/renderData/script6.cst +0 -28
- package/__tests__/renderData/script6.cst.svg +0 -1
- package/__tests__/renderData/script7.cst +0 -26
- package/__tests__/renderData/script7.cst.svg +0 -1
- package/__tests__/renderData/script8.cst +0 -37
- package/__tests__/renderData/script8.cst.svg +0 -1
- package/__tests__/testCLI.ts +0 -68
- package/__tests__/testMathOps.ts +0 -36
- package/__tests__/testMergeWires.ts +0 -141
- package/__tests__/testParse.ts +0 -263
- package/__tests__/testRender.ts +0 -38
- package/build/src/parser.js +0 -69
- package/documentation.md +0 -238
- package/examples/example_arduino_uno.cst +0 -1146
- package/examples/example_garden_pump.cst +0 -567
- package/examples/lib.cst +0 -185
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/OpenSans-Regular.ttf +0 -0
- package/fonts/Roboto-Regular.ttf +0 -0
- package/jest.config.js +0 -23
- package/libs/lib.cst +0 -185
- package/refresh.html +0 -42
- package/server.cjs +0 -50
- package/src/antlr/CircuitScript.g4 +0 -209
- package/src/antlr/CircuitScriptLexer.ts +0 -317
- package/src/antlr/CircuitScriptParser.ts +0 -4979
- package/src/antlr/CircuitScriptVisitor.ts +0 -420
- package/src/execute.ts +0 -1227
- package/src/fonts.ts +0 -1
- package/src/geometry.ts +0 -638
- package/src/globals.ts +0 -67
- package/src/helpers.ts +0 -114
- package/src/lexer.ts +0 -151
- package/src/logger.ts +0 -17
- package/src/main.ts +0 -105
- package/src/objects/ClassComponent.ts +0 -223
- package/src/objects/ExecutionScope.ts +0 -201
- package/src/objects/Frame.ts +0 -20
- package/src/objects/ParamDefinition.ts +0 -49
- package/src/objects/PinDefinition.ts +0 -49
- package/src/objects/PinTypes.ts +0 -7
- package/src/objects/Wire.ts +0 -19
- package/src/objects/types.ts +0 -66
- package/src/parser.ts +0 -106
- package/src/regenerate-tests.ts +0 -25
- package/src/render.ts +0 -260
- package/src/sizing.ts +0 -96
- package/tsconfig.json +0 -26
- package/tsconfig.release.json +0 -8
- /package/{build/src/antlr/CircuitScriptVisitor.js → dist/esm/antlr/CircuitScriptVisitor.mjs} +0 -0
- /package/{build/src/fonts.js → dist/esm/fonts.mjs} +0 -0
- /package/{build/src/globals.js → dist/esm/globals.mjs} +0 -0
- /package/{build/src/logger.js → dist/esm/logger.mjs} +0 -0
- /package/{build/src/objects/ExecutionScope.js → dist/esm/objects/ExecutionScope.mjs} +0 -0
- /package/{build/src/objects/Frame.js → dist/esm/objects/Frame.mjs} +0 -0
- /package/{build/src/objects/Net.js → dist/esm/objects/Net.mjs} +0 -0
- /package/{build/src/objects/ParamDefinition.js → dist/esm/objects/ParamDefinition.mjs} +0 -0
- /package/{build/src/objects/PinTypes.js → dist/esm/objects/PinTypes.mjs} +0 -0
- /package/{build/src/objects/Wire.js → dist/esm/objects/Wire.mjs} +0 -0
- /package/{build/src/objects/types.js → dist/esm/objects/types.mjs} +0 -0
- /package/{build/src/server.js → dist/esm/server.mjs} +0 -0
- /package/{build/src/utils.js → dist/esm/utils.mjs} +0 -0
|
@@ -1,567 +0,0 @@
|
|
|
1
|
-
import lib
|
|
2
|
-
|
|
3
|
-
def decoupling_cap(value):
|
|
4
|
-
wire down 20
|
|
5
|
-
add cap(value)
|
|
6
|
-
wire down 20
|
|
7
|
-
to gnd
|
|
8
|
-
|
|
9
|
-
def conn1x4():
|
|
10
|
-
return create component:
|
|
11
|
-
pins: 4
|
|
12
|
-
type: "conn"
|
|
13
|
-
arrange:
|
|
14
|
-
left: 1,2,3,4
|
|
15
|
-
params:
|
|
16
|
-
footprint: "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical"
|
|
17
|
-
|
|
18
|
-
def conn1x11():
|
|
19
|
-
return create component:
|
|
20
|
-
pins: 11
|
|
21
|
-
type: "conn"
|
|
22
|
-
arrange:
|
|
23
|
-
left: 1,2,3,4,5,6,7,8,9,10,11
|
|
24
|
-
params:
|
|
25
|
-
footprint: "Connector_PinSocket_2.54mm:PinSocket_1x11_P2.54mm_Vertical"
|
|
26
|
-
|
|
27
|
-
def conn1x2():
|
|
28
|
-
return create component:
|
|
29
|
-
pins: 2
|
|
30
|
-
type: "conn"
|
|
31
|
-
arrange:
|
|
32
|
-
left: 1,2
|
|
33
|
-
params:
|
|
34
|
-
footprint: "Connector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_Vertical"
|
|
35
|
-
|
|
36
|
-
def conn1x5():
|
|
37
|
-
return create component:
|
|
38
|
-
pins: 5
|
|
39
|
-
width: 40
|
|
40
|
-
type: "conn"
|
|
41
|
-
arrange:
|
|
42
|
-
left: 1,2,3,4,5
|
|
43
|
-
params:
|
|
44
|
-
footprint: "Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_Vertical"
|
|
45
|
-
|
|
46
|
-
def power_conn():
|
|
47
|
-
conn1 = conn1x4()
|
|
48
|
-
at conn1:
|
|
49
|
-
1:
|
|
50
|
-
wire left 20 up 20
|
|
51
|
-
to v12v
|
|
52
|
-
2:
|
|
53
|
-
wire left 20
|
|
54
|
-
branch:
|
|
55
|
-
wire down 20 right 20
|
|
56
|
-
to conn1 pin 3
|
|
57
|
-
wire left 20 down 20
|
|
58
|
-
to gnd
|
|
59
|
-
4:
|
|
60
|
-
wire down 40 left 20
|
|
61
|
-
to v3v3
|
|
62
|
-
..angle = -90
|
|
63
|
-
|
|
64
|
-
return conn1
|
|
65
|
-
|
|
66
|
-
def s1a_diode():
|
|
67
|
-
width = 20
|
|
68
|
-
height = 20
|
|
69
|
-
|
|
70
|
-
# Diode is drawn horizontally
|
|
71
|
-
# -|>|-
|
|
72
|
-
return create component:
|
|
73
|
-
pins: 2
|
|
74
|
-
type: "diode"
|
|
75
|
-
display: create graphic:
|
|
76
|
-
path: ("M", width/2, -height/2, "L", width/2, height/2,
|
|
77
|
-
"M", -width/2, -height/2, "L", -width/2, height/2,
|
|
78
|
-
"L", width/2, 0, "L", -width/2, -height/2)
|
|
79
|
-
pin: 1, -width/2-20, 0, -width/2, 0 # anode
|
|
80
|
-
pin: 2, width/2 + 20, 0, width/2, 0 # cathode
|
|
81
|
-
label: "refdes", width/2 + 5, 5, "?", fontSize=10, anchor="left", vanchor="top"
|
|
82
|
-
params:
|
|
83
|
-
footprint: "GardenRelay:S1A"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def tmp_label(name):
|
|
87
|
-
wire left 100
|
|
88
|
-
add label(name)
|
|
89
|
-
|
|
90
|
-
def tmp_label_right(name):
|
|
91
|
-
wire right 20
|
|
92
|
-
add label(name)
|
|
93
|
-
wire right 40
|
|
94
|
-
|
|
95
|
-
def tps54227_block(inductor_component, upper_fb_resistor, lower_fb_resistor,
|
|
96
|
-
enable_label, output_label, inductor_footprint, place=true):
|
|
97
|
-
|
|
98
|
-
# the 3v3 supply
|
|
99
|
-
tps54227 = create component:
|
|
100
|
-
pins:
|
|
101
|
-
1: input, "EN"
|
|
102
|
-
2: input, "VFB"
|
|
103
|
-
3: input, "VREGS"
|
|
104
|
-
4: input, "SS"
|
|
105
|
-
5: "GND"
|
|
106
|
-
6: power, "SW"
|
|
107
|
-
7: power, "SW2"
|
|
108
|
-
8: any, "VBST"
|
|
109
|
-
9: power, "VIN"
|
|
110
|
-
10: power, "VIN2"
|
|
111
|
-
11: any, "PwPd"
|
|
112
|
-
type: "ic"
|
|
113
|
-
arrange:
|
|
114
|
-
left: 9, 10, 1, 3, 4
|
|
115
|
-
right: 8, 6, 7, 2, 5, 11
|
|
116
|
-
params:
|
|
117
|
-
footprint: "GardenRelay:VSON-10-1EP_3x3mm_P0.5mm_EP1.65x2.4mm_ThermalVias"
|
|
118
|
-
|
|
119
|
-
frame:
|
|
120
|
-
..title = "12V to " + output_label + " DCDC converter"
|
|
121
|
-
|
|
122
|
-
at tps54227:
|
|
123
|
-
1:
|
|
124
|
-
wire left 20
|
|
125
|
-
add res(10k) pin 2
|
|
126
|
-
wire left 40
|
|
127
|
-
add label(enable_label)
|
|
128
|
-
wire left 20
|
|
129
|
-
to v12v left
|
|
130
|
-
|
|
131
|
-
9:
|
|
132
|
-
wire left 20
|
|
133
|
-
branch:
|
|
134
|
-
wire down 20 right 20
|
|
135
|
-
to tps54227 pin 10
|
|
136
|
-
wire left 20 up 100 left 60
|
|
137
|
-
branch:
|
|
138
|
-
decoupling_cap(100n, false)
|
|
139
|
-
wire left 40
|
|
140
|
-
branch:
|
|
141
|
-
decoupling_cap(10u)
|
|
142
|
-
wire left 40
|
|
143
|
-
branch:
|
|
144
|
-
decoupling_cap(10u)
|
|
145
|
-
|
|
146
|
-
wire up 20
|
|
147
|
-
to v12v
|
|
148
|
-
|
|
149
|
-
3:
|
|
150
|
-
wire left 100 down 20
|
|
151
|
-
decoupling_cap(1u)
|
|
152
|
-
|
|
153
|
-
4:
|
|
154
|
-
wire left 40
|
|
155
|
-
decoupling_cap(3300p)
|
|
156
|
-
|
|
157
|
-
5:
|
|
158
|
-
wire right 20 down 20
|
|
159
|
-
branch:
|
|
160
|
-
wire left 20
|
|
161
|
-
to tps54227 pin 11
|
|
162
|
-
wire down 20
|
|
163
|
-
to gnd
|
|
164
|
-
|
|
165
|
-
6:
|
|
166
|
-
wire right 60
|
|
167
|
-
branch:
|
|
168
|
-
wire down 20
|
|
169
|
-
wire left 60
|
|
170
|
-
to tps54227 pin 7
|
|
171
|
-
wire right 40
|
|
172
|
-
add inductor_component
|
|
173
|
-
wire right 20
|
|
174
|
-
branch:
|
|
175
|
-
wire down 20
|
|
176
|
-
add res(upper_fb_resistor) down
|
|
177
|
-
wire down 20
|
|
178
|
-
branch:
|
|
179
|
-
wire left 40
|
|
180
|
-
wire auto_
|
|
181
|
-
to tps54227 pin 2
|
|
182
|
-
wire down 20
|
|
183
|
-
point fb_point
|
|
184
|
-
wire down 20
|
|
185
|
-
add res(lower_fb_resistor) down
|
|
186
|
-
to gnd
|
|
187
|
-
wire right 60
|
|
188
|
-
branch:
|
|
189
|
-
wire down 20
|
|
190
|
-
add cap(10p)
|
|
191
|
-
..place = false
|
|
192
|
-
|
|
193
|
-
wire auto
|
|
194
|
-
to fb_point
|
|
195
|
-
wire right 60
|
|
196
|
-
branch:
|
|
197
|
-
decoupling_cap(22u)
|
|
198
|
-
wire right 60
|
|
199
|
-
branch:
|
|
200
|
-
decoupling_cap(22u)
|
|
201
|
-
wire right 40 up 20
|
|
202
|
-
to supply(output_label)
|
|
203
|
-
|
|
204
|
-
8:
|
|
205
|
-
wire right 20
|
|
206
|
-
add cap(100n)
|
|
207
|
-
..angle = -90
|
|
208
|
-
wire right 20 down 20
|
|
209
|
-
to tps54227 pin 6
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
def main():
|
|
214
|
-
barrel_jack = create component:
|
|
215
|
-
pins:
|
|
216
|
-
1: power, "IN"
|
|
217
|
-
2: power, "GND"
|
|
218
|
-
type: "conn"
|
|
219
|
-
arrange:
|
|
220
|
-
right: 1,2
|
|
221
|
-
params:
|
|
222
|
-
footprint: "Connector_BarrelJack:BarrelJack_CUI_PJ-063AH_Horizontal_CircularHoles"
|
|
223
|
-
|
|
224
|
-
frame:
|
|
225
|
-
..title = "Power connectors"
|
|
226
|
-
..direction = "row"
|
|
227
|
-
|
|
228
|
-
at barrel_jack:
|
|
229
|
-
1:
|
|
230
|
-
wire right 20
|
|
231
|
-
branch:
|
|
232
|
-
wire up 20
|
|
233
|
-
add v12v
|
|
234
|
-
|
|
235
|
-
wire right 40
|
|
236
|
-
branch:
|
|
237
|
-
decoupling_cap(10u)
|
|
238
|
-
|
|
239
|
-
wire right 40
|
|
240
|
-
branch:
|
|
241
|
-
decoupling_cap(10u)
|
|
242
|
-
|
|
243
|
-
wire right 40
|
|
244
|
-
branch:
|
|
245
|
-
decoupling_cap(10u)
|
|
246
|
-
|
|
247
|
-
2:
|
|
248
|
-
wire right 20 down 20
|
|
249
|
-
to gnd
|
|
250
|
-
|
|
251
|
-
# create power connectors
|
|
252
|
-
J102 = power_conn()
|
|
253
|
-
J108 = power_conn()
|
|
254
|
-
|
|
255
|
-
J104 = conn1x4()
|
|
256
|
-
|
|
257
|
-
at J104:
|
|
258
|
-
1:
|
|
259
|
-
wire left 20 up 20
|
|
260
|
-
to supply("5V#")
|
|
261
|
-
2:
|
|
262
|
-
wire left 20
|
|
263
|
-
branch:
|
|
264
|
-
wire down 20 right 20
|
|
265
|
-
to J104 pin 3
|
|
266
|
-
wire left 20
|
|
267
|
-
to v5v left
|
|
268
|
-
4:
|
|
269
|
-
wire left 20 down 20
|
|
270
|
-
to gnd
|
|
271
|
-
|
|
272
|
-
ind_3u3 = ind(3.3u)
|
|
273
|
-
ind_3u3.footprint = "GardenRelay:NR6020T3R3N"
|
|
274
|
-
|
|
275
|
-
ind_4u7 = ind(4.7u)
|
|
276
|
-
ind_4u7.footprint = "GardenRelay:NRS8030T4R7MJGJ"
|
|
277
|
-
|
|
278
|
-
block1 = tps54227_block(ind_3u3, 73.2k, 22.1k,
|
|
279
|
-
"EN_3V3", "3V3", "GardenRelay:NR6020T3R3N")
|
|
280
|
-
|
|
281
|
-
block2 = tps54227_block(ind_4u7, 124k, 22.1k,
|
|
282
|
-
"EN_5V", "5V#", "GardenRelay:NRS8030T4R7MJGJ")
|
|
283
|
-
|
|
284
|
-
frame:
|
|
285
|
-
..title = "ESP32 board connector"
|
|
286
|
-
..direction = "column"
|
|
287
|
-
|
|
288
|
-
frame:
|
|
289
|
-
..direction = "row"
|
|
290
|
-
..border = 0
|
|
291
|
-
|
|
292
|
-
at conn1x2():
|
|
293
|
-
1:
|
|
294
|
-
wire left 40 up 40
|
|
295
|
-
add v3v3
|
|
296
|
-
2:
|
|
297
|
-
wire left 40
|
|
298
|
-
add label("EN")
|
|
299
|
-
|
|
300
|
-
J105 = conn1x11()
|
|
301
|
-
|
|
302
|
-
at J105:
|
|
303
|
-
1: tmp_label("ADC1")
|
|
304
|
-
2: tmp_label("ADC2")
|
|
305
|
-
3: tmp_label("GPIO1")
|
|
306
|
-
4: tmp_label("GPIO2")
|
|
307
|
-
5: tmp_label("ADC3")
|
|
308
|
-
6: tmp_label("GPIO3")
|
|
309
|
-
7: tmp_label("ADC4")
|
|
310
|
-
8: tmp_label("GPIO4")
|
|
311
|
-
9: tmp_label("ADC8")
|
|
312
|
-
10:
|
|
313
|
-
wire left 100
|
|
314
|
-
to gnd left
|
|
315
|
-
11: tmp_label("ADC7")
|
|
316
|
-
|
|
317
|
-
J106 = conn1x2()
|
|
318
|
-
|
|
319
|
-
at J106:
|
|
320
|
-
1:
|
|
321
|
-
wire left 100
|
|
322
|
-
to gnd left
|
|
323
|
-
2: tmp_label("GPIO13")
|
|
324
|
-
|
|
325
|
-
J107 = conn1x11()
|
|
326
|
-
|
|
327
|
-
at J107:
|
|
328
|
-
1: tmp_label("GPIO5")
|
|
329
|
-
2:
|
|
330
|
-
wire left 100
|
|
331
|
-
to gnd left
|
|
332
|
-
3: tmp_label("GPIO6")
|
|
333
|
-
4: tmp_label("GPIO7")
|
|
334
|
-
5: tmp_label("GPIO8")
|
|
335
|
-
6: tmp_label("GPIO9")
|
|
336
|
-
7: tmp_label("GPIO10")
|
|
337
|
-
8: tmp_label("ADC5")
|
|
338
|
-
9: tmp_label("ADC6")
|
|
339
|
-
10: tmp_label("GPIO11")
|
|
340
|
-
11: tmp_label("GPIO12")
|
|
341
|
-
|
|
342
|
-
frame:
|
|
343
|
-
..border = 0
|
|
344
|
-
|
|
345
|
-
J109 = conn1x4()
|
|
346
|
-
at J109:
|
|
347
|
-
1: tmp_label("GPIO11")
|
|
348
|
-
2: tmp_label("GPIO12")
|
|
349
|
-
3: tmp_label("GPIO13")
|
|
350
|
-
4:
|
|
351
|
-
wire left 40
|
|
352
|
-
to v5v left
|
|
353
|
-
|
|
354
|
-
J110 = conn1x4()
|
|
355
|
-
at J110:
|
|
356
|
-
1: tmp_label("GPIO10")
|
|
357
|
-
2: tmp_label("GPIO9")
|
|
358
|
-
3:
|
|
359
|
-
wire left 40
|
|
360
|
-
to v3v3 left
|
|
361
|
-
4:
|
|
362
|
-
wire left 20 down 20
|
|
363
|
-
to gnd
|
|
364
|
-
|
|
365
|
-
def mosfet():
|
|
366
|
-
return create component:
|
|
367
|
-
pins: 3
|
|
368
|
-
type: "transistor"
|
|
369
|
-
arrange:
|
|
370
|
-
left: 1
|
|
371
|
-
right: 3,2
|
|
372
|
-
params:
|
|
373
|
-
footprint: "Package_TO_SOT_SMD:SOT-23"
|
|
374
|
-
|
|
375
|
-
def decoupling_cap(value, place=true):
|
|
376
|
-
branch:
|
|
377
|
-
wire down 20
|
|
378
|
-
add cap(value)
|
|
379
|
-
..place = place
|
|
380
|
-
wire down 20
|
|
381
|
-
to gnd
|
|
382
|
-
|
|
383
|
-
def pump_block(enable_name, sense_out):
|
|
384
|
-
relay = create component:
|
|
385
|
-
pins: 5
|
|
386
|
-
type: "relay"
|
|
387
|
-
arrange:
|
|
388
|
-
left: 2, [1], 5
|
|
389
|
-
right: 4,3,1
|
|
390
|
-
params:
|
|
391
|
-
footprint: "GardenRelay:AZ943-1CH-12DEF"
|
|
392
|
-
|
|
393
|
-
diff_amp = create component:
|
|
394
|
-
pins:
|
|
395
|
-
1: "OUT"
|
|
396
|
-
2: "V+"
|
|
397
|
-
3: "+"
|
|
398
|
-
4: "-"
|
|
399
|
-
5: "V-"
|
|
400
|
-
type: "ic"
|
|
401
|
-
arrange:
|
|
402
|
-
left: 3,[1], 4
|
|
403
|
-
right: 2,1,5
|
|
404
|
-
params:
|
|
405
|
-
footprint: "Package_TO_SOT_SMD:SOT-23-5"
|
|
406
|
-
|
|
407
|
-
frame:
|
|
408
|
-
..title = "Pump control block (" + enable_name + ")"
|
|
409
|
-
..direction = "row"
|
|
410
|
-
|
|
411
|
-
frame:
|
|
412
|
-
..title = "Connector"
|
|
413
|
-
..border = 0
|
|
414
|
-
..padding = 0
|
|
415
|
-
|
|
416
|
-
conn = conn1x5()
|
|
417
|
-
at conn:
|
|
418
|
-
1:
|
|
419
|
-
wire left 20 up 20
|
|
420
|
-
to v12v
|
|
421
|
-
2: tmp_label("LOAD_SUPPLY")
|
|
422
|
-
3:
|
|
423
|
-
wire left 40
|
|
424
|
-
to v5v left
|
|
425
|
-
4: tmp_label("CONN+")
|
|
426
|
-
5: tmp_label("CONN-")
|
|
427
|
-
|
|
428
|
-
frame:
|
|
429
|
-
..title = "Relay control for " + enable_name
|
|
430
|
-
..border = 0
|
|
431
|
-
..padding = 0
|
|
432
|
-
|
|
433
|
-
at label(enable_name)
|
|
434
|
-
wire right 40
|
|
435
|
-
branch:
|
|
436
|
-
wire down 20
|
|
437
|
-
add led("RED") down
|
|
438
|
-
wire down 20
|
|
439
|
-
add res(130) down
|
|
440
|
-
wire down 20 to gnd
|
|
441
|
-
wire right 40
|
|
442
|
-
branch:
|
|
443
|
-
wire down 20
|
|
444
|
-
add res(1k) down
|
|
445
|
-
wire down 20
|
|
446
|
-
to gnd
|
|
447
|
-
|
|
448
|
-
wire right 20
|
|
449
|
-
add Q1 = mosfet()
|
|
450
|
-
at Q1 pin 2
|
|
451
|
-
wire right 20 down 20
|
|
452
|
-
to gnd
|
|
453
|
-
|
|
454
|
-
at v12v
|
|
455
|
-
wire down 20
|
|
456
|
-
branch:
|
|
457
|
-
wire right 80
|
|
458
|
-
add relay pin 2
|
|
459
|
-
wire down 20
|
|
460
|
-
add s1a_diode() pin 2 down
|
|
461
|
-
wire down 20
|
|
462
|
-
branch:
|
|
463
|
-
wire right 40
|
|
464
|
-
wire auto
|
|
465
|
-
to relay pin 5
|
|
466
|
-
wire left 40 up 80 left 60
|
|
467
|
-
to Q1 pin 3
|
|
468
|
-
|
|
469
|
-
at relay:
|
|
470
|
-
4:
|
|
471
|
-
wire right 20
|
|
472
|
-
branch:
|
|
473
|
-
wire up 100 right 140
|
|
474
|
-
add label("SENSE+")
|
|
475
|
-
wire right 60
|
|
476
|
-
wire right 20
|
|
477
|
-
add res(0.05)
|
|
478
|
-
wire right 20
|
|
479
|
-
branch:
|
|
480
|
-
wire up 80 right 20
|
|
481
|
-
add label("SENSE-")
|
|
482
|
-
wire right 60
|
|
483
|
-
wire right 20
|
|
484
|
-
add label("LOAD_SUPPLY")
|
|
485
|
-
wire right 80
|
|
486
|
-
1:
|
|
487
|
-
wire right 20
|
|
488
|
-
branch:
|
|
489
|
-
wire right 40
|
|
490
|
-
add label("CONN+")
|
|
491
|
-
wire right 40
|
|
492
|
-
wire down 20
|
|
493
|
-
add s1a_diode() pin 2 down
|
|
494
|
-
wire down 20
|
|
495
|
-
branch:
|
|
496
|
-
wire right 40
|
|
497
|
-
add label("CONN-")
|
|
498
|
-
wire right 40
|
|
499
|
-
wire down 20
|
|
500
|
-
to gnd
|
|
501
|
-
|
|
502
|
-
frame:
|
|
503
|
-
..title = "Current sense for "+ sense_out
|
|
504
|
-
..border = 0
|
|
505
|
-
..padding = 0
|
|
506
|
-
|
|
507
|
-
at label("SENSE+")
|
|
508
|
-
wire right 40
|
|
509
|
-
add res(1k)
|
|
510
|
-
wire right 20
|
|
511
|
-
point tmp1
|
|
512
|
-
|
|
513
|
-
branch:
|
|
514
|
-
wire right 40
|
|
515
|
-
to diff_amp pin 3
|
|
516
|
-
|
|
517
|
-
at diff_amp:
|
|
518
|
-
2:
|
|
519
|
-
wire right 20 up 20
|
|
520
|
-
to v3v3
|
|
521
|
-
5:
|
|
522
|
-
wire right 20 down 20
|
|
523
|
-
to gnd
|
|
524
|
-
1:
|
|
525
|
-
wire right 40
|
|
526
|
-
branch:
|
|
527
|
-
wire up 100 left 40
|
|
528
|
-
add res(20k) pin 2
|
|
529
|
-
wire auto_
|
|
530
|
-
to tmp1
|
|
531
|
-
|
|
532
|
-
wire right 40
|
|
533
|
-
decoupling_cap(100n)
|
|
534
|
-
wire right 40
|
|
535
|
-
add label(sense_out)
|
|
536
|
-
wire right 40
|
|
537
|
-
|
|
538
|
-
at label("SENSE-")
|
|
539
|
-
wire right 40
|
|
540
|
-
add res(1k)
|
|
541
|
-
wire right 20
|
|
542
|
-
|
|
543
|
-
branch:
|
|
544
|
-
wire right 40
|
|
545
|
-
to diff_amp pin 4
|
|
546
|
-
|
|
547
|
-
wire down 20
|
|
548
|
-
add res(20k) down
|
|
549
|
-
wire down 20 left 20
|
|
550
|
-
to supply("Vbias") left
|
|
551
|
-
|
|
552
|
-
# define global nets
|
|
553
|
-
v12v = supply("12V")
|
|
554
|
-
v3v3 = supply("3V3")
|
|
555
|
-
v5v = supply("5V")
|
|
556
|
-
gnd = dgnd()
|
|
557
|
-
|
|
558
|
-
main()
|
|
559
|
-
|
|
560
|
-
/pump1 pump_block("GPIO1", "ADC1")
|
|
561
|
-
/pump2 pump_block("GPIO2", "ADC2")
|
|
562
|
-
/pump3 pump_block("GPIO3", "ADC3")
|
|
563
|
-
/pump4 pump_block("GPIO4", "ADC4")
|
|
564
|
-
/pump5 pump_block("GPIO5", "ADC5")
|
|
565
|
-
/pump6 pump_block("GPIO6", "ADC6")
|
|
566
|
-
/pump7 pump_block("GPIO7", "ADC7")
|
|
567
|
-
/pump8 pump_block("GPIO8", "ADC8")
|