Skip to main content

IUartControllerProvider Interface

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

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.

ParameterTypeDescription
baudRateint
dataBitsint
parityUartParity
stopBitsUartStopBitCount
handshakingUartHandshake
enableDePinbool
invertTxPolaritybool
invertRxPolaritybool
invertBinaryDatabool
swapTxRxPinbool
invertDePolaritybool

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.

ParameterTypeDescription
bufferbyte[]
offsetint
lengthint

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.

ParameterTypeDescription
bufferbyte[]
offsetint
lengthint
breakDurationTimeSpan

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.