UL_PIN
Data members
angle | real (0, 90, 180 and 270) |
contact | UL_CONTACT (deprecated, see note) |
direction | int (PIN_DIRECTION_...) |
function | int (PIN_FUNCTION_FLAG_...) |
length | int (PIN_LENGTH_...) |
name | string (PIN_NAME_LENGTH) |
net | string (see note) |
route | int (CONTACT_ROUTE_...) |
swaplevel | int |
visible | int (PIN_VISIBLE_FLAG_...) |
x, y | int (connection point) |
Loop members
circles() | UL_CIRCLE |
contacts() | UL_CONTACT (see note) |
texts() | UL_TEXT |
wires() | UL_WIRE |
See also UL_SYMBOL, UL_PINREF, UL_CONTACTREF
Constants
PIN_DIRECTION_NC | not connected |
PIN_DIRECTION_IN | input |
PIN_DIRECTION_OUT | output (totem-pole) |
PIN_DIRECTION_IO | in/output (bidirectional) |
PIN_DIRECTION_OC | open collector |
PIN_DIRECTION_PWR | power input pin |
PIN_DIRECTION_PAS | passive |
PIN_DIRECTION_HIZ | high impedance output |
PIN_DIRECTION_SUP | supply pin |
PIN_FUNCTION_FLAG_NONE | no symbol |
PIN_FUNCTION_FLAG_DOT | inverter symbol |
PIN_FUNCTION_FLAG_CLK | clock symbol |
PIN_LENGTH_POINT | no wire |
PIN_LENGTH_SHORT | 0.1 inch wire |
PIN_LENGTH_MIDDLE | 0.2 inch wire |
PIN_LENGTH_LONG | 0.3 inch wire |
PIN_NAME_LENGTH | max. recommended length of a pin name (used in formatted output only) |
PIN_VISIBLE_FLAG_OFF | no name drawn |
PIN_VISIBLE_FLAG_PAD | pad name drawn |
PIN_VISIBLE_FLAG_PIN | pin name drawn |
CONTACT_ROUTE_ALL | must explicitly route to all contacts |
CONTACT_ROUTE_ANY | may route to any contact |
Note
The contacts() loop member loops through the contacts that have been assigned to the pin through a CONNECT command. This is the case in a UL_DEVICE context or coming via UL_PINREF, but not via UL_LIBRARY.symbols(). If this is not the case the list is empty.
The contact data member returns the contact that has been assigned to the pin through a CONNECT command. This member is deprecated! It will work for backwards compatibility and as long as only one pad has been connected to the pin, but will cause a runtime error when used with a pin that is connected to more than one pad.
The route member also only makes sense if there's a relation to contacts the pin is connected to. Otherwise the value is set to 0.
The coordinates (and layer, in case of an SMD) of the contact returned by the contact data member depend on the context in which it is called:
- if the pin is derived from a UL_PART that is used on a sheet, and if there is a corresponding element on the board, the resulting contact will have the coordinates as used on the board.
- in all other cases, the coordinates of the contact will be the same as defined in the footprint drawing.
The name data member always returns the name of the pin as it was defined in the library, with any '@' character for pins with the same name left intact (see the PIN command for details). The texts loop member, on the other hand, returns the pin name (if it is visible) in the same way as it is displayed in the current drawing type.
The net data member returns the name of the net to which this pin is connected to (only available in a UL_SCHEMATIC context).
Example
library(L) {
L.symbols(S) {
printf("Symbol: %s\n", S.name);
S.pins(P) {
printf("\tPin: %s, (%f %f)", P.name, u2mm(P.x), u2mm(P.y));
if (P.direction == PIN_DIRECTION_IN)
printf(" input");
if ((P.function & PIN_FUNCTION_FLAG_DOT) != 0)
printf(" inverted");
printf("\n");
}
}
}