Driver for the RS-232 serial port on the roboRIO.
Definition: SerialPort.h:27
SerialPort(SerialPort &&rhs)=default
void Flush()
Force the output buffer to be written to the port.
SerialPort(int baudRate, std::string_view portName, Port port=kOnboard, int dataBits=8, Parity parity=kParity_None, StopBits stopBits=kStopBits_One)
Create an instance of a Serial Port class.
void EnableTermination(char terminator='\n')
Enable termination and specify the termination character.
void SetReadBufferSize(int size)
Specify the size of the input buffer.
StopBits
Represents the number of stop bits to use for Serial Communication.
Definition: SerialPort.h:64
@ kStopBits_OnePointFive
One and a half stop bits.
Definition: SerialPort.h:68
@ kStopBits_One
One stop bit.
Definition: SerialPort.h:66
@ kStopBits_Two
Two stop bits.
Definition: SerialPort.h:70
void SetWriteBufferSize(int size)
Specify the size of the output buffer.
SerialPort & operator=(SerialPort &&rhs)=default
SerialPort(int baudRate, Port port=kOnboard, int dataBits=8, Parity parity=kParity_None, StopBits stopBits=kStopBits_One)
Create an instance of a Serial Port class.
void DisableTermination()
Disable termination behavior.
void SetWriteBufferMode(WriteBufferMode mode)
Specify the flushing behavior of the output buffer.
int Write(const char *buffer, int count)
Write raw bytes to the buffer.
int Write(std::string_view buffer)
Write raw bytes to the buffer.
void SetTimeout(units::second_t timeout)
Configure the timeout of the serial port.
FlowControl
Represents what type of flow control to use for serial communication.
Definition: SerialPort.h:76
@ kFlowControl_XonXoff
XON/XOFF flow control.
Definition: SerialPort.h:80
@ kFlowControl_DtrDsr
DTS/DSR flow control.
Definition: SerialPort.h:84
@ kFlowControl_RtsCts
RTS/CTS flow control.
Definition: SerialPort.h:82
@ kFlowControl_None
No flow control.
Definition: SerialPort.h:78
Port
Serial port.
Definition: SerialPort.h:32
@ kOnboard
Onboard serial port on the roboRIO.
Definition: SerialPort.h:34
@ kUSB2
USB serial port 2.
Definition: SerialPort.h:42
@ kMXP
MXP (roboRIO MXP) serial port.
Definition: SerialPort.h:36
@ kUSB
USB serial port (same as KUSB1).
Definition: SerialPort.h:38
@ kUSB1
USB serial port 1.
Definition: SerialPort.h:40
void Reset()
Reset the serial port driver to a known state.
Parity
Represents the parity to use for serial communications.
Definition: SerialPort.h:48
@ kParity_Space
Parity bit always off.
Definition: SerialPort.h:58
@ kParity_None
No parity.
Definition: SerialPort.h:50
@ kParity_Mark
Parity bit always on.
Definition: SerialPort.h:56
@ kParity_Even
Even parity.
Definition: SerialPort.h:54
@ kParity_Odd
Odd parity.
Definition: SerialPort.h:52
WriteBufferMode
Represents which type of buffer mode to use when writing to a serial port.
Definition: SerialPort.h:90
@ kFlushWhenFull
Flush the buffer when it is full.
Definition: SerialPort.h:94
@ kFlushOnAccess
Flush the buffer on each access.
Definition: SerialPort.h:92
int GetBytesReceived()
Get the number of bytes currently available to read from the serial port.
int Read(char *buffer, int count)
Read raw bytes out of the buffer.
void SetFlowControl(FlowControl flowControl)
Set the type of flow control to enable on this port.
basic_string_view< char > string_view
Definition: core.h:501
constexpr auto count() -> size_t
Definition: core.h:1203
Definition: AprilTagPoseEstimator.h:15