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
All Methods Instance Methods Abstract Methods 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 device-
Methods inherited from interface com.diozero.api.DeviceInterface
close
-
-
-
-
Method Detail
-
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
void write(byte... data) throws RuntimeIOException
Write the entire contents ofdata
to the device- Parameters:
data
- the data to write- Throws:
RuntimeIOException
- if an I/O error occurs
-
write
void write(byte[] data, int offset, int length) throws RuntimeIOException
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
byte[] writeAndRead(byte... data) throws RuntimeIOException
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
-
-