pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class SerialPort

    One serial port, shared by the program and every driver built on it.

    SerialPort.open(path, settings) opens the kernel's serial device raw on a Linux board and throws anywhere else. SerialPort.looped(settings) is a line with TX wired to RX, SerialPort.pair(settings) the two ends of a null-modem cable, and SerialPort.scripted(settings, steps) a port that checks each write against a script. write and read return promises that reject with the reason.

    Index
    • get remaining(): number | null

      How many steps a script has left, or null when the port is not scripted.

      Returns number | null

    • get waitedMicros(): number

      How long reads have waited without an answer, and waits have waited, in microseconds, whether or not the process slept through it.

      Returns number

    • Drops whatever has arrived and not been read, as a client does before a request so a stale reply cannot be taken for the new one.

      Returns void

    • Reads up to max bytes, waiting up to timeoutMs for the first one when nothing has arrived. Resolves with what arrived, empty when the timeout passed with nothing.

      Parameters

      • max: number
      • timeoutMs: number

      Returns Promise<Buffer<ArrayBufferLike>>

    • Waits, as a protocol does to leave the line silent between frames: really on the kernel's device, and anywhere else the wait is only counted.

      Parameters

      • ms: number

      Returns Promise<void>

    • Writes bytes, resolving once they have left the UART. Rejects when a script expected another write, or with the kernel's reason.

      Parameters

      • bytes: Buffer

      Returns Promise<void>