Skip to main content

SpiController Class

Namespace: GHIElectronics.TinyCLR.Devices.Spi · Assembly: GHIElectronics.TinyCLR.Devices.Spi

Represents an SPI bus controller. Obtain one via GetDefault or FromName(string), then create a SpiDevice for each chip on the bus via GetDevice(SpiConnectionSettings).

public class SpiController : IDisposable

Properties

Provider

public ISpiControllerProvider Provider { get; }

The low-level provider backing this controller.

ChipSelectLineCount

public int ChipSelectLineCount { get; }

Number of hardware chip-select lines exposed by this controller.

MinClockFrequency

public int MinClockFrequency { get; }

Minimum SCK frequency in Hz the controller can generate.

MaxClockFrequency

public int MaxClockFrequency { get; }

Maximum SCK frequency in Hz the controller can generate.

SupportedDataBitLengths

public int[] SupportedDataBitLengths { get; }

Data-frame widths in bits that this controller supports.

Methods

GetDefault()

public static SpiController GetDefault()

Returns the default SPI controller for this device.

Returns SpiController

FromName(string name)

public static SpiController FromName(string name)

Returns an SPI controller identified by its native API name.

ParameterTypeDescription
namestringNative API name.

Returns SpiController

FromProvider(ISpiControllerProvider provider)

public static SpiController FromProvider(ISpiControllerProvider provider)

Creates a controller from a custom ISpiControllerProvider (including the software bit-bang provider).

ParameterTypeDescription
providerISpiControllerProviderProvider implementing the bus operations.

Returns SpiController

Dispose()

public void Dispose()

Releases the underlying provider.

GetDevice(SpiConnectionSettings connectionSettings)

public SpiDevice GetDevice(SpiConnectionSettings connectionSettings)

Creates a SpiDevice bound to this controller using the given settings.

ParameterTypeDescription
connectionSettingsSpiConnectionSettingsPer-device clock, mode, and chip-select configuration.

Returns SpiDevice