Skip to content

Commit

Permalink
feat(I2cBus): Add types for I2cBusPromised
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroHerr committed Dec 12, 2018
1 parent b44f318 commit 9be5cf1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { I2cBus, I2cBusFuncs } from 'i2c-bus';

/* tslint:disable-next-line:interface-name */
export interface I2cBusPromised extends I2cBus {
closeAsync: () => Promise<void>;

i2cFuncsAsync: () => Promise<I2cBusFuncs>;
scanAsync: () => Promise<number[]>;

i2cReadAsync: (address: number, length: number, buffer: Buffer) => Promise<number>;
i2cWriteAsync: (address: number, length: number, buffer: Buffer) => Promise<number>;

receiveByteAsync: (address: number) => Promise<number>;
sendByteAsync: (address: number, byte: number) => Promise<void>;

readByteAsync: (address: number, command: number) => Promise<number>;
readWordAsync: (address: number, command: number) => Promise<number>;
readI2cBlockAsync: (address: number, command: number, length: number, buffer: Buffer) => Promise<number>;

writeByteAsync: (address: number, command: number, byte: number) => Promise<void>;
writeWordAsync: (address: number, command: number, word: number) => Promise<void>;
writeI2cBlockAsync: (address: number, command: number, length: number, buffer: Buffer) => Promise<number>;
}

0 comments on commit 9be5cf1

Please sign in to comment.