Class SpiBus
Represents an SPI communication bus for communicating to peripherals that implement the SPI protocol.
Assembly: Meadow.F7.dll
View Source
Declaration
public class SpiBus : ISpiBus
Implements:
Meadow.Hardware.ISpiBus
Properties
Configuration
Configuration to use for this instance of the SPIBus.
View Source
Declaration
public SpiClockConfiguration Configuration { get; }
SupportedSpeeds
Gets an array of all of the speeds that the SPI bus supports.
View Source
Declaration
public Frequency[] SupportedSpeeds { get; }
Methods
Read(IDigitalOutputPort?, Span<byte>, ChipSelectMode)
Reads data from the SPI bus into the buffer.
View Source
Declaration
public void Read(IDigitalOutputPort? chipSelect, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Hardware.IDigitalOutputPort | chipSelect | Port to use as the chip select to activate the bus. |
System.Span<System.Byte> | readBuffer | Data to write |
| Meadow.Hardware.ChipSelectMode | csMode | Describes which level on the chip select activates the peripheral. |
Write(IDigitalOutputPort?, Span<byte>, ChipSelectMode)
Writes data to the SPI bus
View Source
Declaration
public void Write(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Hardware.IDigitalOutputPort | chipSelect | IPin to use as the chip select to activate the bus |
System.Span<System.Byte> | writeBuffer | Data to write |
| Meadow.Hardware.ChipSelectMode | csMode | Describes which level on the chip select activates the bus |
Exchange(IDigitalOutputPort?, Span<byte>, Span<byte>, ChipSelectMode)
Writes data from the write buffer to a peripheral on the bus while at the same time reading return data into the read buffer.
View Source
Declaration
public void Exchange(IDigitalOutputPort? chipSelect, Span<byte> writeBuffer, Span<byte> readBuffer, ChipSelectMode csMode = ChipSelectMode.ActiveLow)
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Hardware.IDigitalOutputPort | chipSelect | Port to use as the chip select to activate the peripheral. |
System.Span<System.Byte> | writeBuffer | Buffer to read data from. |
System.Span<System.Byte> | readBuffer | Buffer to read returning data into. |
| Meadow.Hardware.ChipSelectMode | csMode | Describes which level on the chip select activates the peripheral. |