Pins

In typeCAD, the Pin object represents the pin/leg/lead/ball etc. of a component.

Pin

All Component objects have a ::pin() function that returns a Pin object for the number passed.

import { Resistor } from '@typecad/passives/0805'
let r1 = new Resistor({ value: '1kohm' });

r1.pin(1);      // to get the pin object for the first pin
r1.pin(2);      // and the second

Using ::pin() like that is the simplest way, but for more complex components, it can become unwieldy remembering which pin is which.

A more declarative way to use/create Pin objects is described in the components page. Using the typeCAD tooling, any given component can be created giving access to Pin objects that allow them to be used with a descriptive name.

import { ATtiny85_20S } from './ATtiny85_20S';
let u1 = new ATtiny85_20S();

u1.VCC      // for this particular component, the VCC pin is pin 8
u1.GND      // GND is pin 4

Power aware

Each Pin object has a powerInfo object that can be optionally passed when creating the Pin. It has the following properties:

  • minimum_voltage — minimum voltage the pin can tolerate
  • maximum_voltage — maximum voltage the pin can tolerate
  • current — maximum current the pin can handle

When pins have the object passed with data, typeCAD can check that the voltage levels and current draw are compatible with each other.

  VCC = new Pin(this.reference, 8, 'power_in', this, {
    minimum_voltage: -0.5,
    maximum_voltage: 6,
    current: 0.2,
  });

VCC can accept -0.5 to 6 volts and supply up to 0.2 amps. When connected to other pins, typeCAD can check that the voltage and current levels are compatible and issue error or warning messages if the voltage is too high or the current draw is too much.