Treehopper Java API
io.treehopper.interfaces.Spi Interface Reference

SPI interface. More...

Inheritance diagram for io.treehopper.interfaces.Spi:
io.treehopper.HardwareSpi

Public Member Functions

boolean isEnabled ()
 Gets whether the SPI interface is enabled. More...
 
void setEnabled (boolean enabled)
 Sets whether the SPI interface is enabled. More...
 
byte [] SendReceive (byte[] dataToWrite)
 Exchange data with an SPI slave. More...
 
byte [] SendReceive (byte[] dataToWrite, SpiChipSelectPin chipSelect, ChipSelectMode chipSelectMode)
 Exchange data with an SPI slave. More...
 
byte [] SendReceive (byte[] dataToWrite, SpiChipSelectPin chipSelect, ChipSelectMode chipSelectMode, double speedMhz)
 Exchange data with an SPI slave. More...
 
byte [] SendReceive (byte[] dataToWrite, SpiChipSelectPin chipSelect, ChipSelectMode chipSelectMode, double speedMhz, BurstMode burstMode)
 Exchange data with an SPI slave. More...
 
byte [] SendReceive (byte[] dataToWrite, SpiChipSelectPin chipSelect, ChipSelectMode chipSelectMode, double speedMhz, BurstMode burstMode, SpiMode spiMode)
 Exchange data with an SPI slave. More...
 

Detailed Description

SPI interface.

Member Function Documentation

◆ isEnabled()

boolean io.treehopper.interfaces.Spi.isEnabled ( )

Gets whether the SPI interface is enabled.

Returns
true if the interface is enabled; false otherwise

Implemented in io.treehopper.HardwareSpi.

◆ SendReceive() [1/5]

byte [] io.treehopper.interfaces.Spi.SendReceive ( byte []  dataToWrite)

Exchange data with an SPI slave.

Parameters
dataToWritethe data to write
Returns
The data read from the peripheral

Implemented in io.treehopper.HardwareSpi.

◆ SendReceive() [2/5]

byte [] io.treehopper.interfaces.Spi.SendReceive ( byte []  dataToWrite,
SpiChipSelectPin  chipSelect,
ChipSelectMode  chipSelectMode 
)

Exchange data with an SPI slave.

Parameters
dataToWritethe data to write
chipSelectthe chip select pin to use
chipSelectModethe chip select mode to use
Returns
The data read from the peripheral

Implemented in io.treehopper.HardwareSpi.

◆ SendReceive() [3/5]

byte [] io.treehopper.interfaces.Spi.SendReceive ( byte []  dataToWrite,
SpiChipSelectPin  chipSelect,
ChipSelectMode  chipSelectMode,
double  speedMhz 
)

Exchange data with an SPI slave.

Parameters
dataToWritethe data to write
chipSelectthe chip select pin to use
chipSelectModethe chip select mode to use
speedMhzthe speed, in MHz, to use
Returns
The data read from the peripheral

Implemented in io.treehopper.HardwareSpi.

◆ SendReceive() [4/5]

byte [] io.treehopper.interfaces.Spi.SendReceive ( byte []  dataToWrite,
SpiChipSelectPin  chipSelect,
ChipSelectMode  chipSelectMode,
double  speedMhz,
BurstMode  burstMode 
)

Exchange data with an SPI slave.

Parameters
dataToWritethe data to write
chipSelectthe chip select pin to use
chipSelectModethe chip select mode to use
speedMhzthe speed, in MHz, to use
burstModethe burst mode (if any) to use
Returns
The data read from the peripheral

Implemented in io.treehopper.HardwareSpi.

◆ SendReceive() [5/5]

byte [] io.treehopper.interfaces.Spi.SendReceive ( byte []  dataToWrite,
SpiChipSelectPin  chipSelect,
ChipSelectMode  chipSelectMode,
double  speedMhz,
BurstMode  burstMode,
SpiMode  spiMode 
)

Exchange data with an SPI slave.

Parameters
dataToWritethe data to write
chipSelectthe chip select pin to use
chipSelectModethe chip select mode to use
speedMhzthe speed, in MHz, to use
burstModethe burst mode (if any) to use
spiModethe SPI mode to use
Returns
The data read from the peripheral

Implemented in io.treehopper.HardwareSpi.

◆ setEnabled()

void io.treehopper.interfaces.Spi.setEnabled ( boolean  enabled)

Sets whether the SPI interface is enabled.

Parameters
enabledtrue to enable the interface; false to disable it

Implemented in io.treehopper.HardwareSpi.


The documentation for this interface was generated from the following file: