Skip to main content

UartControllerApiWrapper Class

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

Concrete IUartControllerProvider backed by the native TinyCLR UART HAL.

public sealed class UartControllerApiWrapper : IUartControllerProvider

Constructors

UartControllerApiWrapper(NativeApi api)

public UartControllerApiWrapper(NativeApi api)

Wraps the given native API as a provider.

Properties

Api

public NativeApi Api { get; }

The underlying native API descriptor.

WriteBufferSize

public extern int WriteBufferSize { get; set; }

Size in bytes of the transmit buffer. (inherited)

ReadBufferSize

public extern int ReadBufferSize { get; set; }

Size in bytes of the receive buffer. (inherited)

BytesToWrite

public extern int BytesToWrite { get; }

Bytes currently queued for transmission. (inherited)

BytesToRead

public extern int BytesToRead { get; }

Bytes currently available to read. (inherited)

IsRequestToSendEnabled

public extern bool IsRequestToSendEnabled { get; set; }

Drives the RTS line when hardware handshaking is enabled. (inherited)

ClearToSendState

public extern bool ClearToSendState { get; }

Current state of the CTS line. (inherited)

Methods

Dispose()

public void Dispose()

Releases the native controller.

Enable()

public extern void Enable()

Powers on the port. (inherited)

Disable()

public extern void Disable()

Powers off the port. (inherited)

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

public extern 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. (inherited)

Flush()

public extern void Flush()

Blocks until all buffered TX bytes have been shifted out. (inherited)

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

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

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

Returns int

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

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

Writes length bytes; optional trailing break of breakDuration. (inherited)

Returns int

ClearWriteBuffer()

public extern void ClearWriteBuffer()

Empties the transmit buffer. (inherited)

ClearReadBuffer()

public extern void ClearReadBuffer()

Empties the receive buffer. (inherited)

Events

ClearToSendChanged

public event ClearToSendChangedEventHandler ClearToSendChanged

Raised when CTS changes state. (inherited)

DataReceived

public event DataReceivedEventHandler DataReceived

Raised when receive data becomes available. (inherited)

ErrorReceived

public event ErrorReceivedEventHandler ErrorReceived

Raised when a frame/parity/overrun error is detected. (inherited)