public interface I2cMaster
| Modifier and Type | Method and Description |
|---|---|
int |
getStatus(int deviceAddress,
byte[] controllerStatus)
Read the status of the I2C master controller.
|
int |
init(int kbps)
Initialize the device as I2C master with the requested I2C speed.
|
int |
read(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Read data from the specified I2C slave device with START and STOP conditions.
|
int |
readEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Read data from the specified I2C slave device with the specified I2C condition.
|
int |
reset()
Reset the I2C master device.
|
int |
write(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Write data to the specified I2C slave device with START and STOP conditions
|
int |
writeEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
Write data to the specified I2C slave device with the specified I2C condition.
|
int init(int kbps)
kbps - The speed of I2C transmission.int reset()
int read(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
deviceAddress - Address of the target I2C slave.buffer - Buffer array that receives the data from the device.sizeToTransfer - Number of bytes to read from the device.sizeTransferred - The actual number of bytes read from the device.int readEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
deviceAddress - Address of the target I2C slave.flag - The I2C condition will be sent with this I2C transaction. flags is a bit-mask of
I2C_MasterFlag#NONE, I2C_MasterFlag#START,
I2C_MasterFlag#Repeated_START, I2C_MasterFlag#STOP and
I2C_MasterFlag#START_AND_STOP.buffer - Buffer array that receives the data from the device.sizeToTransfer - Number of bytes to read from the device.sizeTransferred - The actual number of bytes read from the device.int write(int deviceAddress,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
deviceAddress - Address of the target I2C slave.buffer - Buffer array that contains the data to be written to the device.sizeToTransfer - Number of bytes to write to the device.sizeTransferred - The actual number of bytes written to the device.int writeEx(int deviceAddress,
int flag,
byte[] buffer,
int sizeToTransfer,
int[] sizeTransferred)
deviceAddress - Address of the target I2C slave.flag - The I2C condition will be sent with this I2C transaction. flags is a bit-mask of
I2C_MasterFlag#NONE, I2C_MasterFlag#START,
I2C_MasterFlag#Repeated_START, I2C_MasterFlag#STOP and
I2C_MasterFlag#START_AND_STOP.buffer - Buffer array that contains the data to be written to the device.sizeToTransfer - Number of bytes to write to the device.sizeTransferred - The actual number of bytes written to the device.int getStatus(int deviceAddress,
byte[] controllerStatus)
deviceAddress - Address of the target I2C slave.controllerStatus - Buffer array that contains the to be return status data.