/// <summary> /// /// </summary> /// <param name="socket">The <see cref="Socket"/> for the <see cref="SPI"/> interface.</param> /// <param name="spiConfiguration">The <see cref="Configuration"/> object for the <see cref="SPI"/> interface.</param> /// <param name="sharingMode">The <see cref="Sharing"/> mode of the <see cref="SPI"/> interface.</param> /// <param name="chipSelectSocket">The chip select <see cref="Socket"/>of the <see cref="SPI"/> interface.</param> /// <param name="chipSelectPin">The <see cref="Socket"/></param> /// <param name="module">The <see cref="Module"/> that is connected to the <see cref="SPI"/> interface.</param> public SPI(Socket socket, Configuration spiConfiguration, Sharing sharingMode, Socket chipSelectSocket, Socket.Pin chipSelectPin, Module module) { socket.EnsureTypeIsSupported('S', module); Cpu.Pin reservedSelectPin = Socket.UnspecifiedPin; if (chipSelectSocket != null) { reservedSelectPin = chipSelectSocket.ReservePin(chipSelectPin, module); } if (socket.SPIModule != Socket.SocketInterfaces.SPIMissing) { Interface = new NativeSpi(socket, spiConfiguration == null ? null : new Socket.SocketInterfaces.SpiConfiguration( spiConfiguration.ChipSelectActiveState, spiConfiguration.ChipSelectSetupTime, spiConfiguration.ChipSelectHoldTime, spiConfiguration.ClockIdleState, spiConfiguration.ClockEdge, spiConfiguration.ClockRateKHz, false), (Socket.SocketInterfaces.SpiSharing)sharingMode, reservedSelectPin, module, socket.SPIModule); } else { Interface = socket.SpiIndirector(socket, spiConfiguration == null ? null : new Socket.SocketInterfaces.SpiConfiguration( spiConfiguration.ChipSelectActiveState, spiConfiguration.ChipSelectSetupTime, spiConfiguration.ChipSelectHoldTime, spiConfiguration.ClockIdleState, spiConfiguration.ClockEdge, spiConfiguration.ClockRateKHz, false), (Socket.SocketInterfaces.SpiSharing)sharingMode, chipSelectSocket, chipSelectPin, null, default(Socket.Pin), module); } _spiModule = socket.SPIModule; }
/// <summary> /// /// </summary> /// <param name="socket">The <see cref="Socket"/> for the <see cref="SPI"/> interface.</param> /// <param name="spiConfiguration">The <see cref="Configuration"/> object for the <see cref="SPI"/> interface.</param> /// <param name="sharingMode">The <see cref="Sharing"/> mode of the <see cref="SPI"/> interface.</param> /// <param name="chipSelectSocket">The chip select <see cref="Socket"/>of the <see cref="SPI"/> interface.</param> /// <param name="chipSelectPin">The <see cref="Socket"/></param> /// <param name="module">The <see cref="Module"/> that is connected to the <see cref="SPI"/> interface.</param> public SPI(Socket socket, Configuration spiConfiguration, Sharing sharingMode, Socket chipSelectSocket, Socket.Pin chipSelectPin, Module module) { socket.EnsureTypeIsSupported('S', module); Cpu.Pin reservedSelectPin = Socket.UnspecifiedPin; if (chipSelectSocket != null) reservedSelectPin = chipSelectSocket.ReservePin(chipSelectPin, module); if (socket.SPIModule != Socket.SocketInterfaces.SPIMissing) Interface = new NativeSpi(socket, spiConfiguration == null ? null : new Socket.SocketInterfaces.SpiConfiguration( spiConfiguration.ChipSelectActiveState, spiConfiguration.ChipSelectSetupTime, spiConfiguration.ChipSelectHoldTime, spiConfiguration.ClockIdleState, spiConfiguration.ClockEdge, spiConfiguration.ClockRateKHz, false), (Socket.SocketInterfaces.SpiSharing)sharingMode, reservedSelectPin, module, socket.SPIModule); else Interface = socket.SpiIndirector(socket, spiConfiguration == null ? null : new Socket.SocketInterfaces.SpiConfiguration( spiConfiguration.ChipSelectActiveState, spiConfiguration.ChipSelectSetupTime, spiConfiguration.ChipSelectHoldTime, spiConfiguration.ClockIdleState, spiConfiguration.ClockEdge, spiConfiguration.ClockRateKHz, false), (Socket.SocketInterfaces.SpiSharing)sharingMode, chipSelectSocket, chipSelectPin, null, default(Socket.Pin), module); _spiModule = socket.SPIModule; }