Skip to main content

Class Ft232SpiBus

Represents an SPI bus implementation using the FT232 device.

Assembly: Ft232h.dll
View Source
Declaration
public sealed class Ft232SpiBus : ISpiBus, IDisposable

Implements:
Meadow.Hardware.ISpiBus, System.IDisposable

Properties

Handle

Gets the handle to the FT232 device.

View Source
Declaration
public IntPtr Handle { get; }

GpioDirectionMask

Gets or sets the GPIO direction mask for the FT232 device.

View Source
Declaration
public byte GpioDirectionMask { get; set; }

GpioState

Gets or sets the state of the GPIO pins on the FT232 device.

View Source
Declaration
public byte GpioState { get; set; }

SupportedSpeeds

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

View Source
Declaration
public Frequency[] SupportedSpeeds { get; }

Configuration

Gets the current SPI clock configuration.

View Source
Declaration
public SpiClockConfiguration Configuration { get; set; }

Fields

DefaultClockRate

The default SPI clock rate for the FT232H

View Source
Declaration
public const uint DefaultClockRate = 25000000

Methods

~Ft232SpiBus()

Finalizer for the Ft232SpiBus class, used to release unmanaged resources.

View Source
Declaration
protected ~Ft232SpiBus()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

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

Reads data from the SPI bus into the specified buffer.

View Source
Declaration
public 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
public 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
public 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.

Implements

  • Meadow.Hardware.ISpiBus
  • System.IDisposable