Skip to main content

Interface ISpiBus

Represents an SPI bus.

Assembly: Meadow.Contracts.dll
View Source
Declaration
public interface ISpiBus

Properties

SupportedSpeeds

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

View Source
Declaration
Frequency[] SupportedSpeeds { get; }

Configuration

Gets the current SPI clock configuration.

View Source
Declaration
SpiClockConfiguration Configuration { get; }

Methods

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

Reads data from the SPI bus into the specified buffer.

View Source
Declaration
void Read(IDigitalOutputPort? chipSelect, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
TypeNameDescription
Meadow.Hardware.IDigitalOutputPortchipSelectThe chip select port to activate the bus.
System.Span<System.Byte>readBufferThe buffer to read data into.
Meadow.Hardware.ChipSelectModecsModeThe chip select mode that activates the peripheral.

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

Writes data to the SPI bus.

View Source
Declaration
void Write(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
TypeNameDescription
Meadow.Hardware.IDigitalOutputPortchipSelectThe chip select port to activate the peripheral.
System.Span<System.Byte>writeBufferThe buffer containing data to write.
Meadow.Hardware.ChipSelectModecsModeThe chip select mode that activates the peripheral.

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.

View Source
Declaration
void Exchange(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
TypeNameDescription
Meadow.Hardware.IDigitalOutputPortchipSelectThe chip select port to activate the peripheral.
System.Span<System.Byte>writeBufferThe buffer containing data to write.
System.Span<System.Byte>readBufferThe buffer to read returning data into.
Meadow.Hardware.ChipSelectModecsModeThe chip select mode that activates the peripheral.