Class SpiChannel
Provides access to the Hardware SPI channels.
Implements
Inherited Members
Namespace: Unosquare.PiGpio.ManagedModel
Syntax
public sealed class SpiChannel : IDisposable
Properties
BaudRate
Gets the baud rate in bits per second.
Declaration
public int BaudRate { get; }
Property Value
Type | Description |
---|---|
Int32 |
Channel
Gets the SPI channel identifier.
Declaration
public SpiChannelId Channel { get; }
Property Value
Type | Description |
---|---|
SpiChannelId |
Flags
Gets the SPI flags this channel was opened with.
Declaration
public SpiFlags Flags { get; }
Property Value
Type | Description |
---|---|
SpiFlags |
Handle
Gets the SPI channel handle.
Declaration
public UIntPtr Handle { get; }
Property Value
Type | Description |
---|---|
UIntPtr |
Methods
Dispose()
Declaration
public void Dispose()
Read()
Reads up to one tenth of the byte rate.
Declaration
public byte[] Read()
Returns
Type | Description |
---|---|
Byte[] | The bytes that were read. |
Read(Byte[], Int32, Int32)
Reads int the specified buffer.
Declaration
public int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Int32 | offset | The offset. |
Int32 | count | The count. |
Returns
Type | Description |
---|---|
Int32 | The number of bytes read into the buffer. |
Read(Int32)
Reads up to the specified number of bytes.
Declaration
public byte[] Read(int count)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | The count. |
Returns
Type | Description |
---|---|
Byte[] | The bytes read. |
Transfer(Byte[])
Transfers the specified buffer and simultaneously reads the same amount of buyes in that send buffer.
Declaration
public byte[] Transfer(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Returns
Type | Description |
---|---|
Byte[] | The bytes that were read. |
Write(Byte[])
Writes the specified buffer.
Declaration
public int Write(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Returns
Type | Description |
---|---|
Int32 | The number of bytes written. |
Write(Byte[], Int32, Int32)
Writes the specified buffer.
Declaration
public int Write(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |
Int32 | offset | The offset. |
Int32 | count | The count. |
Returns
Type | Description |
---|---|
Int32 | The number of bytes written. |