skidl.pin module¶
Handles part pins and their connections to nets.
This module provides the Pin class which represents electronic component pins. Pins can be connected to nets and other pins, and have various electrical properties like input, output, bidirectional, etc.
- class skidl.pin.PhantomPin(**attribs)[source]¶
Bases:
Pin
A pin type that exists solely to tie two pinless nets together.
It will not participate in generating any netlists.
- class skidl.pin.Pin(**attribs)[source]¶
Bases:
SkidlBaseObject
A class for storing data about pins for electronic parts.
- Parameters:
attribs – Key/value pairs of attributes to add to the pin.
- MAX_PIN_NUM = 1152921504606846975¶
- chk_conflict(other_pin)[source]¶
Check for electrical rule conflicts between this pin and another.
- Parameters:
other_pin (Pin) – The other pin to check against
- property circuit¶
Return the circuit of the part the pin belongs to.
- Returns:
The circuit containing the parent part
- Return type:
- connect(*pins_nets_buses)[source]¶
Return the pin after connecting it to one or more nets or pins.
- Parameters:
pins_nets_buses – One or more Pin, Net or Bus objects or lists/tuples of them.
- Returns:
The updated pin with the new connections.
- Return type:
Notes
You can connect nets or pins to a pin like so:
p = Pin() # Create a pin. n = Net() # Create a net. p += net # Connect the net to the pin.
- copy(num_copies=None, **attribs)[source]¶
Return copy or list of copies of a pin including any net connection.
- Parameters:
num_copies (int, optional) – Number of copies to make of pin.
- Keyword Arguments:
attribs – Name/value pairs for setting attributes for the pin.
- Returns:
A single copy or a list of copies.
- Return type:
Notes
An instance of a pin can be copied just by calling it like so:
p = Pin() # Create a pin. p_copy = p() # This is a copy of the pin.
- create_network()[source]¶
Create a network from a single pin.
- Returns:
A network containing just this pin
- Return type:
- property drive¶
Get the drive strength of this pin.
- Returns:
Drive strength value from pin_drives enum
- Return type:
- drives¶
alias of
pin_drives
- erc_desc()[source]¶
Return a string describing this pin for ERC.
- Returns:
Description string for the pin
- Return type:
- export()[source]¶
Return a string to recreate a Pin object.
- Returns:
Python code string that recreates the pin when evaluated
- Return type:
- funcs¶
alias of
pin_types
- get_nets()[source]¶
Return a list containing the Net objects connected to this pin.
- Returns:
List of Net objects connected to this pin
- Return type:
- get_pin_info()[source]¶
Get basic pin information.
- Returns:
(pin number, pin names/aliases, pin function)
- Return type:
- get_pins()[source]¶
Return a list containing this pin.
- Returns:
List containing just this pin
- Return type:
- is_assigned()[source]¶
Return true if the pin has been assigned a valid pin number.
- Returns:
- True if the pin is assigned (either has a non-integer number or
an integer number less than or equal to MAX_PIN_SIZE), False otherwise.
- Return type:
Note
A pin is considered assigned if it has either a string/non-integer identifier or an integer pin number within the valid range (1 to MAX_PIN_SIZE).
- is_attached(pin_net_bus)[source]¶
Return true if this pin is attached to the given pin, net or bus.
- Parameters:
pin_net_bus – A Pin, Net or Bus object
- Returns:
True if attached, False otherwise
- Return type:
- Raises:
ValueError – If attempting to check attachment to an invalid object type
- is_connected()[source]¶
Return true if a pin is connected to a net (but not a no-connect net).
- Returns:
True if connected to a normal net, False otherwise
- Return type:
- Raises:
ValueError – If pin is connected to both normal and no-connect nets
- property net¶
Return one of the nets the pin is connected to.
- Returns:
The first net the pin is connected to, or None
- Return type:
Net or None
- property pins¶
Get a list of pins (just this pin for a Pin object).
- Returns:
List containing just this pin
- Return type:
- property ref¶
Return the reference of the part the pin belongs to.
- Returns:
Reference designator of the parent part
- Return type:
- split_name(delimiters)[source]¶
Use chars in divider to split a pin name and add substrings to aliases.
- Parameters:
delimiters (str) – String of characters used to split pin names
- types¶
alias of
pin_types