Closed ceremcem closed 2 years ago
Sometimes pointing the interconnected pins by labels are not sufficient because those labels can be assigned within the targeting circuit, the inner array of the footprint might be calculated dynamically and only some pins might be physically interconnected. Here is an example component: DG142V-5.08-XXP
Size of this component is determined within the targeting circuit, say 6 terminals
. Now this component has 12 pins (2 for each cable input). User might perfectly give all pins the same gnd
label. If this component would simply declare the distinct labels as "interconnected" (interconnected-pins: "gnd"
), result would be wrong because this would define all of the 12 pins as "interconnected". However only 1 and 2, 3 and 4, ...and so on are connected as pairs.
interconnected-pins
must also support pin numbers. With this approach, we could declare array of array of the pins that are interconnected. In our scenario, value would be:
interconnected-pins:
<[ 1 2 ]>
<[ 3 4 ]>
<[ 5 6 ]>
<[ 7 8 ]>
<[ 9 10 ]>
<[ 11 12 ]>
If value of text2arr interconnected-pins
is:
Array
of strings, then it points LABELS
.Array
of Array
s of strings, then it points PIN_NUMBER
networks/pairs. provides class DG142V_5_08_XXP extends Footprint
@rev_Conn = 1
(data, overrides) ->
value-regex = /^([0-9]+)\s[tT]erminal(s)?/
columns = if data.value.match value-regex
that.1
else if data.pin-count
that
else
10
labels = {}
interconnected-pins = []
for i in [0 to columns]
label = data.labels?[i+1] or i+1
pinA = 2*i + 1
pinB = 2*i + 2
labels[pinA] = label
labels[pinB] = label
interconnected-pins.push [pinA, pinB]
super data, overrides `based-on` {
+allow-duplicate-labels
interconnected-pins
labels
columns
}
create: (data) ->
x = new PinArray do
parent: this
pad:
drill: 1.3mm
dia: 1.3mm * 2
cols:
count: 2
interval: 7.62mm
rows:
count: data.columns
interval: 5.08mm
dir: 'x'
labels: data.labels
allow-duplicate-labels: data.allow-duplicate-labels
@iface = x.iface
Note that the interconnected-pins
must be calculated inside the constructor because the .create()
method will not be called after the first creation time (thus will not be processed).
Some components (like MCU) have duplicate labeled pins (like
gnd
) but that doesn't actually mean those pins are internally connected because these kind of devices are designed to be supplied by multiple pins. It's not sufficient to connect one of those pins to its relevant network, all pins have to be connected.Some other components, on the other hand, have duplicate labeled pins (like pcb type power terminals or zero-ohm resistors) but those pins are actually internally connected and it's sufficient to connect any of those pins to their corresponding network.
There are 2 kinds of situations that have same visual but needs different action. What should schema think when it sees a duplicate label?
We need a property, like
.interconnected-pins: Array
. All pins have to be connected by default and the array is interpreted as "connecting one of those pins are sufficient for this label".Original credit: @mesutevin