-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bus): update library and dependencies
BREAKING CHANGE: Update i2c-bus version to latest, which is already promised. Refactor Bus and Device to classes and remove unnecessary code.
- Loading branch information
1 parent
1b98526
commit d5954a7
Showing
14 changed files
with
991 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
declare module 'i2c-bus' { | ||
export interface I2cFuncs { | ||
i2c: boolean; | ||
tenBitAddr: boolean; | ||
protocolMangling: boolean; | ||
smbusPec: boolean; | ||
smbusBlockProcCall: boolean; | ||
smbusQuick: boolean; | ||
smbusReceiveByte: boolean; | ||
smbusSendByte: boolean; | ||
smbusReadByte: boolean; | ||
smbusWriteByte: boolean; | ||
smbusReadWord: boolean; | ||
smbusWriteWord: boolean; | ||
smbusProcCall: boolean; | ||
smbusReadBlock: boolean; | ||
smbusWriteBlock: boolean; | ||
smbusReadI2cBlock: boolean; | ||
smbusWriteI2cBlock: boolean; | ||
} | ||
|
||
export interface I2cReadResponse { | ||
bytesRead: number; | ||
buffer: Buffer; | ||
} | ||
|
||
export interface I2cWriteResponse { | ||
bytesWritten: number; | ||
buffer: Buffer; | ||
} | ||
|
||
export interface PromisifiedBus { | ||
_busNumber: number; | ||
_forceAccess: boolean; | ||
|
||
close(): Promise<void>; | ||
i2cFuncs(): Promise<I2cFuncs>; | ||
|
||
readByte(address: number, command: number): Promise<number>; | ||
readWord(address: number, command: number): Promise<number>; | ||
readI2cBlock(address: number, command: number, length: number, buffer: Buffer): Promise<I2cReadResponse>; | ||
receiveByte(address: number): Promise<number>; | ||
|
||
sendByte(address: number, byte: number): Promise<void>; | ||
writeByte(address: number, command: number, byte: number): Promise<void>; | ||
writeWord(address: number, command: number, word: number): Promise<void>; | ||
writeQuick(address: number, bit: 0 | 1): Promise<void>; | ||
writeI2cBlock(address: number, command: number, length: number, buffer: Buffer): Promise<I2cWriteResponse>; | ||
|
||
i2cRead(address: number, length: number, buffer: Buffer): Promise<I2cReadResponse>; | ||
i2cWrite(address: number, length: number, buffer: Buffer): Promise<I2cWriteResponse>; | ||
|
||
scan(startAddress?: number, endAddress?: number): Promise<number[]>; | ||
deviceId(address: number): Promise<number>; | ||
} | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function openPromisified(busNumber: number, options?: { forceAccess: boolean }): Promise<PromisifiedBus>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import Bus from './lib/Bus'; | ||
import BusError from './lib/BusError'; | ||
import BusInterface from './lib/BusInterface'; | ||
import createI2cBusMock from './lib/createI2cBusMock'; | ||
import Device from './lib/Device'; | ||
import DeviceError from './lib/DeviceError'; | ||
import DeviceInterface from './lib/DeviceInterface'; | ||
|
||
export { Bus, BusError, BusInterface, createI2cBusMock, Device, DeviceError, DeviceInterface }; | ||
export { Bus, BusError, Device }; |
Oops, something went wrong.