Skip to main content

UART

Endpoint exposes serial ports through the standard System.IO.Ports.SerialPort class. The only Endpoint-specific step is calling SerialPortController.Initialize(port) first, which claims the port's TX / RX (and optionally RTS / CTS) pins.

using System.IO.Ports;
using System.Text;
using GHIElectronics.Endpoint.Core;

// Claim the port's pins
SerialPortController.Initialize(EPDomino24.SerialPort.Uart3);

// Open with the standard .NET API
using var serial = new SerialPort {
PortName = EPDomino24.SerialPort.Uart3,
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
StopBits = StopBits.One,
};
serial.Open();

// Read whatever arrives
var buffer = new byte[64];
while (true) {
if (serial.BytesToRead > 0) {
var n = serial.Read(buffer, 0, serial.BytesToRead);
Console.WriteLine(Encoding.UTF8.GetString(buffer, 0, n));
}
Thread.Sleep(20);
}
tip

SerialPortController is chip-neutral; the same call works on any supported module. The port constant (EPDomino24.SerialPort.Uart3) is board-specific and lists only the ports actually bonded on EP-Domino24.