private void Init(SpiConnectionSettings settings) { SetSpiMode(settings.Mode); SetBitsPerWord(settings.BitsPerWord); SetMaxSpeed(settings.MaxSpeed); SetDelay(settings.Delay); }
/// <summary> /// Creates a new instance of the <see cref="NativeSpiConnection"/> class and initializes it. /// </summary> /// <param name="deviceFilePath">Full path to the SPI device file (e.g. /dev/spidev0.0).</param> /// <param name="settings">Connection settings</param> public NativeSpiConnection(string deviceFilePath, SpiConnectionSettings settings) : this(new SpiControlDevice(new UnixFile(deviceFilePath, UnixFileMode.ReadWrite)), settings) { }
/// <summary> /// Creates a new instance of the <see cref="NativeSpiConnection"/> class and initializes it. /// </summary> /// <param name="deviceFile">A control device (IOCTL) to the device file (e.g. /dev/spidev0.0).</param> /// <param name="settings">Connection settings</param> public NativeSpiConnection(ISpiControlDevice deviceFile, SpiConnectionSettings settings) : this(deviceFile) { Init(settings); }