Treehopper Java API
io.treehopper.SpiDevice Class Reference

An SPI peripheral device. More...

Public Member Functions

 SpiDevice (HardwareSpi spiModule, Pin chipSelect, ChipSelectMode csMode)
 Create a new SPI device with the given settings. More...
 
 SpiDevice (HardwareSpi spiModule, Pin chipSelect, ChipSelectMode csMode, double speedMHz)
 Create a new SPI device with the given settings. More...
 
 SpiDevice (HardwareSpi spiModule, Pin chipSelect, ChipSelectMode csMode, double speedMHz, SpiMode mode)
 Create a new SPI device with the given settings. More...
 
byte [] SendReceive (byte[] dataToSend)
 Exchange data with the SPI peripheral. More...
 
byte [] SendReceive (byte[] dataToSend, BurstMode burst)
 Exchange data with the SPI peripheral. More...
 

Detailed Description

An SPI peripheral device.

Constructor & Destructor Documentation

◆ SpiDevice() [1/3]

io.treehopper.SpiDevice.SpiDevice ( HardwareSpi  spiModule,
Pin  chipSelect,
ChipSelectMode  csMode 
)

Create a new SPI device with the given settings.

Parameters
spiModulethe Spi module to use
chipSelectthe chip select pin to use
csModeThe chip select mode to use

◆ SpiDevice() [2/3]

io.treehopper.SpiDevice.SpiDevice ( HardwareSpi  spiModule,
Pin  chipSelect,
ChipSelectMode  csMode,
double  speedMHz 
)

Create a new SPI device with the given settings.

Parameters
spiModulethe Spi module to use
chipSelectthe chip select pin to use
csModeThe chip select mode to use
speedMHzthe speed, in MHz, to use

◆ SpiDevice() [3/3]

io.treehopper.SpiDevice.SpiDevice ( HardwareSpi  spiModule,
Pin  chipSelect,
ChipSelectMode  csMode,
double  speedMHz,
SpiMode  mode 
)

Create a new SPI device with the given settings.

Parameters
spiModulethe Spi module to use
chipSelectthe chip select pin to use
csModeThe chip select mode to use
speedMHzthe speed, in MHz, to use
modethe SPI mode to use

Member Function Documentation

◆ SendReceive() [1/2]

byte [] io.treehopper.SpiDevice.SendReceive ( byte []  dataToSend)

Exchange data with the SPI peripheral.

Parameters
dataToSendthe data to send
Returns
the data read from the device

◆ SendReceive() [2/2]

byte [] io.treehopper.SpiDevice.SendReceive ( byte []  dataToSend,
BurstMode  burst 
)

Exchange data with the SPI peripheral.

Parameters
dataToSendthe data to send
burstthe burst mode to use with the device
Returns
the data read from the device

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