int flags = clockMode.getMode();
public NativeSpiDevice(int controller, int chipSelect, int speedHz, SpiClockMode mode, boolean lsbFirst) { this.controller = controller; this.chipSelect = chipSelect; this.speedHz = speedHz; this.spiMode = mode.getMode(); bitsPerWord = SPIConstants.DEFAULT_WORD_LENGTH; String spidev = "/dev/spidev" + controller + "." + chipSelect; Logger.debug("Opening {}, frequency {} Hz, mode {}", spidev, Integer.valueOf(speedHz), mode); fd = spiOpen(spidev, spiMode, speedHz, bitsPerWord, lsbFirst); }
public Pi4jSpiDevice(String key, DeviceFactoryInterface deviceFactory, int controller, int chipSelect, int speed, SpiClockMode mode, boolean lsbFirst) throws RuntimeIOException { super(key, deviceFactory); this.controller = controller; this.chipSelect = chipSelect; try { spiDevice = SpiFactory.getInstance(SpiChannel.getByNumber(chipSelect), speed, SpiMode.getByNumber(mode.getMode())); } catch (IOException e) { throw new RuntimeIOException(e); } }