UartControllerApiWrapper Class
Namespace: GHIElectronics.TinyCLR.Devices.Uart.Provider · Assembly: GHIElectronics.TinyCLR.Devices.Uart
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.
| Parameter | Type | Description |
|---|---|---|
api | NativeApi |
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; }
The number of bytes that are in the process of being written. (inherited)
BytesToRead
public extern int BytesToRead { get; }
The number of bytes 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()
Re-enables interrupts after a matching Disable. (inherited)
Disable()
public extern void Disable()
Disables interrupts on the current core. Always pair with Enable. (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)
| Parameter | Type | Description |
|---|---|---|
baudRate | int | |
dataBits | int | |
parity | UartParity | |
stopBits | UartStopBitCount | |
handshaking | UartHandshake | |
enableDePin | bool | |
invertTxPolarity | bool | |
invertRxPolarity | bool | |
invertBinaryData | bool | |
swapTxRxPin | bool | |
invertDePolarity | bool |
Flush()
public extern void Flush()
Writes unwritten data to the file. (inherited)
Read(byte[] buffer, int offset, int length)
public extern int Read(byte[] buffer, int offset, int length)
Reads a block of bytes from the stream. (inherited)
| Parameter | Type | Description |
|---|---|---|
buffer | byte[] | |
offset | int | The byte offset in the array at which read bytes will be placed. |
length | int |
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)
| Parameter | Type | Description |
|---|---|---|
buffer | byte[] | |
offset | int | |
length | int | |
breakDuration | TimeSpan |
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)