Package com.pi4j.io.spi
Class SpiFactory
- java.lang.Object
-
- com.pi4j.io.spi.SpiFactory
-
public class SpiFactory extends Object
SPI factory - it returns instances ofSpiDeviceinterface.- Author:
- Robert Savage (http://www.savagehomeautomation.com)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SpiDevicegetInstance(SpiChannel channel)Create new SpiDevice instance with a default SPI speed of 1 MHz.static SpiDevicegetInstance(SpiChannel channel, int speed)Create new SpiDevice instancestatic SpiDevicegetInstance(SpiChannel channel, int speed, SpiMode mode)Create new SpiDevice instancestatic SpiDevicegetInstance(SpiChannel channel, SpiMode mode)Create new SpiDevice instance
-
-
-
Method Detail
-
getInstance
public static SpiDevice getInstance(SpiChannel channel) throws IOException
Create new SpiDevice instance with a default SPI speed of 1 MHz.- Parameters:
channel- spi channel to use- Returns:
- Return a new SpiDevice impl instance.
- Throws:
IOException
-
getInstance
public static SpiDevice getInstance(SpiChannel channel, SpiMode mode) throws IOException
Create new SpiDevice instance- Parameters:
channel- spi channel to usemode- spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)- Returns:
- Return a new SpiDevice impl instance.
- Throws:
IOException
-
getInstance
public static SpiDevice getInstance(SpiChannel channel, int speed) throws IOException
Create new SpiDevice instance- Parameters:
channel- spi channel to usespeed- spi speed/rate (in Hertz) for channel to communicate at (range is 500kHz - 32MHz)- Returns:
- Return a new SpiDevice impl instance.
- Throws:
IOException
-
getInstance
public static SpiDevice getInstance(SpiChannel channel, int speed, SpiMode mode) throws IOException
Create new SpiDevice instance- Parameters:
channel- spi channel to usespeed- spi speed/rate (in Hertz) for channel to communicate at (range is 500kHz - 32MHz)mode- spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)- Returns:
- Return a new SpiDevice impl instance.
- Throws:
IOException
-
-