- All Superinterfaces:
IODataReader,IODataWriter,Readable
I2C Device Register.
This abstraction allows data to be read or written to a specific device register on the I2C bus.
- Version:
- $Id: $Id
- Author:
- Robert Savage
-
Method Summary
Modifier and TypeMethodDescriptiondefault intaddress()address.intgetAddress.intreadWord()Read a single word value (16-bit) to the I2C device register.intwriteReadWord(int word) Write a single word value (16-bit) to the I2C device register and immediately reads back a 16-bit word value.voidwriteWord(int word) Write a single word value (16-bit) to the I2C device register.Methods inherited from interface com.pi4j.io.IODataReader
getInputStream, in, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readByte, readByteBuffer, readByteBuffer, readCharArray, readCharArray, readCharArray, readCharArray, readCharBuffer, readCharBuffer, readCharBuffer, readCharBuffer, readNBytes, readNBytes, readString, readString, readString, readStringMethods inherited from interface com.pi4j.io.IODataWriter
getOutputStream, out, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write
-
Method Details
-
getAddress
int getAddress()getAddress.
- Returns:
- This I2C device register address
-
address
default int address()address.
- Returns:
- a int.
-
writeWord
void writeWord(int word) Write a single word value (16-bit) to the I2C device register.- Parameters:
word- 16-bit word value to be written
-
readWord
int readWord()Read a single word value (16-bit) to the I2C device register.- Returns:
- If success, then returns 16-bit word value read from I2C register; else a negative error code.
-
writeReadWord
int writeReadWord(int word) Write a single word value (16-bit) to the I2C device register and immediately reads back a 16-bit word value.- Parameters:
word- 16-bit word value to be written- Returns:
- The 16-bit word value read/returned; or a negative value if error
-