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
@ TWO
Two stop bits.
Definition SerialPort.hpp:70
@ ONE_POINT_FIVE
One and a half stop bits.
Definition SerialPort.hpp:68
@ ONE
One stop bit.
Definition SerialPort.hpp:66
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
@ MARK
Parity bit always on.
Definition SerialPort.hpp:56
@ ODD
Odd parity.
Definition SerialPort.hpp:52
@ SPACE
Parity bit always off.
Definition SerialPort.hpp:58
@ EVEN
Even parity.
Definition SerialPort.hpp:54
@ NONE
No parity.
Definition SerialPort.hpp:50
WriteBufferMode
Represents which type of buffer mode to use when writing to a serial port.
Definition SerialPort.hpp:90
@ FLUSH_ON_ACCESS
Flush the buffer on each access.
Definition SerialPort.hpp:92
@ FLUSH_WHEN_FULL
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.
SerialPort(int baudRate, std::string_view portName, Port port=Port::ONBOARD, int dataBits=8, Parity parity=Parity::NONE, StopBits stopBits=StopBits::ONE)
Create an instance of a Serial Port class.
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
@ MXP
MXP (roboRIO MXP) serial port.
Definition SerialPort.hpp:36
@ ONBOARD
Onboard serial port on the roboRIO.
Definition SerialPort.hpp:34
@ USB_1
USB serial port 1.
Definition SerialPort.hpp:40
@ USB_2
USB serial port 2.
Definition SerialPort.hpp:42
@ USB
USB serial port (same as USB_1).
Definition SerialPort.hpp:38
void SetFlowControl(FlowControl flowControl)
Set the type of flow control to enable on this port.
SerialPort(int baudRate, Port port=Port::ONBOARD, int dataBits=8, Parity parity=Parity::NONE, StopBits stopBits=StopBits::ONE)
Create an instance of a Serial Port class.
FlowControl
Represents what type of flow control to use for serial communication.
Definition SerialPort.hpp:76
@ DTR_DSR
DTS/DSR flow control.
Definition SerialPort.hpp:84
@ RTS_CTS
RTS/CTS flow control.
Definition SerialPort.hpp:82
@ XON_XOFF
XON/XOFF flow control.
Definition SerialPort.hpp:80
A move-only C++ wrapper around a HAL handle.
Definition Types.hpp:16
Definition CvSource.hpp:15