esp-web-tools
Version:
Web tools for ESP devices
14 lines (13 loc) • 824 B
TypeScript
import { type LineConfig, type UsbSerialDriver } from "./driver";
/**
* Compute the 16 bit value for registers 0x12 (prescaler) and 0x13 (divisor)
* for a baud rate. Mirrors the algorithm of the Linux ch341 driver: pick the
* largest base clock that keeps the divisor below 512, round to the nearest
* divisor, then prefer the lower base clock when the divisor is even.
*/
export declare const ch34xBaudDivisor: (baudRate: number) => number;
/** Line control register value (the chip always keeps RX and TX enabled). */
export declare const ch34xLineControl: (config: LineConfig) => number;
/** Value for the modem control request: DTR/RTS bits, inverted. */
export declare const ch34xModemControl: (dtr: boolean, rts: boolean) => number;
export declare const createCh34xDriver: (device: USBDevice) => UsbSerialDriver;