Characteristic Locus
Namespace Meadow.Hardware
Assembly Meadow.Contracts.dll

Syntax

public interface ISpiBus

Properties

Configuration

Gets the current SPI clock configuration.

Declaration
SpiClockConfiguration Configuration { get; }

Property Value

Type Description
SpiClockConfiguration

SupportedSpeeds

Gets an array of all supported speeds of the SPI bus.

Declaration
Frequency[] SupportedSpeeds { get; }

Property Value

Type Description
Frequency[]

Methods

Exchange(IDigitalOutputPort?, Span<byte>, Span<byte>, ChipSelectMode)

Writes data from the write buffer to a peripheral on the bus while reading return data into the read buffer.

Declaration
void Exchange(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)

Parameters

Type Name Description
IDigitalOutputPort chipSelect

The chip select port to activate the peripheral.

Span<byte> writeBuffer

The buffer containing data to write.

Span<byte> readBuffer

The buffer to read returning data into.

ChipSelectMode csMode

The chip select mode that activates the peripheral.

Read(IDigitalOutputPort?, Span<byte>, ChipSelectMode)

Reads data from the SPI bus into the specified buffer.

Declaration
void Read(IDigitalOutputPort? chipSelect, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)

Parameters

Type Name Description
IDigitalOutputPort chipSelect

The chip select port to activate the bus.

Span<byte> readBuffer

The buffer to read data into.

ChipSelectMode csMode

The chip select mode that activates the peripheral.

Write(IDigitalOutputPort?, Span<byte>, ChipSelectMode)

Writes data to the SPI bus.

Declaration
void Write(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)

Parameters

Type Name Description
IDigitalOutputPort chipSelect

The chip select port to activate the peripheral.

Span<byte> writeBuffer

The buffer containing data to write.

ChipSelectMode csMode

The chip select mode that activates the peripheral.