readByte method
Reads a byte from the I2C device with the address
.
Some I2C devices can directly be read without explicit register.
Implementation
int readByte(int address) {
var data = <I2Cmsg>[];
data.add(I2Cmsg(address, [I2CmsgFlags.i2c_m_rd], 1));
var result = transfer(data);
try {
var ptr = result._messages[0].buf;
var value = ptr[0];
return value;
} finally {
result.dispose();
}
}