I2C class

I2C wrapper functions for Linux userspace i2c-dev devices.

c-periphery I2C documentation.

Constructors

I2C(int busNum)
Opens the i2c-dev device at the specified path (e.g. "/dev/i2c-busNum").
I2C.isolate(String json)
Duplicates an existing I2C from a JSON string. This special constustor is used to transfer an existing I2C to an other isolate.

Properties

busNum int
final
hashCode int
The hash code for this object.
no setterinherited
path String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Releases all internal native resources.
getErrno() int
Returns the libc errno of the last failure that occurred.
getHandle() int
Returns the address of the internal handle.
getI2Cfd() int
Returns the file descriptor (for the underlying i2c-dev device) of the I2C handle.
getI2Cinfo() String
Returns a string representation of the I2C handle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readByte(int address) int
Reads a byte from the I2C device with the address.
readByteReg(int address, int register) int
Reads a byte from register of the I2C device with the address.
readBytes(int address, int len) List<int>
Reads len bytes from the I2C device with the address.
readBytesReg(int address, int register, int len) List<int>
Reads len bytes from register of the I2C device with the address.
readWord(int address, [BitOrder order = BitOrder.msbLast]) int
Reads a word from the I2C device with the address and the bit order].
readWordReg(int address, int register, [BitOrder order = BitOrder.msbLast]) int
Reads a word from register of the I2C device with the address with the bit order.
toJson() String
Converts a I2C to a JSON string. See constructor isolate for detials.
toString() String
A string representation of this object.
inherited
transfer(List<I2Cmsg> data) NativeI2CmsgHelper
Transfers a list of I2Cmsg.
writeByte(int address, int byteValue) → void
Writes a byteValue to the I2C device with the address.
writeByteReg(int address, int register, int byteValue) → void
Writes a byteValue to the register of the I2C device with the address.
writeBytes(int address, List<int> byteData) → void
Writes byteData to the I2C device with the address.
writeBytesReg(int address, int register, List<int> byteData) → void
Writes byteData to the register of the I2C device with the address.
writeWord(int address, int wordValue, [BitOrder order = BitOrder.msbLast]) → void
Writes a wordValue to the I2C device with the address and the bit order.
writeWordReg(int address, int register, int wordValue, [BitOrder order = BitOrder.msbLast]) → void
Writes a wordValue to the register of the I2C device with the address and the bit order.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getI2CerrorCode(int value) I2CerrorCode
Converts the native error code value to I2CerrorCode.
i2cMsgFlags2Int(I2CmsgFlags flag) int
Converts I2CmsgFlags to the native bit mask value.