diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..7ccfe16 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,23 @@ +import { I2cBus, I2cBusFuncs } from 'i2c-bus'; + +/* tslint:disable-next-line:interface-name */ +export interface I2cBusPromised extends I2cBus { + closeAsync: () => Promise; + + i2cFuncsAsync: () => Promise; + scanAsync: () => Promise; + + i2cReadAsync: (address: number, length: number, buffer: Buffer) => Promise; + i2cWriteAsync: (address: number, length: number, buffer: Buffer) => Promise; + + receiveByteAsync: (address: number) => Promise; + sendByteAsync: (address: number, byte: number) => Promise; + + readByteAsync: (address: number, command: number) => Promise; + readWordAsync: (address: number, command: number) => Promise; + readI2cBlockAsync: (address: number, command: number, length: number, buffer: Buffer) => Promise; + + writeByteAsync: (address: number, command: number, byte: number) => Promise; + writeWordAsync: (address: number, command: number, word: number) => Promise; + writeI2cBlockAsync: (address: number, command: number, length: number, buffer: Buffer) => Promise; +}