Buses

Three thin classes that tie bus pins together on the schematic: I2C, UART, and USB. Construct one from the component's pins and include it with create() alongside the components.

class

I2C

An I2C bus — the SDA and SCL pins, tied together for the schematic.

Example first

i2c.ts
import { I2C } from '@typecad/pcb';
import { ATtiny85_20S } from './ATtiny85_20S';

let u1 = new ATtiny85_20S();
let i2c = new I2C(u1.PB0, u1.PB1);    // SDA on PB0, SCL on PB1

typecad.create(u1, i2c);

constructor new I2C(sda: Pin, scl: Pin): I2C

ParameterTypeUnits / valuesDescription
sdaPin—The data line pin
sclPin—The clock line pin
class

UART

A UART serial port — receive and transmit pins, with optional hardware flow control.

Example first

uart.ts
import { UART } from '@typecad/pcb';

let serial = new UART(u1.PB2, u1.PB3);              // rx, tx
let flow   = new UART(u1.PB2, u1.PB3, u1.PB4, u1.PB5); // + rts, cts

constructor new UART(rx: Pin, tx: Pin, rts?: Pin, cts?: Pin): UART

ParameterTypeUnits / valuesDescription
rxPin—Receive pin
txPin—Transmit pin
rtsPin—Optional — request to send
ctsPin—Optional — clear to send
class

USB

A USB port — the D+ and D- differential pair.

Example first

usb.ts
import { USB } from '@typecad/pcb';

let usb = new USB(u1.DP, u1.DN);      // USB D+ and D- pins

constructor new USB(DP: Pin, DN: Pin): USB

ParameterTypeUnits / valuesDescription
DPPin—USB D+ pin
DNPin—USB D- pin
© 2026 typeCAD — code-defined electronics github