Class PvDeviceSPIBus
Provides SPI bus communication over a device serial port.
Implements
Inherited Members
Namespace: eBUSDotNetReceive
Assembly: eBUSDotNetReceive.dll
Syntax
public class PvDeviceSPIBus : IDisposable
Constructors
View SourcePvDeviceSPIBus()
Constructor.
Declaration
public PvDeviceSPIBus()
Fields
View SourceswigCMemOwn
Determines who is responsible for deleting the underlying C++ object.
Declaration
protected bool swigCMemOwn
Field Value
| Type | Description |
|---|---|
| bool |
Properties
View SourceIsOpened
Gets whether the SPI bus is currently opened.
Declaration
public bool IsOpened { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceBurstRead(byte[], uint, out uint)
Performs a burst read operation over SPI.
Declaration
public PvResult BurstRead(byte[] aBuffer, uint aBufferSize, out uint aBytesRead)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aBuffer | Buffer to receive the read data. |
| uint | aBufferSize | Maximum number of bytes to read. |
| uint | aBytesRead | Number of bytes actually read. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
BurstRead(byte[], uint, out uint, uint)
Performs a burst read operation over SPI.
Declaration
public PvResult BurstRead(byte[] aBuffer, uint aBufferSize, out uint aBytesRead, uint aTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aBuffer | Buffer to receive the read data. |
| uint | aBufferSize | Maximum number of bytes to read. |
| uint | aBytesRead | Number of bytes actually read. |
| uint | aTimeout | Optional timeout in milliseconds. Default is 0 (no timeout). |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
BurstWriteAndRead(byte[], uint)
Performs a burst write and optional read operation over SPI.
Declaration
public PvResult BurstWriteAndRead(byte[] aWriteBuffer, uint aWriteBufferSize)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aWriteBuffer | Buffer containing data to write. |
| uint | aWriteBufferSize | Number of bytes to write. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
BurstWriteAndRead(byte[], uint, uint)
Performs a burst write and optional read operation over SPI.
Declaration
public PvResult BurstWriteAndRead(byte[] aWriteBuffer, uint aWriteBufferSize, uint aReadBufferSize)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aWriteBuffer | Buffer containing data to write. |
| uint | aWriteBufferSize | Number of bytes to write. |
| uint | aReadBufferSize | Number of bytes to read back. Default is 0. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
BurstWriteAndRead(byte[], uint, uint, bool)
Performs a burst write and optional read operation over SPI.
Declaration
public PvResult BurstWriteAndRead(byte[] aWriteBuffer, uint aWriteBufferSize, uint aReadBufferSize, bool aWriteRead)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aWriteBuffer | Buffer containing data to write. |
| uint | aWriteBufferSize | Number of bytes to write. |
| uint | aReadBufferSize | Number of bytes to read back. Default is 0. |
| bool | aWriteRead | If true, perform a write-then-read sequence. Default is false. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
BurstWriteAndRead(byte[], uint, uint, bool, bool)
Performs a burst write and optional read operation over SPI.
Declaration
public PvResult BurstWriteAndRead(byte[] aWriteBuffer, uint aWriteBufferSize, uint aReadBufferSize, bool aWriteRead, bool aSSNFlagOn)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | aWriteBuffer | Buffer containing data to write. |
| uint | aWriteBufferSize | Number of bytes to write. |
| uint | aReadBufferSize | Number of bytes to read back. Default is 0. |
| bool | aWriteRead | If true, perform a write-then-read sequence. Default is false. |
| bool | aSSNFlagOn | If true, keep slave select asserted across transactions. Default is false. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
Close()
Closes the SPI bus connection.
Declaration
public PvResult Close()
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |
Dispose()
Dispose.
Declaration
public void Dispose()
Dispose(bool)
Dispose
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
~PvDeviceSPIBus()
Destructor.
Declaration
protected ~PvDeviceSPIBus()
IsSupported(IPvDeviceAdapterSwigInterface, PvDeviceSerial)
Checks if SPI communication is supported on the specified device port.
Declaration
public static bool IsSupported(IPvDeviceAdapterSwigInterface aDevice, PvDeviceSerial aPort = PvDeviceSerial.PvDeviceSerialBulk0)
Parameters
| Type | Name | Description |
|---|---|---|
| IPvDeviceAdapterSwigInterface | aDevice | The device adapter to check. |
| PvDeviceSerial | aPort | The serial port to check. Default is PvDeviceSerialBulk0. |
Returns
| Type | Description |
|---|---|
| bool | True if supported, false otherwise. |
Open(IPvDeviceAdapterSwigInterface, PvDeviceSerial)
Opens the SPI bus on the specified device serial port.
Declaration
public PvResult Open(IPvDeviceAdapterSwigInterface aDevice, PvDeviceSerial aPort = PvDeviceSerial.PvDeviceSerialBulk0)
Parameters
| Type | Name | Description |
|---|---|---|
| IPvDeviceAdapterSwigInterface | aDevice | The device adapter providing access to the device. |
| PvDeviceSerial | aPort | The serial port to use for SPI communication. Default is PvDeviceSerialBulk0. |
Returns
| Type | Description |
|---|---|
| PvResult | Result of the operation. |