Modifier and Type | Method and Description |
---|---|
static int |
i2cClose(int fd)
Closes linux file.
|
static int |
i2cOpen(String device)
Opens linux file for r/w returning file handle.
|
static int |
i2cReadByte(int fd,
int deviceAddress,
int localAddress)
Reads one byte from i2c device.
|
static int |
i2cReadByteDirect(int fd,
int deviceAddress)
Reads one byte from i2c device.
|
static int |
i2cReadBytes(int fd,
int deviceAddress,
int localAddress,
int size,
int offset,
byte[] buffer)
Reads more bytes from i2c device.
|
static int |
i2cReadBytesDirect(int fd,
int deviceAddress,
int size,
int offset,
byte[] buffer)
Reads more bytes from i2c device.
|
static int |
i2cWriteAndReadBytes(int fd,
int deviceAddress,
int writeSize,
int writeOffset,
byte[] writeBuffer,
int readSize,
int readOffset,
byte[] readBuffer)
Reads more bytes from i2c device.
|
static int |
i2cWriteByte(int fd,
int deviceAddress,
int localAddress,
byte data)
Writes one byte to i2c.
|
static int |
i2cWriteByteDirect(int fd,
int deviceAddress,
byte data)
Writes one byte to i2c.
|
static int |
i2cWriteBytes(int fd,
int deviceAddress,
int localAddress,
int size,
int offset,
byte[] buffer)
Writes several bytes to i2c.
|
static int |
i2cWriteBytesDirect(int fd,
int deviceAddress,
int size,
int offset,
byte[] buffer)
Writes several bytes to i2c.
|
public static int i2cOpen(String device)
device
- file name of device. For i2c should be /dev/i2c-0 or /dev/i2c-1 for first or second bus.public static int i2cClose(int fd)
fd
- file descriptorpublic static int i2cWriteByteDirect(int fd, int deviceAddress, byte data)
fd
- file descriptor of i2c busdeviceAddress
- device addressdata
- byte to be written to the devicepublic static int i2cWriteBytesDirect(int fd, int deviceAddress, int size, int offset, byte[] buffer)
fd
- file descriptor of i2c busdeviceAddress
- device addresssize
- number of bytes to be writtenoffset
- offset in buffer to read frombuffer
- data buffer to be writtenpublic static int i2cWriteByte(int fd, int deviceAddress, int localAddress, byte data)
fd
- file descriptor of i2c busdeviceAddress
- device addresslocalAddress
- address in the devicedata
- byte to be written to the devicepublic static int i2cWriteBytes(int fd, int deviceAddress, int localAddress, int size, int offset, byte[] buffer)
fd
- file descriptor of i2c busdeviceAddress
- device addresslocalAddress
- address in the devicesize
- number of bytes to be writtenoffset
- offset in buffer to read frombuffer
- data buffer to be writtenpublic static int i2cReadByteDirect(int fd, int deviceAddress)
fd
- file descriptor of i2c busdeviceAddress
- device addresspublic static int i2cReadBytesDirect(int fd, int deviceAddress, int size, int offset, byte[] buffer)
fd
- file descriptor of i2c busdeviceAddress
- device addresssize
- number of bytes to be readoffset
- offset in buffer to stored read databuffer
- buffer for data to be written topublic static int i2cReadByte(int fd, int deviceAddress, int localAddress)
fd
- file descriptor of i2c busdeviceAddress
- device addresslocalAddress
- address in the devicepublic static int i2cReadBytes(int fd, int deviceAddress, int localAddress, int size, int offset, byte[] buffer)
fd
- file descriptor of i2c busdeviceAddress
- device addresslocalAddress
- address in the devicesize
- number of bytes to be readoffset
- offset in buffer to stored read databuffer
- buffer for data to be written topublic static int i2cWriteAndReadBytes(int fd, int deviceAddress, int writeSize, int writeOffset, byte[] writeBuffer, int readSize, int readOffset, byte[] readBuffer)
fd
- file descriptor of i2c busdeviceAddress
- device addresswriteSize
- number of bytes to writewriteOffset
- offset in write buffer to start write datawriteBuffer
- buffer for data to be written fromreadSize
- number of bytes to be readreadOffset
- offset in read buffer to stored read datareadBuffer
- buffer for data read to be stored inCopyright © 2012–2019 Pi4J. All rights reserved.