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

    Class I2cBus

    One I2C bus, shared by the program and every driver built on it.

    Transfers run one at a time, synchronously; each is quick, the time a few bytes take on the wire. A failed transfer throws with the reason: nothing answered at the address, the script expected something else, or the kernel's own words.

    Index
    • get remaining(): number | null

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

      Returns number | null

    • get transfers(): number

      How many transfers have been made on the bus, by the program and every driver on it, including any that failed.

      Returns number

    • get waitedMicros(): number

      How long the drivers on the bus have asked to wait, in microseconds, whether or not the process slept through it.

      Returns number

    • A copy of what a simulated part holds now, with whatever drivers have written to it, as the class of part it is, or null when the bus is not simulated or no part holds the address.

      Parameters

      • address: number

      Returns WordPart | I2cPart | CommandPart | null

    • Reads length bytes from a part in one transaction.

      Parameters

      • address: number
      • length: number

      Returns Buffer

    • Writes bytes to a part in one transaction: usually a register address and its value.

      Parameters

      • address: number
      • bytes: Buffer

      Returns void

    • Writes bytes and then reads length bytes in one transaction, with a repeated start between them, which is how a register is read.

      Parameters

      • address: number
      • bytes: Buffer
      • length: number

      Returns Buffer

    • Opens the kernel's I2C adapter, such as /dev/i2c-1 on a Raspberry Pi.

      Throws anywhere but Linux, and when the file cannot be opened as an adapter: the interface is not turned on, or the process may not use it.

      Parameters

      • path: string

      Returns I2cBus