Package com.diozero.api
Class SpiDevice.Builder
- java.lang.Object
-
- com.diozero.api.SpiDevice.Builder
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder(int chipSelect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SpiDevice
build()
Provision a new SPI deviceSpiDevice.Builder
setChipSelect(int chipSelect)
SPI chip select numberSpiDevice.Builder
setClockMode(SpiClockMode clockMode)
Set the SPIclock mode
SpiDevice.Builder
setController(int controller)
Set the SPI controller numberSpiDevice.Builder
setFrequency(int frequency)
Set the SPI clock frequencySpiDevice.Builder
setLsbFirst(boolean lsbFirst)
Set the byte order
-
-
-
Method Detail
-
setController
public SpiDevice.Builder setController(int controller)
Set the SPI controller number- Parameters:
controller
- the SPI controller number- Returns:
- this builder instance
-
setChipSelect
public SpiDevice.Builder setChipSelect(int chipSelect)
SPI chip select number- Parameters:
chipSelect
- the chip select number- Returns:
- this builder instance
-
setFrequency
public SpiDevice.Builder setFrequency(int frequency)
Set the SPI clock frequency- Parameters:
frequency
- the SPI clock frequency- Returns:
- this builder instance
-
setClockMode
public SpiDevice.Builder setClockMode(SpiClockMode clockMode)
Set the SPIclock mode
- Parameters:
clockMode
- the SPI clock mode to use- Returns:
- this builder instance
-
setLsbFirst
public SpiDevice.Builder setLsbFirst(boolean lsbFirst)
Set the byte order- Parameters:
lsbFirst
- True for little endian- Returns:
- this builder instance
-
build
public SpiDevice build()
Provision a new SPI device- Returns:
- a new SPI device instance
-
-