11#include "wpi/units/time.hpp"
171 int Read(
char* buffer,
int count);
180 int Write(
const char* buffer,
int count);
StopBits
Represents the number of stop bits to use for Serial Communication.
Definition SerialPort.hpp:64
@ kStopBits_OnePointFive
One and a half stop bits.
Definition SerialPort.hpp:68
@ kStopBits_One
One stop bit.
Definition SerialPort.hpp:66
@ kStopBits_Two
Two stop bits.
Definition SerialPort.hpp:70
int Read(char *buffer, int count)
Read raw bytes out of the buffer.
void SetTimeout(wpi::units::second_t timeout)
Configure the timeout of the serial port.
void DisableTermination()
Disable termination behavior.
void EnableTermination(char terminator='\n')
Enable termination and specify the termination character.
SerialPort(SerialPort &&rhs)=default
int Write(std::string_view buffer)
Write raw bytes to the buffer.
void SetWriteBufferSize(int size)
Specify the size of the output buffer.
Parity
Represents the parity to use for serial communications.
Definition SerialPort.hpp:48
@ kParity_Space
Parity bit always off.
Definition SerialPort.hpp:58
@ kParity_Mark
Parity bit always on.
Definition SerialPort.hpp:56
@ kParity_Even
Even parity.
Definition SerialPort.hpp:54
@ kParity_Odd
Odd parity.
Definition SerialPort.hpp:52
@ kParity_None
No parity.
Definition SerialPort.hpp:50
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.
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.
WriteBufferMode
Represents which type of buffer mode to use when writing to a serial port.
Definition SerialPort.hpp:90
@ kFlushOnAccess
Flush the buffer on each access.
Definition SerialPort.hpp:92
@ kFlushWhenFull
Flush the buffer when it is full.
Definition SerialPort.hpp:94
void Flush()
Force the output buffer to be written to the port.
int GetBytesReceived()
Get the number of bytes currently available to read from the serial port.
void SetReadBufferSize(int size)
Specify the size of the input buffer.
SerialPort & operator=(SerialPort &&rhs)=default
void SetWriteBufferMode(WriteBufferMode mode)
Specify the flushing behavior of the output buffer.
void Reset()
Reset the serial port driver to a known state.
int Write(const char *buffer, int count)
Write raw bytes to the buffer.
Port
Serial port.
Definition SerialPort.hpp:32
@ kUSB1
USB serial port 1.
Definition SerialPort.hpp:40
@ kUSB
USB serial port (same as kUSB1).
Definition SerialPort.hpp:38
@ kOnboard
Onboard serial port on the roboRIO.
Definition SerialPort.hpp:34
@ kMXP
MXP (roboRIO MXP) serial port.
Definition SerialPort.hpp:36
@ kUSB2
USB serial port 2.
Definition SerialPort.hpp:42
void SetFlowControl(FlowControl flowControl)
Set the type of flow control to enable on this port.
FlowControl
Represents what type of flow control to use for serial communication.
Definition SerialPort.hpp:76
@ kFlowControl_RtsCts
RTS/CTS flow control.
Definition SerialPort.hpp:82
@ kFlowControl_XonXoff
XON/XOFF flow control.
Definition SerialPort.hpp:80
@ kFlowControl_DtrDsr
DTS/DSR flow control.
Definition SerialPort.hpp:84
@ kFlowControl_None
No flow control.
Definition SerialPort.hpp:78
A move-only C++ wrapper around a HAL handle.
Definition Types.hpp:16
Definition CvSource.hpp:15