Skip to main content

SpiControllerApiWrapper Class

NuGet: GHIElectronics.TinyCLR.Devices.Spi
Assembly: GHIElectronics.TinyCLR.Devices.Spi
Namespace: GHIElectronics.TinyCLR.Devices.Spi.Provider

Concrete ISpiControllerProvider backed by the native TinyCLR SPI HAL.

public sealed class SpiControllerApiWrapper : ISpiControllerProvider

Constructors

SpiControllerApiWrapper(NativeApi api)

public SpiControllerApiWrapper(NativeApi api)

Wraps the given native API as a provider.

Properties

Api

public NativeApi Api { get; }

The underlying native API descriptor.

ChipSelectLineCount

public extern int ChipSelectLineCount { get; }

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

MinClockFrequency

public extern int MinClockFrequency { get; }

Minimum SCK frequency in Hz. (inherited)

MaxClockFrequency

public extern int MaxClockFrequency { get; }

Maximum SCK frequency in Hz. (inherited)

SupportedDataBitLengths

public extern int[] SupportedDataBitLengths { get; }

Supported frame widths in bits. (inherited)

Methods

Dispose()

public void Dispose()

Releases the native controller.

SetActiveSettings(SpiConnectionSettings connectionSettings)

public extern void SetActiveSettings(SpiConnectionSettings connectionSettings)

Applies the given settings before the next transfer. (inherited)

ParameterTypeDescription
connectionSettingsSpiConnectionSettingsPer-device configuration.

WriteRead(byte[] writeBuffer, int writeOffset, int writeLength, byte[] readBuffer, int readOffset, int readLength, bool deselectAfter)

public extern void WriteRead(byte[] writeBuffer, int writeOffset, int writeLength, byte[] readBuffer, int readOffset, int readLength, bool deselectAfter)

Performs a full-duplex transfer. (inherited)

ParameterTypeDescription
writeBufferbyte[]Bytes to transmit, or null for read-only.
writeOffsetintStarting offset within writeBuffer.
writeLengthintNumber of bytes to transmit.
readBufferbyte[]Destination buffer for received bytes, or null to discard.
readOffsetintStarting offset within readBuffer.
readLengthintNumber of bytes to receive.
deselectAfterboolIf false, leaves chip-select asserted after the transfer (for sequential read-after-write).

Write(byte[] writeBuffer, int xOffset, int yOffset, int width, int height, int originalWidth, int columnMultiplier, int rowMultiplier)

public extern void Write(byte[] writeBuffer, int xOffset, int yOffset, int width, int height, int originalWidth, int columnMultiplier, int rowMultiplier)

Writes a rectangular framebuffer region with optional pixel replication. (inherited)