Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose signal name as connector property #40

Open
follower opened this issue Jul 3, 2017 · 5 comments
Open

Expose signal name as connector property #40

follower opened this issue Jul 3, 2017 · 5 comments
Assignees

Comments

@follower
Copy link
Contributor

follower commented Jul 3, 2017

A separate issue due to it requiring additional effort.

@follower
Copy link
Contributor Author

The connection from pins to signals are specified in the .brd file via <signal> and <contactref> elements.

It appears that each signal is associated with one <signal> element which has multiple child <contactref> elements (children can also be <via> and <wire> etc).

Here is a portion (showing only the <contactref> children) of an example of <signal> and <contactref> from sparkfun_redstick.brd:

<signal name="RXI">
<contactref element="U2" pad="30"/>
<contactref element="R5" pad="2"/>
<contactref element="JP2" pad="11"/>
...
<contactref element="JP8" pad="4"/>
</signal>

@follower
Copy link
Contributor Author

Running a quick scanner tool over the example .brd files in the repository indicates that in almost all cases a particular pad/pin has only one associated <contactref> entry.

The only examples of multiple entries I found are actually duplicate entries (e.g. VBUS in trinket.brd and GND in others). It's unclear why these duplicate entries exist but it seems later Eagle versions drop the duplicates when the file is re-saved which suggests it's likely to be a bug and the duplicates can be ignored.

@follower
Copy link
Contributor Author

Further details on the use/specification of the <signal>/<contactref> elements can be found:

  • In UL_CONTACTREF entry of the Eagle User Language Program reference.

    Also, UL_CONTACT entry mentions "The signal data member returns the signal this contact is connected to" which suggests a single signal is to be expected--but the UL_CONTACTREF entry mentions "If route has the value CONTACT_ROUTE_ANY, the routetag data member returns an additional tag which describes a group of contactrefs belonging to the same pin" so it's not entirely clear (it seems like the route/routetag entries may be a more recent language addition).

  • In eagle.dtd.

  • In KiCad Eagle importer plugin pcbnew/eagle_plugin.cpp.

@follower
Copy link
Contributor Author

So, for now, it seems reasonable to make each pin/pad map to one signal.

follower added a commit that referenced this issue Jul 17, 2017
(Per #40.)

Exposes a property (`.userData.signal`) for each pin Connector
with the name (as a string) of the signal (i.e. net) which is
connected to the pin.
@follower
Copy link
Contributor Author

With the above commit the signal property can now be accessed via a Connector's userData property.

A console example of this is the following which will list each pin connector and its associated signal:

brd.connectHoles.forEach(function(_) {if (_.name) {console.log(_.name, _.userData.signal)}})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant