Skip to main content

SpiDevice Class

NuGet: GHIElectronics.TinyCLR.Devices.Spi
Assembly: System.Device.Spi
Namespace: System.Device.Spi

.NET-style SPI device. Standard surface (Read / Write / TransferFullDuplex); internally TinyCLR routes calls through GHIElectronics.TinyCLR.Devices.Spi.SpiController.

public abstract class SpiDevice : IDisposable

Properties

ConnectionSettings

public abstract SpiConnectionSettings ConnectionSettings { get; }

The settings this device was created with.

Methods

Create(SpiConnectionSettings settings)

public static SpiDevice Create(SpiConnectionSettings settings)

Opens an SPI device with the given settings.

Returns SpiDevice

Read(byte[] buffer)

public abstract void Read(byte[] buffer)

Reads bytes from the device into the buffer.

Write(byte[] buffer)

public abstract void Write(byte[] buffer)

Writes the buffer to the device.

TransferFullDuplex(byte[] writeBuffer, byte[] readBuffer)

public abstract void TransferFullDuplex(byte[] writeBuffer, byte[] readBuffer)

Writes and reads at the same time (full duplex). Both buffers must be the same length.

Dispose()

public abstract void Dispose()

Closes the device and releases the bus.