Skip to main content

IUartControllerProvider Interface

NuGet: GHIElectronics.TinyCLR.Devices.Uart
Assembly: GHIElectronics.TinyCLR.Devices.Uart
Namespace: GHIElectronics.TinyCLR.Devices.Uart.Provider

Provider contract for a UART controller.

public interface IUartControllerProvider : IDisposable

Properties​

WriteBufferSize​

int WriteBufferSize { get; set; }

Size in bytes of the transmit buffer.

ReadBufferSize​

int ReadBufferSize { get; set; }

Size in bytes of the receive buffer.

BytesToWrite​

int BytesToWrite { get; }

Bytes currently queued for transmission.

BytesToRead​

int BytesToRead { get; }

Bytes currently available to read.

IsRequestToSendEnabled​

bool IsRequestToSendEnabled { get; set; }

Drives the RTS line when hardware handshaking is enabled.

ClearToSendState​

bool ClearToSendState { get; }

Current state of the CTS line.

Methods​

Enable()​

void Enable()

Powers on the port.

Disable()​

void Disable()

Powers off the port.

SetActiveSettings(int baudRate, int dataBits, UartParity parity, UartStopBitCount stopBits, UartHandshake handshaking, bool enableDePin, bool invertTxPolarity, bool invertRxPolarity, bool invertBinaryData, bool swapTxRxPin, bool invertDePolarity)​

void SetActiveSettings(int baudRate, int dataBits, UartParity parity, UartStopBitCount stopBits, UartHandshake handshaking, bool enableDePin, bool invertTxPolarity, bool invertRxPolarity, bool invertBinaryData, bool swapTxRxPin, bool invertDePolarity)

Applies a complete set of serial settings.

Flush()​

void Flush()

Blocks until all buffered TX bytes have been shifted out.

Read(byte[] buffer, int offset, int length)​

int Read(byte[] buffer, int offset, int length)

Reads up to length bytes; returns the count actually read.

Returns int

Write(byte[] buffer, int offset, int length, TimeSpan breakDuration)​

int Write(byte[] buffer, int offset, int length, TimeSpan breakDuration)

Writes length bytes; optional trailing break of breakDuration.

Returns int

ClearWriteBuffer()​

void ClearWriteBuffer()

Empties the transmit buffer.

ClearReadBuffer()​

void ClearReadBuffer()

Empties the receive buffer.

Events​

ClearToSendChanged​

event ClearToSendChangedEventHandler ClearToSendChanged

Raised when CTS changes state.

DataReceived​

event DataReceivedEventHandler DataReceived

Raised when receive data becomes available.

ErrorReceived​

event ErrorReceivedEventHandler ErrorReceived

Raised when a frame/parity/overrun error is detected.