esp-web-tools
Version:
Web tools for ESP devices
26 lines (25 loc) • 1.34 kB
TypeScript
import { type LineConfig, type UsbSerialDriver } from "./driver";
export interface FtdiChip {
/** Hi-speed chips (FT2232H/4232H/232H) use a 120 MHz base clock. */
highSpeed: boolean;
/** Baud rate index is shifted into the high byte of wIndex. */
shiftBaudIndex: boolean;
maxBaud: number;
}
/**
* Classify a chip from its bcdDevice (and whether it has several interfaces).
* Returns undefined for the ancient SIO/FT8U232AM parts.
*/
export declare const ftdiChipFromVersion: (bcdDevice: number, multiInterface: boolean) => FtdiChip | undefined;
/**
* 32 bit baud rate divisor: low 16 bits go in wValue, high 16 bits in wIndex.
* Mirrors the Linux ftdi_sio algorithm.
*/
export declare const ftdiBaudDivisor: (baudRate: number, chip: FtdiChip) => number;
/** SET_DATA value: data bits, parity (bits 8-10), stop bits (bits 11-13). */
export declare const ftdiDataBits: (config: LineConfig, brk?: boolean) => number;
/** SET_MODEM_CTRL value that sets both DTR and RTS to the given levels. */
export declare const ftdiModemControl: (dtr: boolean, rts: boolean) => number;
/** Drop the 2 status bytes at the start of every packet in `data`. */
export declare const ftdiStripStatus: (data: Uint8Array, packetSize: number) => Uint8Array;
export declare const createFtdiDriver: (device: USBDevice) => UsbSerialDriver;