@typecad/typecad
Version:
🤖programmatically 💥create 🛰️hardware
31 lines (30 loc) • 1.06 kB
JavaScript
/**
* Class representing a pin in a schematic.
*
* @class Pin
*/
export class Pin {
/**
* Initializes a new pin with a given reference, number, and optional type.
*
* @param {string} reference - The reference identifier for the pin.
* @param {number|string} number - The pin number or identifier.
* @param {TPinType} [type] - The type of the pin. Defaults to 'passive'.
* @param {Component} [owner] - The owner component of this pin.
* @param {IPinPowerInfo} [powerInfo] - Power characteristics of the pin.
* @example
* ```ts
* let pin = new Pin('R1', 1, 'input');
* let powerPin = new Pin('U1', 5, 'power_in', this, { minimum_voltage: -0.3, maximum_voltage: 6.5, current: 2 });
* ```
*/
constructor(reference, number, type, owner, powerInfo) {
this.number = '';
this.reference = '';
this.reference = reference;
this.number = number;
this.type = type || 'passive';
this.owner = owner || null;
this.powerInfo = powerInfo;
}
}