Package com.diozero.api
Interface SpiDeviceInterface
- All Superinterfaces:
AutoCloseable
,DeviceInterface
- All Known Subinterfaces:
InternalSpiDeviceInterface
- All Known Implementing Classes:
DefaultNativeSpiDevice
,SpiDevice
public interface SpiDeviceInterface extends DeviceInterface
-
Method Summary
Modifier and Type Method Description int
getChipSelect()
Get the SPI Chip Selectint
getController()
Get the SPI controllervoid
write(byte... data)
Write the entire contents ofdata
to the devicevoid
write(byte[] data, int offset, int length)
Writelength
bytes fromdata
starting atoffset
byte[]
writeAndRead(byte... data)
Write thedata
to the device then readdata.length
bytes from the deviceMethods inherited from interface com.diozero.api.DeviceInterface
close
-
Method Details
-
getController
int getController()Get the SPI controller- Returns:
- the SPI controller
-
getChipSelect
int getChipSelect()Get the SPI Chip Select- Returns:
- the SPI chip select
-
write
Write the entire contents ofdata
to the device- Parameters:
data
- the data to write- Throws:
RuntimeIOException
- if an I/O error occurs
-
write
Writelength
bytes fromdata
starting atoffset
- Parameters:
data
- the data to write.offset
- the start offset in the data.length
- the number of bytes to write.- Throws:
RuntimeIOException
- if an I/O error occurs
-
writeAndRead
Write thedata
to the device then readdata.length
bytes from the device- Parameters:
data
- the data to write.- Returns:
- the data read from the device, same length as the data written.
- Throws:
RuntimeIOException
- if an I/O error occurs
-