Skip to main content

Class Sc16is7x2.Sc16is7x2Channel

Encapsulates a channel of the SC16IS7x2 peripheral as an ISerialPort

Assembly: Sc16is7x2.dll
View Source
public class Sc16is7x2.Sc16is7x2Channel : ISerialPort, IDisposable

Implements:
Meadow.Hardware.ISerialPort, System.IDisposable

Properties

BytesToRead

Gets the number of bytes of data in the receive buffer.

View Source
public int BytesToRead { get; }

IsOpen

Gets a value indicating the open or closed status of the SerialPort object.

View Source
public bool IsOpen { get; }

PortName

Gets the port name used for communications.

View Source
public string PortName { get; }

ReceiveBufferSize

Size of the receive buffer (FIFO).

View Source
public int ReceiveBufferSize { get; }

ReadTimeout

The time required for a time-out to occur when a read operation does not finish.

View Source
public TimeSpan ReadTimeout { get; set; }

WriteTimeout

The time required for a time-out to occur when a write operation does not finish.

View Source
public TimeSpan WriteTimeout { get; set; }

BaudRate

Gets or sets the serial baud rate.

View Source
public int BaudRate { get; set; }

DataBits

Gets or sets the standard length of data bits per byte.

View Source
public int DataBits { get; set; }

Parity

Gets or sets the parity-checking protocol.

View Source
public Parity Parity { get; set; }

StopBits

Gets or sets the standard number of stopbits per byte.

View Source
public StopBits StopBits { get; set; }

Methods

ReadByte()

Synchronously reads one byte from the SerialPort input buffer.

View Source
public int ReadByte()
Returns

System.Int32: The byte, cast to an Int32, or -1 if the end of the stream has been read.### Read(byte[], int, int) Reads a number of bytes from the SerialPort input buffer and writes those bytes into a byte array at the specified offset.

View Source
public int Read(byte[] buffer, int offset, int count)
Returns

System.Int32: The number of bytes read.

Parameters
TypeNameDescription
System.Byte[]bufferThe byte array to write the input to.
System.Int32offsetThe offset in buffer at which to write the bytes.
System.Int32countThe maximum number of bytes to read. Fewer bytes are read if count is greater than the number of bytes in the input buffer.

ReadAll()

Reads all currently available bytes from the SerialPort

View Source
public byte[] ReadAll()
Returns

System.Byte[]

ClearReceiveBuffer()

Discards data from the serial driver's receive buffer.

View Source
public void ClearReceiveBuffer()

Close()

Closes the port connection and sets the IsOpen property to false.

View Source
public void Close()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Open()

Opens a new serial port connection.

View Source
public void Open()

Peek()

Returns the next available byte in the input buffer but does not consume it.

View Source
public int Peek()
Returns

System.Int32: The byte, cast to an Int32, or -1 if there is no data available in the input buffer.### Write(byte[]) Writes data to the serial port.

View Source
public int Write(byte[] buffer)
Returns

System.Int32

Parameters
TypeName
System.Byte[]buffer

Write(byte[], int, int)

Writes a specified number of bytes to the serial port using data from a buffer.

View Source
public int Write(byte[] buffer, int offset, int count)
Returns

System.Int32

Parameters
TypeNameDescription
System.Byte[]bufferThe byte array that contains the data to write to the port.
System.Int32offsetThe zero-based byte offset in the buffer parameter at which to begin copying bytes to the port.
System.Int32countThe number of bytes to write.

Events

DataReceived

Indicates that data has been received through a port represented by the SerialPort object.

View Source
public event SerialDataReceivedEventHandler DataReceived
Event Type

Meadow.Hardware.SerialDataReceivedEventHandler

BufferOverrun

Indicates that the internal data buffer has overrun and data has been lost.

View Source
public event EventHandler BufferOverrun
Event Type

System.EventHandler

Implements

  • Meadow.Hardware.ISerialPort
  • System.IDisposable