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)
| Parameter | Type | Description |
|---|---|---|
connectionSettings | SpiConnectionSettings | Per-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)
| Parameter | Type | Description |
|---|---|---|
writeBuffer | byte[] | Bytes to transmit, or null for read-only. |
writeOffset | int | Starting offset within writeBuffer. |
writeLength | int | Number of bytes to transmit. |
readBuffer | byte[] | Destination buffer for received bytes, or null to discard. |
readOffset | int | Starting offset within readBuffer. |
readLength | int | Number of bytes to receive. |
deselectAfter | bool | If 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)