FrontPanel Platform API - v6.0.0
    Preparing search index...

    Interface IDeviceI2C

    Interface that provides the methods that may be used to interact with the I2C bus on a device.

    interface IDeviceI2C {
        read(address: number, buffer: DataBuffer): Promise<number>;
        write(address: number, data: DataBuffer): Promise<number>;
    }
    Index

    Methods

    Methods

    • Reads data from the target I2C address.

      Parameters

      • address: number

        I2C address of the target device.

      • buffer: DataBuffer

        The buffer to store the data that is read. The transfer length is determined by the buffer's byte length. The buffer must not be modified or detached until the returned Promise settles.

      Returns Promise<number>

      • A promise that resolves when the data has been read indicating the number of bytes that were successfully read.
    • Writes data to the target I2C address.

      Parameters

      • address: number

        I2C address of the target device.

      • data: DataBuffer

        The data to write. The transfer length is determined by the buffer's byte length. The buffer must not be modified or detached until the returned Promise settles.

      Returns Promise<number>

      • A promise that resolves when the data has been written indicating the number of bytes that were successfully written.