public interface SpiMaster
Modifier and Type | Method and Description |
---|---|
int |
init(int ioLine,
int clock,
int cpol,
int cpha,
byte ssoMap)
Initialize the device as an SPI master.
|
int |
multiReadWrite(byte[] readBuffer,
byte[] writeBuffer,
int singleWriteBytes,
int multiWriteBytes,
int multiReadBytes,
int[] sizeOfRead)
Under SPI dual or quad mode, write data to and read data from an SPI slave.
|
int |
reset()
Reset the SPI master device.
|
int |
setLines(int spiMode)
Switch the SPI master to single, dual, or quad lines.
|
int |
singleRead(byte[] readBuffer,
int sizeToTransfer,
int[] sizeOfRead,
boolean isEndTransaction)
Under SPI single mode, read data from an SPI slave.
|
int |
singleReadWrite(byte[] readBuffer,
byte[] writeBuffer,
int sizeToTransfer,
int[] sizeTransferred,
boolean isEndTransaction)
Under SPI single mode, full-duplex write data to and read data from an SPI slave.
|
int |
singleWrite(byte[] writeBuffer,
int sizeToTransfer,
int[] sizeTransferred,
boolean isEndTransaction)
Under SPI single mode, write data to an SPI slave.
|
int init(int ioLine, int clock, int cpol, int cpha, byte ssoMap)
ioLine
- SPI transmission linesclock
- Clock dividercpol
- Clock polaritycpha
- Clock phasessoMap
- Slave selection output pinsint reset()
int setLines(int spiMode)
spiMode
- SPI mode could be: SPI_IO_SINGLE , SPI_IO_DUAL, SPI_IO_QUADint singleWrite(byte[] writeBuffer, int sizeToTransfer, int[] sizeTransferred, boolean isEndTransaction)
writeBuffer
- buffer that contains the data to be written to the device.sizeToTransfer
- The size of read and write buffer. They must be the same.sizeTransferred
- Pointer to a variable of type uint16 which receives the number of bytes read and written to the device.isEndTransaction
- TRUE to raise the pin of SS at the end of the transactionint singleRead(byte[] readBuffer, int sizeToTransfer, int[] sizeOfRead, boolean isEndTransaction)
readBuffer
- buffer that receives the data from the devicesizeToTransfer
- The size of read and write buffer. They must be the same.sizeTransferred
- Pointer to a variable of type uint16 which receives the number of bytes read and written to the device.isEndTransaction
- TRUE to raise the pin of SS at the end of the transactionint singleReadWrite(byte[] readBuffer, byte[] writeBuffer, int sizeToTransfer, int[] sizeTransferred, boolean isEndTransaction)
readBuffer
- buffer that receives the data from the devicewriteBuffer
- buffer that contains the data to be written to the device.sizeToTransfer
- The size of read and write buffer. They must be the same.sizeTransferred
- Pointer to a variable of type uint16 which receives the number of bytes read and written to the device.isEndTransaction
- TRUE to raise the pin of SS at the end of the transactionint multiReadWrite(byte[] readBuffer, byte[] writeBuffer, int singleWriteBytes, int multiWriteBytes, int multiReadBytes, int[] sizeOfRead)
readBuffer
- buffer that receives the data from the device.writeBuffer
- buffer that contains the data to be written to the device. .singleWriteBytes
- number of bytes in writeBuffer will be written as single-line.multiWriteBytes
- number of bytes in writeBuffer will be written as multi-line.multiReadBytes
- number of bytes to read as multi-line.sizeOfRead
- number of bytes read from the device.